Module: Force stateless compilation if system shared allocations allowed

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-06-29 11:07:00 +00:00
committed by Compute-Runtime-Automation
parent 5f4ed48416
commit 7c8fcb30ed
2 changed files with 26 additions and 1 deletions

View File

@@ -92,7 +92,8 @@ bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, BuildOptions::debugKernelEnable);
}
if (NEO::DebugManager.flags.DisableStatelessToStatefulOptimization.get()) {
if (NEO::DebugManager.flags.DisableStatelessToStatefulOptimization.get() ||
device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired);
}

View File

@@ -1143,6 +1143,30 @@ HWTEST_F(ModuleTranslationUnitTest, WhenBuildOptionsAreNullThenReuseExistingOpti
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("cl-intel-greater-than-4GB-buffer-required"), std::string::npos);
}
HWTEST_F(ModuleTranslationUnitTest, givenSystemSharedAllocationAllowedWhenBuildingModuleThen4GbBuffersAreRequired) {
struct MockCompilerInterface : CompilerInterface {
TranslationOutput::ErrorCode build(const NEO::Device &device, const TranslationInput &input, TranslationOutput &output) override {
inputInternalOptions = input.internalOptions.begin();
return TranslationOutput::ErrorCode::Success;
}
std::string inputInternalOptions;
};
auto mockCompilerInterface = new MockCompilerInterface;
auto &rootDeviceEnvironment = neoDevice->executionEnvironment->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()];
rootDeviceEnvironment->compilerInterface.reset(mockCompilerInterface);
MockModuleTranslationUnit moduleTu(device);
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
EXPECT_TRUE(ret);
if (neoDevice->areSharedSystemAllocationsAllowed()) {
EXPECT_NE(mockCompilerInterface->inputInternalOptions.find("cl-intel-greater-than-4GB-buffer-required"), std::string::npos);
} else {
EXPECT_EQ(mockCompilerInterface->inputInternalOptions.find("cl-intel-greater-than-4GB-buffer-required"), std::string::npos);
}
}
using PrintfModuleTest = Test<DeviceFixture>;
HWTEST_F(PrintfModuleTest, GivenModuleWithPrintfWhenKernelIsCreatedThenPrintfAllocationIsPlacedInResidencyContainer) {