Adjust BuildOptions used in level_zero

Change-Id: I0974127beca07012758d4e57402867754c94d388
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe 2020-09-15 15:39:03 +02:00 committed by sys_ocldev
parent 37c79dede8
commit d0a6b8aece
3 changed files with 14 additions and 5 deletions

View File

@ -32,6 +32,8 @@ namespace L0 {
namespace BuildOptions {
NEO::ConstStringRef optDisable = "-ze-opt-disable";
NEO::ConstStringRef greaterThan4GbRequired = "-ze-opt-greater-than-4GB-buffer-required";
NEO::ConstStringRef hasBufferOffsetArg = "-ze-intel-has-buffer-offset-arg";
NEO::ConstStringRef debugKernelEnable = "-ze-kernel-debug-enable";
} // namespace BuildOptions
ModuleTranslationUnit::ModuleTranslationUnit(L0::Device *device)
@ -67,14 +69,14 @@ bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize
UNRECOVERABLE_IF((nullptr == device) || (nullptr == device->getNEODevice()));
std::string options = buildOptions;
std::string internalOptions = NEO::CompilerOptions::concatenate(internalBuildOptions, NEO::CompilerOptions::hasBufferOffsetArg);
std::string internalOptions = NEO::CompilerOptions::concatenate(internalBuildOptions, BuildOptions::hasBufferOffsetArg);
if (device->getNEODevice()->getDeviceInfo().debuggerActive) {
if (device->getSourceLevelDebugger()->isOptimizationDisabled()) {
NEO::CompilerOptions::concatenateAppend(options, NEO::CompilerOptions::optDisable);
NEO::CompilerOptions::concatenateAppend(options, BuildOptions::optDisable);
}
options = NEO::CompilerOptions::concatenate(options, NEO::CompilerOptions::generateDebugInfo);
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, NEO::CompilerOptions::debugKernelEnable);
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, BuildOptions::debugKernelEnable);
}
NEO::TranslationInput inputArgs = {IGC::CodeType::spirV, IGC::CodeType::oclGenBin};

View File

@ -22,6 +22,13 @@
namespace L0 {
namespace BuildOptions {
extern NEO::ConstStringRef optDisable;
extern NEO::ConstStringRef greaterThan4GbRequired;
extern NEO::ConstStringRef hasBufferOffsetArg;
extern NEO::ConstStringRef debugKernelEnable;
} // namespace BuildOptions
struct ModuleTranslationUnit {
ModuleTranslationUnit(L0::Device *device);
virtual ~ModuleTranslationUnit();

View File

@ -37,9 +37,9 @@ TEST_F(DeviceWithDebuggerEnabledTest, givenDebuggingEnabledWhenModuleIsCreatedTh
ASSERT_NE(nullptr, module.get());
module->initialize(&moduleDesc, device);
EXPECT_TRUE(CompilerOptions::contains(cip->buildInternalOptions, NEO::CompilerOptions::debugKernelEnable));
EXPECT_TRUE(CompilerOptions::contains(cip->buildInternalOptions, L0::BuildOptions::debugKernelEnable));
EXPECT_TRUE(CompilerOptions::contains(cip->buildOptions, NEO::CompilerOptions::generateDebugInfo));
EXPECT_TRUE(CompilerOptions::contains(cip->buildOptions, NEO::CompilerOptions::optDisable));
EXPECT_TRUE(CompilerOptions::contains(cip->buildOptions, L0::BuildOptions::optDisable));
};
TEST_F(DeviceWithDebuggerEnabledTest, GivenDebuggeableKernelWhenModuleIsInitializedThenDebugEnabledIsTrue) {