mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Enable Global Symbol Generation by Default for L0 modules
Signed-off-by: Neil R Spruit <neil.r.spruit@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e8e1abf5e0
commit
9996228281
@@ -50,6 +50,7 @@ NEO::ConstStringRef greaterThan4GbRequired = "-ze-opt-greater-than-4GB-buffer-re
|
||||
NEO::ConstStringRef hasBufferOffsetArg = "-ze-intel-has-buffer-offset-arg";
|
||||
NEO::ConstStringRef debugKernelEnable = "-ze-kernel-debug-enable";
|
||||
NEO::ConstStringRef enableLibraryCompile = "-library-compilation";
|
||||
NEO::ConstStringRef enableGlobalVariableSymbols = "-take-global-address";
|
||||
} // namespace BuildOptions
|
||||
|
||||
ModuleTranslationUnit::ModuleTranslationUnit(L0::Device *device)
|
||||
@@ -667,7 +668,7 @@ void ModuleImp::createBuildOptions(const char *pBuildFlags, std::string &apiOpti
|
||||
moveBuildOption(internalBuildOptions, apiOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired, BuildOptions::greaterThan4GbRequired);
|
||||
moveBuildOption(internalBuildOptions, apiOptions, NEO::CompilerOptions::allowZebin, NEO::CompilerOptions::allowZebin);
|
||||
this->libraryExportEnabled = moveBuildOption(apiOptions, apiOptions, BuildOptions::enableLibraryCompile, BuildOptions::enableLibraryCompile);
|
||||
|
||||
this->globalExportEnabled = moveBuildOption(apiOptions, apiOptions, BuildOptions::enableGlobalVariableSymbols, BuildOptions::enableGlobalVariableSymbols);
|
||||
createBuildExtraOptions(apiOptions, internalBuildOptions);
|
||||
}
|
||||
if (NEO::ApiSpecificConfig::getBindlessConfiguration()) {
|
||||
@@ -676,6 +677,9 @@ void ModuleImp::createBuildOptions(const char *pBuildFlags, std::string &apiOpti
|
||||
if (!this->libraryExportEnabled && NEO::DebugManager.flags.EnableProgramSymbolTableGeneration.get()) {
|
||||
NEO::CompilerOptions::concatenateAppend(apiOptions, BuildOptions::enableLibraryCompile.str());
|
||||
}
|
||||
if (!this->globalExportEnabled && NEO::DebugManager.flags.EnableGlobalSymbolGeneration.get()) {
|
||||
NEO::CompilerOptions::concatenateAppend(apiOptions, BuildOptions::enableGlobalVariableSymbols.str());
|
||||
}
|
||||
}
|
||||
|
||||
void ModuleImp::updateBuildLog(NEO::Device *neoDevice) {
|
||||
|
||||
@@ -31,6 +31,7 @@ extern NEO::ConstStringRef greaterThan4GbRequired;
|
||||
extern NEO::ConstStringRef hasBufferOffsetArg;
|
||||
extern NEO::ConstStringRef debugKernelEnable;
|
||||
extern NEO::ConstStringRef enableLibraryCompile;
|
||||
extern NEO::ConstStringRef enableGlobalVariableSymbols;
|
||||
} // namespace BuildOptions
|
||||
|
||||
struct ModuleTranslationUnit {
|
||||
@@ -160,6 +161,7 @@ struct ModuleImp : public Module {
|
||||
bool isFullyLinked = false;
|
||||
bool allocatePrivateMemoryPerDispatch = true;
|
||||
bool libraryExportEnabled = false;
|
||||
bool globalExportEnabled = false;
|
||||
ModuleType type;
|
||||
NEO::Linker::UnresolvedExternals unresolvedExternalsInfo{};
|
||||
std::set<NEO::GraphicsAllocation *> importedSymbolAllocations{};
|
||||
|
||||
@@ -2477,6 +2477,62 @@ TEST_F(ModuleTest, givenBuildOptionsWithEnableLibraryCompileWhenEnableProgramSym
|
||||
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) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
|
||||
Reference in New Issue
Block a user