mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Revert "Default L0 Function & Global Symbols with fallback build"
This reverts commit 2157f15594.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
536284d755
commit
c3fffcc8c0
@@ -51,8 +51,6 @@ NEO::ConstStringRef greaterThan4GbRequired = "-ze-opt-greater-than-4GB-buffer-re
|
|||||||
NEO::ConstStringRef hasBufferOffsetArg = "-ze-intel-has-buffer-offset-arg";
|
NEO::ConstStringRef hasBufferOffsetArg = "-ze-intel-has-buffer-offset-arg";
|
||||||
NEO::ConstStringRef debugKernelEnable = "-ze-kernel-debug-enable";
|
NEO::ConstStringRef debugKernelEnable = "-ze-kernel-debug-enable";
|
||||||
NEO::ConstStringRef profileFlags = "-zet-profile-flags";
|
NEO::ConstStringRef profileFlags = "-zet-profile-flags";
|
||||||
NEO::ConstStringRef enableLibraryCompile = "-library-compilation";
|
|
||||||
NEO::ConstStringRef enableGlobalVariableSymbols = "-ze-take-global-address";
|
|
||||||
} // namespace BuildOptions
|
} // namespace BuildOptions
|
||||||
|
|
||||||
ModuleTranslationUnit::ModuleTranslationUnit(L0::Device *device)
|
ModuleTranslationUnit::ModuleTranslationUnit(L0::Device *device)
|
||||||
@@ -174,70 +172,6 @@ bool ModuleTranslationUnit::processSpecConstantInfo(NEO::CompilerInterface *comp
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModuleTranslationUnit::attemptGenBinaryCompile(NEO::TranslationInput inputArgs, bool staticLink, bool libraryExportRequired, bool globalExportRequired) {
|
|
||||||
auto result = this->compileGenBinary(inputArgs, staticLink);
|
|
||||||
std::string enableGlobalFlag(BuildOptions::enableGlobalVariableSymbols.str().c_str());
|
|
||||||
std::string enableLibraryFlag(BuildOptions::enableLibraryCompile.str().c_str());
|
|
||||||
bool completedGlobalFlagRemovalCheck = false;
|
|
||||||
bool completedLibraryFlagRemovalCheck = false;
|
|
||||||
if (result == false) {
|
|
||||||
if (!globalExportRequired || !libraryExportRequired) {
|
|
||||||
// If the build failed, attempt to remove the implicit flags for Global Variables and/or Library Compile
|
|
||||||
std::string reducedOptions(options);
|
|
||||||
// Attempt build with only removing the Global Variable Flag
|
|
||||||
if (!globalExportRequired) {
|
|
||||||
std::string globalFlagRemoved(options);
|
|
||||||
size_t optionPos = std::string::npos;
|
|
||||||
optionPos = reducedOptions.find(enableGlobalFlag.c_str());
|
|
||||||
if (optionPos != std::string::npos) {
|
|
||||||
reducedOptions.erase(optionPos, BuildOptions::enableGlobalVariableSymbols.length());
|
|
||||||
}
|
|
||||||
optionPos = globalFlagRemoved.find(enableGlobalFlag.c_str());
|
|
||||||
if (optionPos != std::string::npos) {
|
|
||||||
globalFlagRemoved.erase(optionPos, BuildOptions::enableGlobalVariableSymbols.length());
|
|
||||||
inputArgs.apiOptions = ArrayRef<const char>(globalFlagRemoved.c_str(), globalFlagRemoved.length());
|
|
||||||
result = this->compileGenBinary(inputArgs, staticLink);
|
|
||||||
if (result == true) {
|
|
||||||
options.assign(globalFlagRemoved);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
completedGlobalFlagRemovalCheck = true;
|
|
||||||
}
|
|
||||||
// Attempt build with only removing the Library Export Symbol Flag
|
|
||||||
if (!libraryExportRequired) {
|
|
||||||
std::string libraryFlagRemoved(options);
|
|
||||||
size_t optionPos = std::string::npos;
|
|
||||||
optionPos = reducedOptions.find(enableLibraryFlag.c_str());
|
|
||||||
if (optionPos != std::string::npos) {
|
|
||||||
reducedOptions.erase(optionPos, BuildOptions::enableLibraryCompile.length());
|
|
||||||
}
|
|
||||||
optionPos = libraryFlagRemoved.find(enableLibraryFlag.c_str());
|
|
||||||
if (optionPos != std::string::npos) {
|
|
||||||
libraryFlagRemoved.erase(optionPos, BuildOptions::enableLibraryCompile.length());
|
|
||||||
inputArgs.apiOptions = ArrayRef<const char>(libraryFlagRemoved.c_str(), libraryFlagRemoved.length());
|
|
||||||
result = this->compileGenBinary(inputArgs, staticLink);
|
|
||||||
if (result == true) {
|
|
||||||
options.assign(libraryFlagRemoved);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
completedLibraryFlagRemovalCheck = true;
|
|
||||||
}
|
|
||||||
// Attempt build with the removal of both library and Global Variable flags
|
|
||||||
if (completedGlobalFlagRemovalCheck && completedLibraryFlagRemovalCheck) {
|
|
||||||
inputArgs.apiOptions = ArrayRef<const char>(reducedOptions.c_str(), reducedOptions.length());
|
|
||||||
result = this->compileGenBinary(inputArgs, staticLink);
|
|
||||||
if (result == true) {
|
|
||||||
options.assign(reducedOptions);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ModuleTranslationUnit::compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink) {
|
bool ModuleTranslationUnit::compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink) {
|
||||||
auto compilerInterface = device->getNEODevice()->getCompilerInterface();
|
auto compilerInterface = device->getNEODevice()->getCompilerInterface();
|
||||||
UNRECOVERABLE_IF(nullptr == compilerInterface);
|
UNRECOVERABLE_IF(nullptr == compilerInterface);
|
||||||
@@ -271,7 +205,7 @@ bool ModuleTranslationUnit::compileGenBinary(NEO::TranslationInput inputArgs, bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ModuleTranslationUnit::staticLinkSpirV(std::vector<const char *> inputSpirVs, std::vector<uint32_t> inputModuleSizes, const char *buildOptions, const char *internalBuildOptions,
|
bool ModuleTranslationUnit::staticLinkSpirV(std::vector<const char *> inputSpirVs, std::vector<uint32_t> inputModuleSizes, const char *buildOptions, const char *internalBuildOptions,
|
||||||
std::vector<const ze_module_constants_t *> specConstants, bool libraryExportRequired, bool globalExportRequired) {
|
std::vector<const ze_module_constants_t *> specConstants) {
|
||||||
auto compilerInterface = device->getNEODevice()->getCompilerInterface();
|
auto compilerInterface = device->getNEODevice()->getCompilerInterface();
|
||||||
UNRECOVERABLE_IF(nullptr == compilerInterface);
|
UNRECOVERABLE_IF(nullptr == compilerInterface);
|
||||||
|
|
||||||
@@ -291,11 +225,11 @@ bool ModuleTranslationUnit::staticLinkSpirV(std::vector<const char *> inputSpirV
|
|||||||
linkInputArgs.src = ArrayRef<const char>(reinterpret_cast<const char *>(spirvElfSource.data()), spirvElfSource.size());
|
linkInputArgs.src = ArrayRef<const char>(reinterpret_cast<const char *>(spirvElfSource.data()), spirvElfSource.size());
|
||||||
linkInputArgs.apiOptions = ArrayRef<const char>(options.c_str(), options.length());
|
linkInputArgs.apiOptions = ArrayRef<const char>(options.c_str(), options.length());
|
||||||
linkInputArgs.internalOptions = ArrayRef<const char>(internalOptions.c_str(), internalOptions.length());
|
linkInputArgs.internalOptions = ArrayRef<const char>(internalOptions.c_str(), internalOptions.length());
|
||||||
return this->attemptGenBinaryCompile(linkInputArgs, true, libraryExportRequired, globalExportRequired);
|
return this->compileGenBinary(linkInputArgs, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions,
|
bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions,
|
||||||
const ze_module_constants_t *pConstants, bool libraryExportRequired, bool globalExportRequired) {
|
const ze_module_constants_t *pConstants) {
|
||||||
auto compilerInterface = device->getNEODevice()->getCompilerInterface();
|
auto compilerInterface = device->getNEODevice()->getCompilerInterface();
|
||||||
UNRECOVERABLE_IF(nullptr == compilerInterface);
|
UNRECOVERABLE_IF(nullptr == compilerInterface);
|
||||||
|
|
||||||
@@ -310,10 +244,10 @@ bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize
|
|||||||
inputArgs.src = ArrayRef<const char>(input, inputSize);
|
inputArgs.src = ArrayRef<const char>(input, inputSize);
|
||||||
inputArgs.apiOptions = ArrayRef<const char>(options.c_str(), options.length());
|
inputArgs.apiOptions = ArrayRef<const char>(options.c_str(), options.length());
|
||||||
inputArgs.internalOptions = ArrayRef<const char>(internalOptions.c_str(), internalOptions.length());
|
inputArgs.internalOptions = ArrayRef<const char>(internalOptions.c_str(), internalOptions.length());
|
||||||
return this->attemptGenBinaryCompile(inputArgs, false, libraryExportRequired, globalExportRequired);
|
return this->compileGenBinary(inputArgs, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inputSize, bool libraryExportRequired, bool globalExportRequired) {
|
bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inputSize) {
|
||||||
UNRECOVERABLE_IF((nullptr == device) || (nullptr == device->getNEODevice()));
|
UNRECOVERABLE_IF((nullptr == device) || (nullptr == device->getNEODevice()));
|
||||||
auto productAbbreviation = NEO::hardwarePrefix[device->getNEODevice()->getHardwareInfo().platform.eProductFamily];
|
auto productAbbreviation = NEO::hardwarePrefix[device->getNEODevice()->getHardwareInfo().platform.eProductFamily];
|
||||||
|
|
||||||
@@ -366,7 +300,7 @@ bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inp
|
|||||||
updateBuildLog(NEO::CompilerWarnings::recompiledFromIr.str());
|
updateBuildLog(NEO::CompilerWarnings::recompiledFromIr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildFromSpirV(this->irBinary.get(), static_cast<uint32_t>(this->irBinarySize), this->options.c_str(), "", nullptr, libraryExportRequired, globalExportRequired);
|
return buildFromSpirV(this->irBinary.get(), static_cast<uint32_t>(this->irBinarySize), this->options.c_str(), "", nullptr);
|
||||||
} else {
|
} else {
|
||||||
return processUnpackedBinary();
|
return processUnpackedBinary();
|
||||||
}
|
}
|
||||||
@@ -574,17 +508,13 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice)
|
|||||||
inputModuleSizes,
|
inputModuleSizes,
|
||||||
buildOptions.c_str(),
|
buildOptions.c_str(),
|
||||||
internalBuildOptions.c_str(),
|
internalBuildOptions.c_str(),
|
||||||
specConstants,
|
specConstants);
|
||||||
this->libraryExportRequired,
|
|
||||||
this->globalExportRequired);
|
|
||||||
} else {
|
} else {
|
||||||
success = this->translationUnit->buildFromSpirV(reinterpret_cast<const char *>(programExpDesc->pInputModules[0]),
|
success = this->translationUnit->buildFromSpirV(reinterpret_cast<const char *>(programExpDesc->pInputModules[0]),
|
||||||
inputModuleSizes[0],
|
inputModuleSizes[0],
|
||||||
buildOptions.c_str(),
|
buildOptions.c_str(),
|
||||||
internalBuildOptions.c_str(),
|
internalBuildOptions.c_str(),
|
||||||
firstSpecConstants,
|
firstSpecConstants);
|
||||||
this->libraryExportRequired,
|
|
||||||
this->globalExportRequired);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -600,16 +530,14 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice)
|
|||||||
|
|
||||||
if (desc->format == ZE_MODULE_FORMAT_NATIVE) {
|
if (desc->format == ZE_MODULE_FORMAT_NATIVE) {
|
||||||
success = this->translationUnit->createFromNativeBinary(
|
success = this->translationUnit->createFromNativeBinary(
|
||||||
reinterpret_cast<const char *>(desc->pInputModule), desc->inputSize, this->libraryExportRequired, this->globalExportRequired);
|
reinterpret_cast<const char *>(desc->pInputModule), desc->inputSize);
|
||||||
} else if (desc->format == ZE_MODULE_FORMAT_IL_SPIRV) {
|
} else if (desc->format == ZE_MODULE_FORMAT_IL_SPIRV) {
|
||||||
this->builtFromSPIRv = true;
|
this->builtFromSPIRv = true;
|
||||||
success = this->translationUnit->buildFromSpirV(reinterpret_cast<const char *>(desc->pInputModule),
|
success = this->translationUnit->buildFromSpirV(reinterpret_cast<const char *>(desc->pInputModule),
|
||||||
static_cast<uint32_t>(desc->inputSize),
|
static_cast<uint32_t>(desc->inputSize),
|
||||||
buildOptions.c_str(),
|
buildOptions.c_str(),
|
||||||
internalBuildOptions.c_str(),
|
internalBuildOptions.c_str(),
|
||||||
desc->pConstants,
|
desc->pConstants);
|
||||||
this->libraryExportRequired,
|
|
||||||
this->globalExportRequired);
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -752,21 +680,14 @@ void ModuleImp::createBuildOptions(const char *pBuildFlags, std::string &apiOpti
|
|||||||
moveBuildOption(apiOptions, apiOptions, NEO::CompilerOptions::optDisable, BuildOptions::optDisable);
|
moveBuildOption(apiOptions, apiOptions, NEO::CompilerOptions::optDisable, BuildOptions::optDisable);
|
||||||
moveBuildOption(internalBuildOptions, apiOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired, BuildOptions::greaterThan4GbRequired);
|
moveBuildOption(internalBuildOptions, apiOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired, BuildOptions::greaterThan4GbRequired);
|
||||||
moveBuildOption(internalBuildOptions, apiOptions, NEO::CompilerOptions::allowZebin, NEO::CompilerOptions::allowZebin);
|
moveBuildOption(internalBuildOptions, apiOptions, NEO::CompilerOptions::allowZebin, NEO::CompilerOptions::allowZebin);
|
||||||
|
|
||||||
moveOptLevelOption(apiOptions, apiOptions);
|
moveOptLevelOption(apiOptions, apiOptions);
|
||||||
moveProfileFlagsOption(apiOptions, apiOptions);
|
moveProfileFlagsOption(apiOptions, apiOptions);
|
||||||
this->libraryExportRequired = moveBuildOption(apiOptions, apiOptions, BuildOptions::enableLibraryCompile, BuildOptions::enableLibraryCompile);
|
|
||||||
this->globalExportRequired = moveBuildOption(apiOptions, apiOptions, BuildOptions::enableGlobalVariableSymbols, BuildOptions::enableGlobalVariableSymbols);
|
|
||||||
createBuildExtraOptions(apiOptions, internalBuildOptions);
|
createBuildExtraOptions(apiOptions, internalBuildOptions);
|
||||||
}
|
}
|
||||||
if (NEO::ApiSpecificConfig::getBindlessConfiguration()) {
|
if (NEO::ApiSpecificConfig::getBindlessConfiguration()) {
|
||||||
NEO::CompilerOptions::concatenateAppend(internalBuildOptions, NEO::CompilerOptions::bindlessMode.str());
|
NEO::CompilerOptions::concatenateAppend(internalBuildOptions, NEO::CompilerOptions::bindlessMode.str());
|
||||||
}
|
}
|
||||||
if (!this->libraryExportRequired && NEO::DebugManager.flags.EnableProgramSymbolTableGeneration.get()) {
|
|
||||||
NEO::CompilerOptions::concatenateAppend(apiOptions, BuildOptions::enableLibraryCompile.str());
|
|
||||||
}
|
|
||||||
if (!this->globalExportRequired && NEO::DebugManager.flags.EnableGlobalSymbolGeneration.get()) {
|
|
||||||
NEO::CompilerOptions::concatenateAppend(apiOptions, BuildOptions::enableGlobalVariableSymbols.str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModuleImp::moveOptLevelOption(std::string &dstOptionsSet, std::string &srcOptionSet) {
|
bool ModuleImp::moveOptLevelOption(std::string &dstOptionsSet, std::string &srcOptionSet) {
|
||||||
|
|||||||
@@ -33,24 +33,21 @@ extern NEO::ConstStringRef greaterThan4GbRequired;
|
|||||||
extern NEO::ConstStringRef hasBufferOffsetArg;
|
extern NEO::ConstStringRef hasBufferOffsetArg;
|
||||||
extern NEO::ConstStringRef debugKernelEnable;
|
extern NEO::ConstStringRef debugKernelEnable;
|
||||||
extern NEO::ConstStringRef profileFlags;
|
extern NEO::ConstStringRef profileFlags;
|
||||||
extern NEO::ConstStringRef enableLibraryCompile;
|
|
||||||
extern NEO::ConstStringRef enableGlobalVariableSymbols;
|
|
||||||
} // namespace BuildOptions
|
} // namespace BuildOptions
|
||||||
|
|
||||||
struct ModuleTranslationUnit {
|
struct ModuleTranslationUnit {
|
||||||
ModuleTranslationUnit(L0::Device *device);
|
ModuleTranslationUnit(L0::Device *device);
|
||||||
virtual ~ModuleTranslationUnit();
|
virtual ~ModuleTranslationUnit();
|
||||||
MOCKABLE_VIRTUAL bool buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions,
|
MOCKABLE_VIRTUAL bool buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions,
|
||||||
const ze_module_constants_t *pConstants, bool libraryExportRequired, bool globalExportRequired);
|
const ze_module_constants_t *pConstants);
|
||||||
MOCKABLE_VIRTUAL bool staticLinkSpirV(std::vector<const char *> inputSpirVs, std::vector<uint32_t> inputModuleSizes, const char *buildOptions, const char *internalBuildOptions,
|
MOCKABLE_VIRTUAL bool staticLinkSpirV(std::vector<const char *> inputSpirVs, std::vector<uint32_t> inputModuleSizes, const char *buildOptions, const char *internalBuildOptions,
|
||||||
std::vector<const ze_module_constants_t *> specConstants, bool libraryExportRequired, bool globalExportRequired);
|
std::vector<const ze_module_constants_t *> specConstants);
|
||||||
MOCKABLE_VIRTUAL bool createFromNativeBinary(const char *input, size_t inputSize, bool libraryExportRequired, bool globalExportRequired);
|
MOCKABLE_VIRTUAL bool createFromNativeBinary(const char *input, size_t inputSize);
|
||||||
MOCKABLE_VIRTUAL bool processUnpackedBinary();
|
MOCKABLE_VIRTUAL bool processUnpackedBinary();
|
||||||
std::vector<uint8_t> generateElfFromSpirV(std::vector<const char *> inputSpirVs, std::vector<uint32_t> inputModuleSizes);
|
std::vector<uint8_t> generateElfFromSpirV(std::vector<const char *> inputSpirVs, std::vector<uint32_t> inputModuleSizes);
|
||||||
bool processSpecConstantInfo(NEO::CompilerInterface *compilerInterface, const ze_module_constants_t *pConstants, const char *input, uint32_t inputSize);
|
bool processSpecConstantInfo(NEO::CompilerInterface *compilerInterface, const ze_module_constants_t *pConstants, const char *input, uint32_t inputSize);
|
||||||
std::string generateCompilerOptions(const char *buildOptions, const char *internalBuildOptions);
|
std::string generateCompilerOptions(const char *buildOptions, const char *internalBuildOptions);
|
||||||
MOCKABLE_VIRTUAL bool compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink);
|
MOCKABLE_VIRTUAL bool compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink);
|
||||||
MOCKABLE_VIRTUAL bool attemptGenBinaryCompile(NEO::TranslationInput inputArgs, bool staticLink, bool libraryExportRequired, bool globalExportRequired);
|
|
||||||
void updateBuildLog(const std::string &newLogEntry);
|
void updateBuildLog(const std::string &newLogEntry);
|
||||||
void processDebugData();
|
void processDebugData();
|
||||||
L0::Device *device = nullptr;
|
L0::Device *device = nullptr;
|
||||||
@@ -174,8 +171,6 @@ struct ModuleImp : public Module {
|
|||||||
bool isFullyLinked = false;
|
bool isFullyLinked = false;
|
||||||
bool allocatePrivateMemoryPerDispatch = true;
|
bool allocatePrivateMemoryPerDispatch = true;
|
||||||
bool isZebinBinary = false;
|
bool isZebinBinary = false;
|
||||||
bool libraryExportRequired = false;
|
|
||||||
bool globalExportRequired = false;
|
|
||||||
ModuleType type;
|
ModuleType type;
|
||||||
NEO::Linker::UnresolvedExternals unresolvedExternalsInfo{};
|
NEO::Linker::UnresolvedExternals unresolvedExternalsInfo{};
|
||||||
std::set<NEO::GraphicsAllocation *> importedSymbolAllocations{};
|
std::set<NEO::GraphicsAllocation *> importedSymbolAllocations{};
|
||||||
|
|||||||
@@ -66,36 +66,12 @@ struct MockModuleTranslationUnit : public L0::ModuleTranslationUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink) override {
|
bool compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink) override {
|
||||||
if (failGenCompile || failGenCompileCounter > 0) {
|
|
||||||
failGenCompileCounter = failGenCompileCounter - 1;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (unpackedDeviceBinarySize && unpackedDeviceBinary) {
|
if (unpackedDeviceBinarySize && unpackedDeviceBinary) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return ModuleTranslationUnit::compileGenBinary(inputArgs, staticLink);
|
return ModuleTranslationUnit::compileGenBinary(inputArgs, staticLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool attemptGenBinaryCompile(NEO::TranslationInput inputArgs, bool staticLink, bool libraryExportRequired, bool globalExportRequired) override {
|
|
||||||
bool libraryExport = libraryExportRequired;
|
|
||||||
bool globalExport = globalExportRequired;
|
|
||||||
if (requireGlobalExport) {
|
|
||||||
globalExport = true;
|
|
||||||
}
|
|
||||||
if (requireLibraryExport) {
|
|
||||||
libraryExport = true;
|
|
||||||
}
|
|
||||||
if (unpackedDeviceBinarySize && unpackedDeviceBinary) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return ModuleTranslationUnit::attemptGenBinaryCompile(inputArgs, staticLink, libraryExport, globalExport);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bool failGenCompile = false;
|
|
||||||
bool requireGlobalExport = false;
|
|
||||||
bool requireLibraryExport = false;
|
|
||||||
int failGenCompileCounter = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MockModule : public L0::ModuleImp {
|
struct MockModule : public L0::ModuleImp {
|
||||||
|
|||||||
@@ -1006,244 +1006,6 @@ TEST_F(ModuleStaticLinkTests, givenSingleModuleProvidedForSpirVStaticLinkAndBuil
|
|||||||
runSprivLinkBuildWithOneModule();
|
runSprivLinkBuildWithOneModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
using ModuleOptionsTests = Test<DeviceFixture>;
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenFailureDuringGenCompileThenAttemptCompileFails) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->failGenCompile = true;
|
|
||||||
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_FALSE(success);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenValidModuleWithGlobalSymbolFlagThenGenCompileAttemptSucceeds) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableGlobalVariableSymbols.str());
|
|
||||||
mockTranslationUnit->requireGlobalExport = true;
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_TRUE(success);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenModuleWithGlobalSymbolFlagThenGenCompileAttemptSucceedsAfterGlobalFlagRemoved) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableGlobalVariableSymbols.str());
|
|
||||||
mockTranslationUnit->requireGlobalExport = false;
|
|
||||||
mockTranslationUnit->failGenCompileCounter = 1;
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_TRUE(success);
|
|
||||||
|
|
||||||
size_t optionPos = std::string::npos;
|
|
||||||
optionPos = mockTranslationUnit->options.find(BuildOptions::enableGlobalVariableSymbols.str().c_str());
|
|
||||||
EXPECT_EQ(optionPos, std::string::npos);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenModuleWithGlobalSymbolFlagRequiredThenGenCompileAttemptFails) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableGlobalVariableSymbols.str());
|
|
||||||
mockTranslationUnit->requireGlobalExport = true;
|
|
||||||
mockTranslationUnit->failGenCompile = true;
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_FALSE(success);
|
|
||||||
|
|
||||||
size_t optionPos = std::string::npos;
|
|
||||||
optionPos = mockTranslationUnit->options.find(BuildOptions::enableGlobalVariableSymbols.str().c_str());
|
|
||||||
EXPECT_NE(optionPos, std::string::npos);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenValidModuleWithLibrarySymbolFlagThenGenCompileAttemptSucceeds) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableLibraryCompile.str());
|
|
||||||
mockTranslationUnit->requireLibraryExport = true;
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_TRUE(success);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenModuleWithLibrarySymbolFlagThenGenCompileAttemptSucceedsAfterLibraryFlagRemoved) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableLibraryCompile.str().c_str());
|
|
||||||
mockTranslationUnit->requireLibraryExport = false;
|
|
||||||
mockTranslationUnit->failGenCompileCounter = 2;
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_TRUE(success);
|
|
||||||
|
|
||||||
size_t optionPos = std::string::npos;
|
|
||||||
optionPos = mockTranslationUnit->options.find(BuildOptions::enableLibraryCompile.str().c_str());
|
|
||||||
EXPECT_EQ(optionPos, std::string::npos);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenModuleWithLibrarySymbolFlagRequiredThenGenCompileAttemptFailsInRetry) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableLibraryCompile.str());
|
|
||||||
mockTranslationUnit->requireLibraryExport = true;
|
|
||||||
mockTranslationUnit->failGenCompileCounter = 3;
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_FALSE(success);
|
|
||||||
|
|
||||||
size_t optionPos = std::string::npos;
|
|
||||||
optionPos = mockTranslationUnit->options.find(BuildOptions::enableLibraryCompile.str().c_str());
|
|
||||||
EXPECT_NE(optionPos, std::string::npos);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenModuleWithLibraryAndGlobalSymbolFlagsRequiredThenGenCompileAttemptFailsInRetry) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableLibraryCompile.str());
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableGlobalVariableSymbols.str());
|
|
||||||
mockTranslationUnit->requireGlobalExport = true;
|
|
||||||
mockTranslationUnit->requireLibraryExport = true;
|
|
||||||
mockTranslationUnit->failGenCompile = true;
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_FALSE(success);
|
|
||||||
|
|
||||||
size_t optionPos = std::string::npos;
|
|
||||||
optionPos = mockTranslationUnit->options.find(BuildOptions::enableLibraryCompile.str().c_str());
|
|
||||||
EXPECT_NE(optionPos, std::string::npos);
|
|
||||||
optionPos = mockTranslationUnit->options.find(BuildOptions::enableGlobalVariableSymbols.str().c_str());
|
|
||||||
EXPECT_NE(optionPos, std::string::npos);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(ModuleOptionsTests, givenModuleWithLibraryAndGlobalSymbolFlagsAndGenCompileFailsInAllSingleRemovalThenGenCompileAttemptSuccedsInRetry) {
|
|
||||||
auto mockCompiler = new MockCompilerInterface();
|
|
||||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
|
||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
|
|
||||||
|
|
||||||
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableLibraryCompile.str());
|
|
||||||
mockTranslationUnit->options.append(BuildOptions::enableGlobalVariableSymbols.str());
|
|
||||||
mockTranslationUnit->requireGlobalExport = false;
|
|
||||||
mockTranslationUnit->requireLibraryExport = false;
|
|
||||||
mockTranslationUnit->failGenCompileCounter = 3;
|
|
||||||
uint8_t spirvData{};
|
|
||||||
|
|
||||||
ze_module_desc_t moduleDesc = {};
|
|
||||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
|
||||||
moduleDesc.pInputModule = &spirvData;
|
|
||||||
moduleDesc.inputSize = sizeof(spirvData);
|
|
||||||
|
|
||||||
Module module(device, nullptr, ModuleType::User);
|
|
||||||
module.translationUnit.reset(mockTranslationUnit);
|
|
||||||
|
|
||||||
bool success = module.initialize(&moduleDesc, neoDevice);
|
|
||||||
EXPECT_TRUE(success);
|
|
||||||
|
|
||||||
size_t optionPos = std::string::npos;
|
|
||||||
optionPos = mockTranslationUnit->options.find(BuildOptions::enableLibraryCompile.str().c_str());
|
|
||||||
EXPECT_EQ(optionPos, std::string::npos);
|
|
||||||
optionPos = mockTranslationUnit->options.find(BuildOptions::enableGlobalVariableSymbols.str().c_str());
|
|
||||||
EXPECT_EQ(optionPos, std::string::npos);
|
|
||||||
}
|
|
||||||
|
|
||||||
using ModuleLinkingTest = Test<DeviceFixture>;
|
using ModuleLinkingTest = Test<DeviceFixture>;
|
||||||
|
|
||||||
HWTEST_F(ModuleLinkingTest, whenExternFunctionsAllocationIsPresentThenItsBeingAddedToResidencyContainer) {
|
HWTEST_F(ModuleLinkingTest, whenExternFunctionsAllocationIsPresentThenItsBeingAddedToResidencyContainer) {
|
||||||
@@ -2197,14 +1959,14 @@ struct MockModuleTU : public L0::ModuleTranslationUnit {
|
|||||||
MockModuleTU(L0::Device *device) : L0::ModuleTranslationUnit(device) {}
|
MockModuleTU(L0::Device *device) : L0::ModuleTranslationUnit(device) {}
|
||||||
|
|
||||||
bool buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions,
|
bool buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions,
|
||||||
const ze_module_constants_t *pConstants, bool libraryExportRequired, bool globalExportRequired) override {
|
const ze_module_constants_t *pConstants) override {
|
||||||
wasBuildFromSpirVCalled = true;
|
wasBuildFromSpirVCalled = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool createFromNativeBinary(const char *input, size_t inputSize, bool libraryExportRequired, bool globalExportRequired) override {
|
bool createFromNativeBinary(const char *input, size_t inputSize) override {
|
||||||
wasCreateFromNativeBinaryCalled = true;
|
wasCreateFromNativeBinaryCalled = true;
|
||||||
return L0::ModuleTranslationUnit::createFromNativeBinary(input, inputSize, libraryExportRequired, globalExportRequired);
|
return L0::ModuleTranslationUnit::createFromNativeBinary(input, inputSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wasBuildFromSpirVCalled = false;
|
bool wasBuildFromSpirVCalled = false;
|
||||||
@@ -2332,13 +2094,13 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpRequir
|
|||||||
|
|
||||||
emptyProgram.elfHeader->machine = copyHwInfo.platform.eProductFamily;
|
emptyProgram.elfHeader->machine = copyHwInfo.platform.eProductFamily;
|
||||||
L0::ModuleTranslationUnit moduleTuValid(this->device);
|
L0::ModuleTranslationUnit moduleTuValid(this->device);
|
||||||
bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(emptyProgram.storage.data()), emptyProgram.storage.size(), false, false);
|
bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(emptyProgram.storage.data()), emptyProgram.storage.size());
|
||||||
EXPECT_TRUE(success);
|
EXPECT_TRUE(success);
|
||||||
|
|
||||||
emptyProgram.elfHeader->machine = copyHwInfo.platform.eProductFamily;
|
emptyProgram.elfHeader->machine = copyHwInfo.platform.eProductFamily;
|
||||||
++emptyProgram.elfHeader->machine;
|
++emptyProgram.elfHeader->machine;
|
||||||
L0::ModuleTranslationUnit moduleTuInvalid(this->device);
|
L0::ModuleTranslationUnit moduleTuInvalid(this->device);
|
||||||
success = moduleTuInvalid.createFromNativeBinary(reinterpret_cast<const char *>(emptyProgram.storage.data()), emptyProgram.storage.size(), false, false);
|
success = moduleTuInvalid.createFromNativeBinary(reinterpret_cast<const char *>(emptyProgram.storage.data()), emptyProgram.storage.size());
|
||||||
EXPECT_FALSE(success);
|
EXPECT_FALSE(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2368,7 +2130,7 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPacked
|
|||||||
|
|
||||||
auto arData = encoder.encode();
|
auto arData = encoder.encode();
|
||||||
L0::ModuleTranslationUnit moduleTuValid(this->device);
|
L0::ModuleTranslationUnit moduleTuValid(this->device);
|
||||||
bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(arData.data()), arData.size(), false, false);
|
bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(arData.data()), arData.size());
|
||||||
EXPECT_TRUE(success);
|
EXPECT_TRUE(success);
|
||||||
EXPECT_NE(moduleTuValid.packedDeviceBinarySize, arData.size());
|
EXPECT_NE(moduleTuValid.packedDeviceBinarySize, arData.size());
|
||||||
}
|
}
|
||||||
@@ -2381,7 +2143,7 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromZebinThenAppendAllowZebinFla
|
|||||||
|
|
||||||
zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily;
|
zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily;
|
||||||
L0::ModuleTranslationUnit moduleTu(this->device);
|
L0::ModuleTranslationUnit moduleTu(this->device);
|
||||||
bool success = moduleTu.createFromNativeBinary(reinterpret_cast<const char *>(zebin.storage.data()), zebin.storage.size(), false, false);
|
bool success = moduleTu.createFromNativeBinary(reinterpret_cast<const char *>(zebin.storage.data()), zebin.storage.size());
|
||||||
EXPECT_TRUE(success);
|
EXPECT_TRUE(success);
|
||||||
|
|
||||||
auto expectedOptions = " " + NEO::CompilerOptions::allowZebin.str();
|
auto expectedOptions = " " + NEO::CompilerOptions::allowZebin.str();
|
||||||
@@ -2410,7 +2172,7 @@ kernels:
|
|||||||
zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily;
|
zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily;
|
||||||
|
|
||||||
L0::ModuleTranslationUnit moduleTuValid(this->device);
|
L0::ModuleTranslationUnit moduleTuValid(this->device);
|
||||||
bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(zebin.storage.data()), zebin.storage.size(), false, false);
|
bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(zebin.storage.data()), zebin.storage.size());
|
||||||
EXPECT_TRUE(success);
|
EXPECT_TRUE(success);
|
||||||
|
|
||||||
EXPECT_NE(nullptr, moduleTuValid.programInfo.linkerInput.get());
|
EXPECT_NE(nullptr, moduleTuValid.programInfo.linkerInput.get());
|
||||||
@@ -2469,7 +2231,7 @@ HWTEST_F(ModuleTranslationUnitTest, WhenBuildOptionsAreNullThenReuseExistingOpti
|
|||||||
moduleTu.options = "abcd";
|
moduleTu.options = "abcd";
|
||||||
pMockCompilerInterface->failBuild = true;
|
pMockCompilerInterface->failBuild = true;
|
||||||
|
|
||||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr, false, false);
|
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||||
EXPECT_FALSE(ret);
|
EXPECT_FALSE(ret);
|
||||||
EXPECT_STREQ("abcd", moduleTu.options.c_str());
|
EXPECT_STREQ("abcd", moduleTu.options.c_str());
|
||||||
EXPECT_STREQ("abcd", pMockCompilerInterface->receivedApiOptions.c_str());
|
EXPECT_STREQ("abcd", pMockCompilerInterface->receivedApiOptions.c_str());
|
||||||
@@ -2484,7 +2246,7 @@ HWTEST_F(ModuleTranslationUnitTest, WhenBuildOptionsAreNullThenReuseExistingOpti
|
|||||||
DebugManager.flags.DisableStatelessToStatefulOptimization.set(1);
|
DebugManager.flags.DisableStatelessToStatefulOptimization.set(1);
|
||||||
|
|
||||||
MockModuleTranslationUnit moduleTu(this->device);
|
MockModuleTranslationUnit moduleTu(this->device);
|
||||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr, false, false);
|
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("cl-intel-greater-than-4GB-buffer-required"), std::string::npos);
|
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("cl-intel-greater-than-4GB-buffer-required"), std::string::npos);
|
||||||
}
|
}
|
||||||
@@ -2494,7 +2256,7 @@ HWTEST_F(ModuleTranslationUnitTest, givenInternalOptionsThenLSCCachePolicyIsSet)
|
|||||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||||
MockModuleTranslationUnit moduleTu(this->device);
|
MockModuleTranslationUnit moduleTu(this->device);
|
||||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr, false, false);
|
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||||
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions(false);
|
auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions(false);
|
||||||
@@ -2513,7 +2275,7 @@ HWTEST2_F(ModuleTranslationUnitTest, givenDebugFlagSetToWbWhenGetInternalOptions
|
|||||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||||
MockModuleTranslationUnit moduleTu(this->device);
|
MockModuleTranslationUnit moduleTu(this->device);
|
||||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr, false, false);
|
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=7 -cl-load-cache-default=4"), std::string::npos);
|
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=7 -cl-load-cache-default=4"), std::string::npos);
|
||||||
}
|
}
|
||||||
@@ -2526,7 +2288,7 @@ HWTEST2_F(ModuleTranslationUnitTest, givenDebugFlagSetForceAllResourcesUncachedW
|
|||||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||||
MockModuleTranslationUnit moduleTu(this->device);
|
MockModuleTranslationUnit moduleTu(this->device);
|
||||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr, false, false);
|
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=1 -cl-load-cache-default=1"), std::string::npos);
|
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=1 -cl-load-cache-default=1"), std::string::npos);
|
||||||
}
|
}
|
||||||
@@ -2536,7 +2298,7 @@ HWTEST2_F(ModuleTranslationUnitTest, givenAtLeastXeHpgCoreWhenGetInternalOptions
|
|||||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||||
MockModuleTranslationUnit moduleTu(this->device);
|
MockModuleTranslationUnit moduleTu(this->device);
|
||||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr, false, false);
|
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=2 -cl-load-cache-default=4"), std::string::npos);
|
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=2 -cl-load-cache-default=4"), std::string::npos);
|
||||||
}
|
}
|
||||||
@@ -2547,7 +2309,7 @@ HWTEST_F(ModuleTranslationUnitTest, givenForceToStatelessRequiredWhenBuildingMod
|
|||||||
rootDeviceEnvironment->compilerInterface.reset(mockCompilerInterface);
|
rootDeviceEnvironment->compilerInterface.reset(mockCompilerInterface);
|
||||||
|
|
||||||
MockModuleTranslationUnit moduleTu(device);
|
MockModuleTranslationUnit moduleTu(device);
|
||||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr, false, false);
|
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||||
@@ -2646,117 +2408,6 @@ TEST(BuildOptions, givenSrcOptionNameInSrcNamesWhenMovingBuildOptionsThenOptionI
|
|||||||
EXPECT_EQ(std::string::npos, srcNames.find(NEO::CompilerOptions::optDisable.str()));
|
EXPECT_EQ(std::string::npos, srcNames.find(NEO::CompilerOptions::optDisable.str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ModuleTest, givenBuildOptionsWhenEnableProgramSymbolTableGenerationIsEnabledThenEnableLibraryCompileIsSet) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
DebugManager.flags.EnableProgramSymbolTableGeneration.set(1);
|
|
||||||
auto module = std::make_unique<ModuleImp>(device, nullptr, ModuleType::User);
|
|
||||||
ASSERT_NE(nullptr, module);
|
|
||||||
|
|
||||||
std::string buildOptions;
|
|
||||||
std::string internalBuildOptions;
|
|
||||||
|
|
||||||
module->createBuildOptions("", buildOptions, internalBuildOptions);
|
|
||||||
|
|
||||||
EXPECT_TRUE(NEO::CompilerOptions::contains(buildOptions, BuildOptions::enableLibraryCompile));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ModuleTest, givenBuildOptionsWhenEnableProgramSymbolTableGenerationIsDisabledThenEnableLibraryCompileIsNotSet) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
DebugManager.flags.EnableProgramSymbolTableGeneration.set(0);
|
|
||||||
auto module = std::make_unique<ModuleImp>(device, nullptr, ModuleType::User);
|
|
||||||
ASSERT_NE(nullptr, module);
|
|
||||||
|
|
||||||
std::string buildOptions;
|
|
||||||
std::string internalBuildOptions;
|
|
||||||
|
|
||||||
module->createBuildOptions("", buildOptions, internalBuildOptions);
|
|
||||||
|
|
||||||
EXPECT_FALSE(NEO::CompilerOptions::contains(buildOptions, BuildOptions::enableLibraryCompile));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ModuleTest, givenBuildOptionsWithEnableLibraryCompileWhenEnableProgramSymbolTableGenerationIsDisabledThenEnableLibraryCompileIsSet) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
DebugManager.flags.EnableProgramSymbolTableGeneration.set(0);
|
|
||||||
auto module = std::make_unique<ModuleImp>(device, nullptr, ModuleType::User);
|
|
||||||
ASSERT_NE(nullptr, module);
|
|
||||||
|
|
||||||
std::string buildOptions;
|
|
||||||
std::string internalBuildOptions;
|
|
||||||
|
|
||||||
module->createBuildOptions(BuildOptions::enableLibraryCompile.str().c_str(), buildOptions, internalBuildOptions);
|
|
||||||
|
|
||||||
EXPECT_TRUE(NEO::CompilerOptions::contains(buildOptions, BuildOptions::enableLibraryCompile));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ModuleTest, givenBuildOptionsWithEnableLibraryCompileWhenEnableProgramSymbolTableGenerationIsEnabledThenEnableLibraryCompileIsSet) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
DebugManager.flags.EnableProgramSymbolTableGeneration.set(1);
|
|
||||||
auto module = std::make_unique<ModuleImp>(device, nullptr, ModuleType::User);
|
|
||||||
ASSERT_NE(nullptr, module);
|
|
||||||
|
|
||||||
std::string buildOptions;
|
|
||||||
std::string internalBuildOptions;
|
|
||||||
|
|
||||||
module->createBuildOptions(BuildOptions::enableLibraryCompile.str().c_str(), buildOptions, internalBuildOptions);
|
|
||||||
|
|
||||||
EXPECT_TRUE(NEO::CompilerOptions::contains(buildOptions, BuildOptions::enableLibraryCompile));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ModuleTest, givenBuildOptionsWhenEnableGlobalSymbolGenerationIsEnabledThenEnableGlobalVariableSymbolsIsSet) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
DebugManager.flags.EnableGlobalSymbolGeneration.set(1);
|
|
||||||
auto module = std::make_unique<ModuleImp>(device, nullptr, ModuleType::User);
|
|
||||||
ASSERT_NE(nullptr, module);
|
|
||||||
|
|
||||||
std::string buildOptions;
|
|
||||||
std::string internalBuildOptions;
|
|
||||||
|
|
||||||
module->createBuildOptions("", buildOptions, internalBuildOptions);
|
|
||||||
|
|
||||||
EXPECT_TRUE(NEO::CompilerOptions::contains(buildOptions, BuildOptions::enableGlobalVariableSymbols));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ModuleTest, givenBuildOptionsWhenEnableGlobalSymbolGenerationIsDisabledThenEnableGlobalVariableSymbolsIsNotSet) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
DebugManager.flags.EnableGlobalSymbolGeneration.set(0);
|
|
||||||
auto module = std::make_unique<ModuleImp>(device, nullptr, ModuleType::User);
|
|
||||||
ASSERT_NE(nullptr, module);
|
|
||||||
|
|
||||||
std::string buildOptions;
|
|
||||||
std::string internalBuildOptions;
|
|
||||||
|
|
||||||
module->createBuildOptions("", buildOptions, internalBuildOptions);
|
|
||||||
|
|
||||||
EXPECT_FALSE(NEO::CompilerOptions::contains(buildOptions, BuildOptions::enableGlobalVariableSymbols));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ModuleTest, givenBuildOptionsWithEnableGlobalVariableSymbolsWhenEnableGlobalSymbolGenerationIsDisabledThenEnableGlobalVariableSymbolsIsSet) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
DebugManager.flags.EnableGlobalSymbolGeneration.set(0);
|
|
||||||
auto module = std::make_unique<ModuleImp>(device, nullptr, ModuleType::User);
|
|
||||||
ASSERT_NE(nullptr, module);
|
|
||||||
|
|
||||||
std::string buildOptions;
|
|
||||||
std::string internalBuildOptions;
|
|
||||||
|
|
||||||
module->createBuildOptions(BuildOptions::enableGlobalVariableSymbols.str().c_str(), buildOptions, internalBuildOptions);
|
|
||||||
|
|
||||||
EXPECT_TRUE(NEO::CompilerOptions::contains(buildOptions, BuildOptions::enableGlobalVariableSymbols));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ModuleTest, givenBuildOptionsWithEnableGlobalVariableSymbolsWhenEnableGlobalSymbolGenerationIsEnabledThenEnableGlobalVariableSymbolsIsSet) {
|
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
DebugManager.flags.EnableGlobalSymbolGeneration.set(1);
|
|
||||||
auto module = std::make_unique<ModuleImp>(device, nullptr, ModuleType::User);
|
|
||||||
ASSERT_NE(nullptr, module);
|
|
||||||
|
|
||||||
std::string buildOptions;
|
|
||||||
std::string internalBuildOptions;
|
|
||||||
|
|
||||||
module->createBuildOptions(BuildOptions::enableGlobalVariableSymbols.str().c_str(), buildOptions, internalBuildOptions);
|
|
||||||
|
|
||||||
EXPECT_TRUE(NEO::CompilerOptions::contains(buildOptions, BuildOptions::enableGlobalVariableSymbols));
|
|
||||||
}
|
|
||||||
TEST_F(ModuleTest, givenInternalOptionsWhenBindlessEnabledThenBindlesOptionsPassed) {
|
TEST_F(ModuleTest, givenInternalOptionsWhenBindlessEnabledThenBindlesOptionsPassed) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
DebugManager.flags.UseBindlessMode.set(1);
|
DebugManager.flags.UseBindlessMode.set(1);
|
||||||
@@ -2972,7 +2623,7 @@ TEST_F(ModuleInitializeTest, whenModuleInitializeIsCalledThenCorrectResultIsRetu
|
|||||||
class MyMockModuleTU : public MockModuleTU {
|
class MyMockModuleTU : public MockModuleTU {
|
||||||
public:
|
public:
|
||||||
using MockModuleTU::MockModuleTU;
|
using MockModuleTU::MockModuleTU;
|
||||||
bool createFromNativeBinary(const char *input, size_t inputSize, bool libraryExportRequired, bool globalExportRequired) override { return true; }
|
bool createFromNativeBinary(const char *input, size_t inputSize) override { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ HWTEST2_F(KernelPropertyTest, givenDG2WhenGetInternalOptionsThenWriteByPassBuild
|
|||||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||||
MockModuleTranslationUnit moduleTu(this->device);
|
MockModuleTranslationUnit moduleTu(this->device);
|
||||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr, false, false);
|
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=2 -cl-load-cache-default=4"), std::string::npos);
|
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=2 -cl-load-cache-default=4"), std::string::npos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,8 +338,6 @@ DECLARE_DEBUG_VARIABLE(bool, ForceSamplerLowFilteringPrecision, false, "Force Lo
|
|||||||
DECLARE_DEBUG_VARIABLE(bool, EngineInstancedSubDevices, false, "Create subdevices assigned to specific engine")
|
DECLARE_DEBUG_VARIABLE(bool, EngineInstancedSubDevices, false, "Create subdevices assigned to specific engine")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, AllowSingleTileEngineInstancedSubDevices, false, "Create subdevices assigned to specific engine on single tile config")
|
DECLARE_DEBUG_VARIABLE(bool, AllowSingleTileEngineInstancedSubDevices, false, "Create subdevices assigned to specific engine on single tile config")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, EnablePrivateBO, false, "Enable PRELIM_I915_GEM_CREATE_EXT_VM_PRIVATE extension creating VM_PRIVATE BOs")
|
DECLARE_DEBUG_VARIABLE(bool, EnablePrivateBO, false, "Enable PRELIM_I915_GEM_CREATE_EXT_VM_PRIVATE extension creating VM_PRIVATE BOs")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, EnableProgramSymbolTableGeneration, true, "Enforce IGC to always generate the Program Symbol Table for Exported Functions for all Modules used by Level Zero.")
|
|
||||||
DECLARE_DEBUG_VARIABLE(bool, EnableGlobalSymbolGeneration, true, "Enforce IGC to always generate the Symbol Table Entry for Global Variables for all Modules used by Level Zero")
|
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, ReturnSubDevicesAsApiDevices, -1, "Expose each subdevice as a separate device during clGetDeviceIDs or zeDeviceGet API call")
|
DECLARE_DEBUG_VARIABLE(int32_t, ReturnSubDevicesAsApiDevices, -1, "Expose each subdevice as a separate device during clGetDeviceIDs or zeDeviceGet API call")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceRunAloneContext, -1, "Control creation of run-alone HW context, -1:default, 0:disable, 1:enable")
|
DECLARE_DEBUG_VARIABLE(int32_t, ForceRunAloneContext, -1, "Control creation of run-alone HW context, -1:default, 0:disable, 1:enable")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, AddClGlSharing, -1, "Add cl-gl extension")
|
DECLARE_DEBUG_VARIABLE(int32_t, AddClGlSharing, -1, "Add cl-gl extension")
|
||||||
|
|||||||
@@ -353,9 +353,7 @@ AllowPatchingVfeStateInCommandLists = 0
|
|||||||
PrintMemoryRegionSizes = 0
|
PrintMemoryRegionSizes = 0
|
||||||
OverrideDrmRegion = -1
|
OverrideDrmRegion = -1
|
||||||
AllowSingleTileEngineInstancedSubDevices = 0
|
AllowSingleTileEngineInstancedSubDevices = 0
|
||||||
EnableProgramSymbolTableGeneration = 1
|
|
||||||
BinaryCacheTrace = false
|
BinaryCacheTrace = false
|
||||||
EnableGlobalSymbolGeneration = 1
|
|
||||||
OverrideL1CacheControlInSurfaceState = -1
|
OverrideL1CacheControlInSurfaceState = -1
|
||||||
OverrideL1CacheControlInSurfaceStateForScratchSpace = -1
|
OverrideL1CacheControlInSurfaceStateForScratchSpace = -1
|
||||||
OverridePreferredSlmAllocationSizePerDss = -1
|
OverridePreferredSlmAllocationSizePerDss = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user