mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Module: Force stateless compilation if system shared allocations allowed
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5f4ed48416
commit
7c8fcb30ed
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user