From c856899dbb1729427212c65490f3aae1589f4890 Mon Sep 17 00:00:00 2001 From: Raiyan Latif Date: Tue, 12 Apr 2022 15:42:23 +0000 Subject: [PATCH] Account for hwInfo when checking for implicit scaling support Signed-off-by: Raiyan Latif --- shared/source/device/device_caps.cpp | 3 +- .../unit_test/device/neo_device_tests.cpp | 30 ++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/shared/source/device/device_caps.cpp b/shared/source/device/device_caps.cpp index 103aaafcd9..99de6c00d3 100644 --- a/shared/source/device/device_caps.cpp +++ b/shared/source/device/device_caps.cpp @@ -79,9 +79,10 @@ void Device::initializeCaps() { deviceInfo.maxMemAllocSize = std::min(deviceInfo.globalMemSize, deviceInfo.maxMemAllocSize); // if globalMemSize was reduced for 32b uint32_t subDeviceCount = HwHelper::getSubDevicesCount(&getHardwareInfo()); + bool platformImplicitScaling = hwHelper.platformSupportsImplicitScaling(hwInfo); if (((NEO::ImplicitScalingHelper::isImplicitScalingEnabled( - getDeviceBitfield(), true))) && + getDeviceBitfield(), platformImplicitScaling))) && (!isSubDevice()) && (subDeviceCount > 1)) { deviceInfo.maxMemAllocSize = deviceInfo.globalMemSize; } diff --git a/shared/test/unit_test/device/neo_device_tests.cpp b/shared/test/unit_test/device/neo_device_tests.cpp index bfe8ade2a0..80287f48f2 100644 --- a/shared/test/unit_test/device/neo_device_tests.cpp +++ b/shared/test/unit_test/device/neo_device_tests.cpp @@ -130,6 +130,34 @@ TEST_F(DeviceGetCapsTest, EXPECT_TRUE(pDevice->getDeviceInfo().maxMemAllocSize < pDevice->getDeviceInfo().globalMemSize); } +TEST_F(DeviceGetCapsTest, + givenImplicitScalingTrueWhenInitializeCapsIsCalledThenMaxMemAllocSizeIsSetCorrectly) { + DebugManagerStateRestore dbgRestorer; + + DebugManager.flags.CreateMultipleSubDevices.set(4); + pDevice->deviceBitfield = 15; + + DebugManager.flags.EnableImplicitScaling.set(1); + DebugManager.flags.EnableWalkerPartition.set(1); + DebugManager.flags.EnableSharedSystemUsmSupport.set(1); + pDevice->initializeCaps(); + EXPECT_TRUE(pDevice->getDeviceInfo().maxMemAllocSize == pDevice->getDeviceInfo().globalMemSize); +} + +TEST_F(DeviceGetCapsTest, + givenImplicitScalingFalseWhenInitializeCapsIsCalledThenMaxMemAllocSizeIsSetCorrectly) { + DebugManagerStateRestore dbgRestorer; + + DebugManager.flags.CreateMultipleSubDevices.set(4); + pDevice->deviceBitfield = 15; + + DebugManager.flags.EnableImplicitScaling.set(0); + DebugManager.flags.EnableWalkerPartition.set(1); + DebugManager.flags.EnableSharedSystemUsmSupport.set(1); + pDevice->initializeCaps(); + EXPECT_TRUE(pDevice->getDeviceInfo().maxMemAllocSize <= pDevice->getDeviceInfo().globalMemSize); +} + TEST_F(DeviceGetCapsTest, givenDontForcePreemptionModeDebugVariableWhenCreateDeviceThenSetDefaultHwPreemptionMode) { DebugManagerStateRestore dbgRestorer; { @@ -315,4 +343,4 @@ TEST_F(DeviceGetCapsTest, givenFlagEnabled64kbPagesWhenCallConstructorMemoryMana DebugManager.flags.Enable64kbpages.set(1); // force true memoryManager.reset(new MockMemoryManager(executionEnvironment)); EXPECT_TRUE(memoryManager->peek64kbPagesEnabled(0u)); -} \ No newline at end of file +}