diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 6055c14442..59c09ec0f5 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -475,6 +475,16 @@ HWTEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndStatelessNotSupportedWhenCalcul EXPECT_EQ(caps.maxMemAllocSize, expectedSize); } +HWTEST_F(DeviceGetCapsTest, givenDebugFlagSetWhenCreatingDeviceThenOverrideMaxMemAllocSize) { + DebugManagerStateRestore dbgRestorer; + debugManager.flags.OverrideMaxMemAllocSizeMb.set(5 * 1024); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); + + const auto &caps = device->getSharedDeviceInfo(); + + EXPECT_EQ(caps.maxMemAllocSize, 5u * 1024u * MemoryConstants::megaByte); +} + TEST_F(DeviceGetCapsTest, WhenDeviceIsCreatedThenExtensionsStringEndsWithSpace) { auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); const auto &caps = device->getDeviceInfo(); diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 89d49c48cc..b682571fd9 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -316,6 +316,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, GetSipBinaryFromExternalLib, -1, "-1: default, 0 DECLARE_DEBUG_VARIABLE(int32_t, EnablePidFdOrSocketsForIpc, -1, "-1: default, 0: disabled (default), 1: enabled. If enabled, L0 IPC handles are opaque and pidfd or sockets are used for IPC exchange") DECLARE_DEBUG_VARIABLE(int32_t, OverrideCopyOffloadMode, -1, "-1: default, 0: disabled, >=1: if enabled, override to any value from CopyOffloadModes enum") DECLARE_DEBUG_VARIABLE(int32_t, UseSingleListForTemporaryAllocations, -1, "-1: default, 0: disabled, 0: enabled. If enabled, use single list, instead of per CSR for tracking temporary allocations") +DECLARE_DEBUG_VARIABLE(int32_t, OverrideMaxMemAllocSizeMb, -1, "-1: default, >=0 override reported max mem alloc size in MB") /*LOGGING FLAGS*/ DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level") diff --git a/shared/source/device/device_caps.cpp b/shared/source/device/device_caps.cpp index 6e04918a72..bc5f0d81be 100644 --- a/shared/source/device/device_caps.cpp +++ b/shared/source/device/device_caps.cpp @@ -102,6 +102,10 @@ void Device::initializeCaps() { } deviceInfo.maxMemAllocSize = std::min(driverModelMaxMemAlloc, deviceInfo.maxMemAllocSize); + if (debugManager.flags.OverrideMaxMemAllocSizeMb.get() != -1) { + deviceInfo.maxMemAllocSize = static_cast(debugManager.flags.OverrideMaxMemAllocSizeMb.get()) * MemoryConstants::megaByte; + } + deviceInfo.profilingTimerResolution = getProfilingTimerResolution(); if (debugManager.flags.OverrideProfilingTimerResolution.get() != -1) { deviceInfo.profilingTimerResolution = static_cast(debugManager.flags.OverrideProfilingTimerResolution.get()); diff --git a/shared/test/common/test_files/igdrcl.config b/shared/test/common/test_files/igdrcl.config index 875c6bad55..a846d5d609 100644 --- a/shared/test/common/test_files/igdrcl.config +++ b/shared/test/common/test_files/igdrcl.config @@ -664,4 +664,5 @@ EnablePidFdOrSocketsForIpc = -1 ExposeSingleDevice=-1 OverrideCopyOffloadMode = -1 UseSingleListForTemporaryAllocations = -1 +OverrideMaxMemAllocSizeMb = -1 # Please don't edit below this line