L0 Support for Dynamic Module Linking for undefined symbols

- Support for L0 apps to handle undefined symbols reported by IGC
- Removed duplication of symbol in exported symbol list and relocation
for properly resolving the symbol during dynamic link
- Add export module's exported function surface state to the import
module's residency container during dynamic linkage to allow import
kernels to execute exported functions.

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
This commit is contained in:
Spruit, Neil R
2021-07-09 20:00:18 +00:00
committed by Compute-Runtime-Automation
parent ad19eda689
commit d119494854
7 changed files with 100 additions and 0 deletions

View File

@@ -75,6 +75,15 @@ bool LinkerInput::decodeExportedFunctionsSymbolTable(const void *data, uint32_t
DEBUG_BREAK_IF(true);
this->valid = false;
return false;
case vISA::S_UNDEF:
if (this->undefinedSymbolsAllowed) {
symbols.erase(symbolEntryIt->s_name);
break;
} else {
DEBUG_BREAK_IF(true);
this->valid = false;
return false;
}
case vISA::S_GLOBAL_VAR:
symbolInfo.segment = SegmentType::GlobalVariables;
traits.exportsGlobalVariables = true;

View File

@@ -135,6 +135,8 @@ struct LinkerInput {
return valid;
}
bool undefinedSymbolsAllowed = false;
protected:
Traits traits;
SymbolMap symbols;

View File

@@ -42,6 +42,7 @@ struct ProgramInfo {
std::vector<KernelInfo *> kernelInfos;
Elf::Elf<Elf::EI_CLASS_64> decodedElf;
uint32_t grfSize = 32U;
bool levelZeroDynamicLinkProgram = false;
};
size_t getMaxInlineSlmNeeded(const ProgramInfo &programInfo);

View File

@@ -34,6 +34,7 @@ void populateSingleKernelInfo(ProgramInfo &dst, const PatchTokenBinary::ProgramF
if (decodedKernel.tokens.programSymbolTable) {
dst.prepareLinkerInputStorage();
dst.linkerInput->undefinedSymbolsAllowed = dst.levelZeroDynamicLinkProgram;
dst.linkerInput->decodeExportedFunctionsSymbolTable(decodedKernel.tokens.programSymbolTable + 1, decodedKernel.tokens.programSymbolTable->NumEntries, kernelNum);
}