fix: Extend scope of OverrideSlmSize debug key - apply key during initialization
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
a1c15371c1
commit
a14d5c52cb
|
@ -1608,27 +1608,6 @@ TEST(Device_UseCaps, givenCapabilityTableWhenDeviceInitializeCapsThenVmeVersions
|
|||
}
|
||||
}
|
||||
|
||||
TEST(Device_UseCaps, givenOverrideSlmSizeWhenWhenInitializeDeviceThenSlmSizeInDeviceInfoIsCorrect) {
|
||||
DebugManagerStateRestore restorer;
|
||||
HardwareInfo hardwareInfo = *defaultHwInfo;
|
||||
|
||||
uint32_t defaultSlmSize = hardwareInfo.capabilityTable.slmSize;
|
||||
debugManager.flags.OverrideSlmSize.set(-1);
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo));
|
||||
auto &deviceInfoWithoutForceSlmFlag = device->getSharedDeviceInfo();
|
||||
|
||||
EXPECT_EQ(defaultSlmSize, static_cast<uint32_t>(deviceInfoWithoutForceSlmFlag.localMemSize / MemoryConstants::kiloByte));
|
||||
|
||||
uint32_t newSlmSize = 1;
|
||||
EXPECT_NE(defaultSlmSize, newSlmSize);
|
||||
|
||||
debugManager.flags.OverrideSlmSize.set(newSlmSize);
|
||||
device.reset(new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo)});
|
||||
auto &deviceInfoWithForceSlmFlag = device->getSharedDeviceInfo();
|
||||
|
||||
EXPECT_EQ(newSlmSize, static_cast<uint32_t>(deviceInfoWithForceSlmFlag.localMemSize / MemoryConstants::kiloByte));
|
||||
}
|
||||
|
||||
TEST_F(DeviceGetCapsTest, givenClDeviceWhenInitializingCapsThenUseGetQueueFamilyCapabilitiesMethod) {
|
||||
struct ClDeviceWithCustomQueueCaps : MockClDevice {
|
||||
using MockClDevice::MockClDevice;
|
||||
|
|
|
@ -237,66 +237,6 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleRootDevicesDebugFlagWhenPrepareDevi
|
|||
EXPECT_EQ(requiredDeviceCount, executionEnvironment->rootDeviceEnvironments.size());
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsIsCalledThenOverrideGpuAddressSpace) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideGpuAddressSpace.set(12);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(maxNBitValue(12), executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideGpuAddressSpace) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideGpuAddressSpace.set(12);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(maxNBitValue(12), executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsIsCalledThenOverrideRevision) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideRevision.set(3);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(3u, executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.usRevId);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideRevision) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideRevision.set(3);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(3u, executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.usRevId);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagWithoutZeroXWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideDeviceIdToHexValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.ForceDeviceId.set("1234");
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(0x1234u, executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagWithZeroXWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideDeviceIdToHexValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.ForceDeviceId.set("0x1234");
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(0x1234u, executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, whenPrepareDeviceEnvironmentsIsCalledThenAllRootDeviceEnvironmentMembersAreInitialized) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
auto requiredDeviceCount = 2u;
|
||||
|
|
|
@ -489,7 +489,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, ForcePipeSupport, -1, "-1: default, 0: disabled,
|
|||
DECLARE_DEBUG_VARIABLE(int32_t, UseAsyncDrmExec, -1, "-1: default, 0: Disabled 1: Enabled. If enabled, pass EXEC_OBJECT_ASYNC to exec ioctl.")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, UseBindlessMode, -1, "Use precompiled builtins in bindless mode, -1: api dependent, 0: disabled, 1: enabled")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, UseExternalAllocatorForSshAndDsh, -1, "Use 32 bit external allocator for ssh and dsh in Level Zero, -1: default, 0: disabled, 1: enabled")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideSlmSize, -1, "Force different slm size than default in kB")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideSlmSize, -1, "Force per subslice slm size in KB; ignore when -1")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, UseCyclesPerSecondTimer, 0, "0: default behavior, 0: disabled: Report L0 timer in nanosecond units, 1: enabled: Report L0 timer in cycles per second")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, WaitLoopCount, -1, "-1: use default, >=0: number of iterations in wait loop")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableWaitpkg, -1, "-1: use default, 0: disable, 1: enable")
|
||||
|
|
|
@ -155,9 +155,6 @@ void Device::initializeCaps() {
|
|||
deviceInfo.maxFrontEndThreads = gfxCoreHelper.getMaxThreadsForVfe(hwInfo);
|
||||
|
||||
deviceInfo.localMemSize = hwInfo.capabilityTable.slmSize * MemoryConstants::kiloByte;
|
||||
if (debugManager.flags.OverrideSlmSize.get() != -1) {
|
||||
deviceInfo.localMemSize = debugManager.flags.OverrideSlmSize.get() * MemoryConstants::kiloByte;
|
||||
}
|
||||
|
||||
deviceInfo.imageSupport = hwInfo.capabilityTable.supportsImages;
|
||||
deviceInfo.image2DMaxWidth = 16384;
|
||||
|
|
|
@ -109,6 +109,10 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
|
|||
if (debugManager.flags.OverrideGpuAddressSpace.get() != -1) {
|
||||
hardwareInfo->capabilityTable.gpuAddressSpace = maxNBitValue(static_cast<uint64_t>(debugManager.flags.OverrideGpuAddressSpace.get()));
|
||||
}
|
||||
if (debugManager.flags.OverrideSlmSize.get() != -1) {
|
||||
hardwareInfo->capabilityTable.slmSize = debugManager.flags.OverrideSlmSize.get();
|
||||
hardwareInfo->gtSystemInfo.SLMSizeInKb = debugManager.flags.OverrideSlmSize.get();
|
||||
}
|
||||
|
||||
[[maybe_unused]] bool result = rootDeviceEnvironment.initAilConfiguration();
|
||||
DEBUG_BREAK_IF(!result);
|
||||
|
@ -160,6 +164,11 @@ static bool initHwDeviceIdResources(ExecutionEnvironment &executionEnvironment,
|
|||
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo()->platform.usRevId =
|
||||
static_cast<unsigned short>(debugManager.flags.OverrideRevision.get());
|
||||
}
|
||||
if (debugManager.flags.OverrideSlmSize.get() != -1) {
|
||||
auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo();
|
||||
hardwareInfo->capabilityTable.slmSize = debugManager.flags.OverrideSlmSize.get();
|
||||
hardwareInfo->gtSystemInfo.SLMSizeInKb = debugManager.flags.OverrideSlmSize.get();
|
||||
}
|
||||
|
||||
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initGmm();
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
* Copyright (C) 2023 Intel Corporation
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
|
@ -183,3 +184,89 @@ TEST_F(DeviceFactoryTests, givenFailedAilInitializationResultWhenPrepareDeviceEn
|
|||
bool res = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
EXPECT_FALSE(res);
|
||||
}
|
||||
|
||||
struct DeviceFactoryOverrideTest : public ::testing::Test {
|
||||
MockExecutionEnvironment executionEnvironment{defaultHwInfo.get()};
|
||||
};
|
||||
|
||||
TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsIsCalledThenOverrideGpuAddressSpace) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideGpuAddressSpace.set(12);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(maxNBitValue(12), executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideGpuAddressSpace) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideGpuAddressSpace.set(12);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(maxNBitValue(12), executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsIsCalledThenOverrideRevision) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideRevision.set(3);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(3u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usRevId);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideRevision) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideRevision.set(3);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(3u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usRevId);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryOverrideTest, givenDebugFlagWithoutZeroXWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideDeviceIdToHexValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.ForceDeviceId.set("1234");
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(0x1234u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryOverrideTest, givenDebugFlagWithZeroXWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideDeviceIdToHexValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.ForceDeviceId.set("0x1234");
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(0x1234u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->platform.usDeviceID);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsIsCalledThenOverrideSlmSize) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideSlmSize.set(123);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(123u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.slmSize);
|
||||
EXPECT_EQ(123u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->gtSystemInfo.SLMSizeInKb);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryOverrideTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideSlmSize) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideSlmSize.set(123);
|
||||
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(123u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.slmSize);
|
||||
EXPECT_EQ(123u, executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->gtSystemInfo.SLMSizeInKb);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue