Support the EnableLocalMemory debug variable in CSR.

Change-Id: I902b06ab0b4a3df477d12804ba74b2727d8863f6
This commit is contained in:
Piotr Fusik
2019-02-12 10:56:27 +01:00
committed by sys_ocldev
parent 1074065850
commit f014f27370
20 changed files with 93 additions and 106 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -16,5 +16,4 @@ void testDefaultImplementationOfSetupHardwareCapabilities(HwHelper &hwHelper, co
EXPECT_EQ(16384u, hwCaps.image3DMaxHeight);
EXPECT_EQ(16384u, hwCaps.image3DMaxWidth);
EXPECT_TRUE(hwCaps.isStatelesToStatefullWithOffsetSupported);
EXPECT_FALSE(hwCaps.localMemorySupported);
}

View File

@ -12,9 +12,11 @@
#include "runtime/helpers/options.h"
#include "runtime/helpers/string.h"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/os_interface/os_interface.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
#include "unit_tests/helpers/hw_helper_tests.h"
#include "unit_tests/helpers/unit_test_helper.h"
#include "unit_tests/helpers/variable_backup.h"
#include <chrono>
#include <iostream>
@ -633,3 +635,32 @@ TEST(HwHelperCacheFlushTest, givenEnableCacheFlushFlagIsReadPlatformSettingWhenP
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
EXPECT_TRUE(HwHelper::cacheFlushAfterWalkerSupported(device->getHardwareInfo()));
}
TEST_F(HwHelperTest, givenEnableLocalMemoryDebugVarAndOsEnableLocalMemoryWhenSetThenGetEnableLocalMemoryReturnsCorrectValue) {
DebugManagerStateRestore dbgRestore;
VariableBackup<bool> orgOsEnableLocalMemory(&OSInterface::osEnableLocalMemory);
auto &helper = HwHelper::get(renderCoreFamily);
DebugManager.flags.EnableLocalMemory.set(0);
EXPECT_FALSE(helper.getEnableLocalMemory(hwInfoHelper.hwInfo));
DebugManager.flags.EnableLocalMemory.set(1);
EXPECT_TRUE(helper.getEnableLocalMemory(hwInfoHelper.hwInfo));
DebugManager.flags.EnableLocalMemory.set(-1);
OSInterface::osEnableLocalMemory = false;
EXPECT_FALSE(helper.getEnableLocalMemory(hwInfoHelper.hwInfo));
OSInterface::osEnableLocalMemory = true;
EXPECT_EQ(helper.isLocalMemoryEnabled(hwInfoHelper.hwInfo), helper.getEnableLocalMemory(hwInfoHelper.hwInfo));
}
TEST_F(HwHelperTest, givenAUBDumpForceAllToLocalMemoryDebugVarWhenSetThenGetEnableLocalMemoryReturnsCorrectValue) {
DebugManagerStateRestore dbgRestore;
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfoHelper.hwInfo));
auto &helper = HwHelper::get(renderCoreFamily);
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(true);
EXPECT_TRUE(helper.getEnableLocalMemory(hwInfoHelper.hwInfo));
}