Skip to content

Commit c73ac48

Browse files
juanrod2sys_zuul
authored andcommitted
No material for open source
Change-Id: I3f3b873b2de188922b9907714a280033f179c75a
1 parent a838f09 commit c73ac48

File tree

5 files changed

+52
-15
lines changed

5 files changed

+52
-15
lines changed

IGC/Compiler/CISACodeGen/GenCodeGenModule.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,6 @@ bool GenXFunctionGroupAnalysis::verify()
513513
Function *F = *FI;
514514
if (F->hasFnAttribute("IndirectlyCalled"))
515515
{
516-
// Check if all extern functions are added to the main kernel group
517-
FunctionGroup* FG = getGroup(F);
518-
FunctionGroup* defaultFG = getGroupForHead(getDefaultKernel());
519-
if (FG != defaultFG)
520-
return false;
521516
continue;
522517
}
523518
// If F is an unused non-kernel function, although it should have been

visa/FlowGraph.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5440,8 +5440,16 @@ void RelocationEntry::dump() const
54405440
{
54415441
case RelocationType::R_NONE:
54425442
std::cerr << "R_NONE: symbol name = " << symName;
5443+
break;
54435444
case RelocationType::R_SYM_ADDR:
54445445
std::cerr << "R_SYM_ADDR: symbol name = " << symName;
5446+
break;
5447+
case RelocationType::R_SYM_ADDR_32:
5448+
std::cerr << "R_SYM_ADDR_32: symbol name = " << symName;
5449+
break;
5450+
case RelocationType::R_SYM_ADDR_32_HI:
5451+
std::cerr << "R_SYM_ADDR_32_HI: symbol name = " << symName;
5452+
break;
54455453
}
54465454
std::cerr << "\n";
54475455
}

visa/FlowGraph.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,12 +1235,12 @@ class RelocationEntry
12351235
std::string symName; // the symbol name that it's address to be resolved
12361236

12371237
RelocationEntry(G4_INST* i, int pos, RelocationType type, const std::string& symbolName) :
1238-
inst(i), opndPos(pos), relocType(type), symName(symbolName) {}
1238+
inst(i), opndPos(pos), relocType(type), symName(symbolName){}
12391239

12401240
public:
1241-
static RelocationEntry createSymbolAddrReloc(G4_INST* inst, int opndPos, const std::string& symbolName)
1241+
static RelocationEntry createSymbolAddrReloc(G4_INST* inst, int opndPos, const std::string& symbolName, RelocationType type)
12421242
{
1243-
RelocationEntry entry(inst, opndPos, RelocationType::R_SYM_ADDR, symbolName);
1243+
RelocationEntry entry(inst, opndPos, type, symbolName);
12441244
return entry;
12451245
}
12461246

@@ -1260,6 +1260,10 @@ class RelocationEntry
12601260
{
12611261
case RelocationType::R_SYM_ADDR:
12621262
return "R_SYM_ADDR";
1263+
case RelocationType::R_SYM_ADDR_32:
1264+
return "R_SYM_ADDR_32";
1265+
case RelocationType::R_SYM_ADDR_32_HI:
1266+
return "R_SYM_ADDR_32_HI";
12631267
default:
12641268
assert(false && "unhandled relocation type");
12651269
return "";
@@ -1273,7 +1277,12 @@ class RelocationEntry
12731277

12741278
const std::string& getSymbolName() const
12751279
{
1276-
assert(relocType == RelocationType::R_SYM_ADDR && "invalid relocation type");
1280+
bool isValidRelocType =
1281+
relocType == RelocationType::R_SYM_ADDR ||
1282+
relocType == RelocationType::R_SYM_ADDR_32 ||
1283+
relocType == RelocationType::R_SYM_ADDR_32_HI;
1284+
1285+
assert(isValidRelocType && "invalid relocation type");
12771286
return symName;
12781287
}
12791288

visa/TranslationInterface.cpp

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,12 +2354,35 @@ int IR_Builder::translateVISACFSymbolInst(const std::string& symbolName, G4_DstR
23542354
startTimer(TIMER_VISA_BUILDER_IR_CONSTRUCTION);
23552355
#endif
23562356

2357-
// symbolic imm representing symbol's address
2358-
auto funcAddr = createRelocImm(Type_UQ);
2359-
auto movInst = createInst(nullptr, G4_mov, nullptr, false, 1, dst, funcAddr, nullptr, InstOpt_WriteEnable);
2357+
if (no64bitType())
2358+
{
2359+
auto* funcAddrLow = createRelocImm(Type_UD);
2360+
auto* funcAddrHigh = createRelocImm(Type_UD);
2361+
2362+
dst->setType(Type_UD);
2363+
G4_INST* movLo = createInst(nullptr, G4_mov, nullptr, false, 1, dst, funcAddrLow, nullptr, InstOpt_WriteEnable);
2364+
G4_DstRegRegion* tempDst = createDstRegRegion(*dst);
2365+
2366+
tempDst->setSubRegOff(1);
2367+
tempDst->setType(Type_UD);
2368+
G4_INST* movHi = createInst(nullptr, G4_mov, nullptr, false, 1, tempDst, funcAddrHigh, nullptr, InstOpt_WriteEnable);
2369+
2370+
RelocationEntry relocEntryLo = RelocationEntry::createSymbolAddrReloc(movLo, 0, symbolName, GenRelocType::R_SYM_ADDR_32);
2371+
kernel.addRelocation(relocEntryLo);
2372+
2373+
RelocationEntry relocEntryHi = RelocationEntry::createSymbolAddrReloc(movHi, 0, symbolName, GenRelocType::R_SYM_ADDR_32_HI);
2374+
kernel.addRelocation(relocEntryHi);
23602375

2361-
RelocationEntry relocEntry = RelocationEntry::createSymbolAddrReloc(movInst, 0, symbolName);
2362-
kernel.addRelocation(relocEntry);
2376+
}
2377+
else
2378+
{
2379+
// symbolic imm representing symbol's address
2380+
auto funcAddr = createRelocImm(Type_UQ);
2381+
auto movInst = createInst(nullptr, G4_mov, nullptr, false, 1, dst, funcAddr, nullptr, InstOpt_WriteEnable);
2382+
2383+
RelocationEntry relocEntry = RelocationEntry::createSymbolAddrReloc(movInst, 0, symbolName, GenRelocType::R_SYM_ADDR);
2384+
kernel.addRelocation(relocEntry);
2385+
}
23632386

23642387
#if defined(MEASURE_COMPILATION_TIME) && defined(TIME_IR_CONSTRUCTION)
23652388
stopTimer(TIMER_VISA_BUILDER_IR_CONSTRUCTION);

visa/include/RelocationInfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ typedef struct {
5757
/// GenRelocType - Specify the relocation's type
5858
enum GenRelocType {
5959
R_NONE = 0,
60-
R_SYM_ADDR = 1
60+
R_SYM_ADDR = 1, //64-bit type
61+
R_SYM_ADDR_32 = 2, //lower 32-bit of 64-bit address.
62+
R_SYM_ADDR_32_HI = 3 //higher 32bits of 64-bit address
6163
};
6264

6365
/// GenRelocEntry - An relocation table entry

0 commit comments

Comments
 (0)