Control enabling of local memory based on OS and HW Capabilities part 2

- add EnableLocalMemory debug variable
- separate OSInterface::osEnableLocalMemory for dll and unit tests

Change-Id: I78a1f60364eece28b30ce3e91418e7d72ba3e0d9
This commit is contained in:
Kowalczuk, Jakub
2018-10-30 11:31:08 +01:00
committed by sys_ocldev
parent 8dc28f2445
commit 1822fb0747
11 changed files with 60 additions and 5 deletions

View File

@@ -768,11 +768,14 @@ TEST(Device_GetCaps, givenDeviceWithNullSourceLevelDebuggerWhenCapsAreInitialize
typedef HwHelperTest DeviceCapsWithModifiedHwInfoTest;
TEST_F(DeviceCapsWithModifiedHwInfoTest, GivenLocalMemorySupportedAndOsEnableLocalMemoryWhenSetThenGetEnableLocalMemoryReturnCorrectValue) {
TEST_F(DeviceCapsWithModifiedHwInfoTest, GivenLocalMemorySupportedAndOsEnableLocalMemoryAndEnableLocalMemoryDebugVarWhenSetThenGetEnableLocalMemoryReturnCorrectValue) {
DebugManagerStateRestore dbgRestore;
VariableBackup<bool> orgOsEnableLocalMemory(&OSInterface::osEnableLocalMemory);
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
bool orgHwCapsLocalMemorySupported = device->getHardwareCapabilities().localMemorySupported;
DebugManager.flags.EnableLocalMemory.set(false);
device->setHWCapsLocalMemorySupported(false);
OSInterface::osEnableLocalMemory = false;
EXPECT_FALSE(device->getEnableLocalMemory());
@@ -789,6 +792,9 @@ TEST_F(DeviceCapsWithModifiedHwInfoTest, GivenLocalMemorySupportedAndOsEnableLoc
OSInterface::osEnableLocalMemory = true;
EXPECT_TRUE(device->getEnableLocalMemory());
DebugManager.flags.EnableLocalMemory.set(true);
EXPECT_TRUE(device->getEnableLocalMemory());
device->setHWCapsLocalMemorySupported(orgHwCapsLocalMemorySupported);
}