L0: GRF mode debug flags support

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2022-09-22 13:18:52 +00:00
committed by Compute-Runtime-Automation
parent 3e01915e61
commit b2001bf265
9 changed files with 88 additions and 45 deletions

View File

@@ -743,6 +743,8 @@ void ModuleImp::createBuildOptions(const char *pBuildFlags, std::string &apiOpti
moveBuildOption(internalBuildOptions, apiOptions, NEO::CompilerOptions::allowZebin, NEO::CompilerOptions::allowZebin);
moveBuildOption(internalBuildOptions, apiOptions, NEO::CompilerOptions::largeGrf, BuildOptions::optLargeRegisterFile);
NEO::CompilerOptions::applyAdditionalOptions(internalBuildOptions);
moveOptLevelOption(apiOptions, apiOptions);
moveProfileFlagsOption(apiOptions, apiOptions);
this->libraryExportRequired = moveBuildOption(apiOptions, apiOptions, BuildOptions::enableLibraryCompile, BuildOptions::enableLibraryCompile);

View File

@@ -270,5 +270,61 @@ TEST_F(ModuleOnlineCompiled, GivenKernelThenCorrectAttributesAreReturned) {
free(attributes);
}
TEST_F(ModuleTests, givenLargeGrfFlagSetWhenCreatingModuleThenOverrideInternalFlags) {
DebugManagerStateRestore restorer;
DebugManager.flags.ForceLargeGrfCompilationMode.set(true);
auto pMockCompilerInterface = new MockCompilerInterface;
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
const auto &src = zebinData->storage;
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = src.data();
moduleDesc.inputSize = src.size();
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
Module module(device, nullptr, ModuleType::User);
module.translationUnit.reset(mockTranslationUnit);
bool success = module.initialize(&moduleDesc, neoDevice);
EXPECT_TRUE(success);
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-256-GRF-per-thread"), std::string::npos);
EXPECT_EQ(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-128-GRF-per-thread"), std::string::npos);
}
TEST_F(ModuleTests, givenDefaultGrfFlagSetWhenCreatingModuleThenOverrideInternalFlags) {
DebugManagerStateRestore restorer;
DebugManager.flags.ForceDefaultGrfCompilationMode.set(true);
auto pMockCompilerInterface = new MockCompilerInterface;
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
const auto &src = zebinData->storage;
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = src.data();
moduleDesc.inputSize = src.size();
auto mockTranslationUnit = new MockModuleTranslationUnit(device);
Module module(device, nullptr, ModuleType::User);
module.translationUnit.reset(mockTranslationUnit);
bool success = module.initialize(&moduleDesc, neoDevice);
EXPECT_TRUE(success);
EXPECT_EQ(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-256-GRF-per-thread"), std::string::npos);
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-128-GRF-per-thread"), std::string::npos);
}
} // namespace ult
} // namespace L0