From 8ace8f82562827d10871194625e434ddc8806edb Mon Sep 17 00:00:00 2001 From: mplewka Date: Wed, 21 Feb 2018 16:06:09 +0100 Subject: [PATCH] Provide smaller surface size for tests Change-Id: I3f08b85c17ee89f710a449dea3d71c9ecba5b44e --- runtime/device/device.cpp | 2 +- runtime/gen8/hw_info_bdw.cpp | 12 +++++++----- runtime/gen9/hw_info_bxt.cpp | 12 +++++++----- runtime/gen9/hw_info_cfl.cpp | 12 +++++++----- runtime/gen9/hw_info_glk.cpp | 12 +++++++----- runtime/gen9/hw_info_kbl.cpp | 12 +++++++----- runtime/gen9/hw_info_skl.cpp | 12 +++++++----- runtime/helpers/hw_info.h | 2 ++ runtime/os_interface/linux/hw_info_config.cpp | 2 ++ runtime/os_interface/windows/device_factory.cpp | 2 ++ unit_tests/os_interface/device_factory_tests.cpp | 11 +++++++++++ .../os_interface/linux/hw_info_config_tests.cpp | 7 +++++++ 12 files changed, 67 insertions(+), 31 deletions(-) diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index b79c44f988..5388b5e7e4 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -162,7 +162,7 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, outDevice.memoryManager->device = pDevice; if (pDevice->preemptionMode == PreemptionMode::MidThread) { - size_t requiredSize = pHwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte; + size_t requiredSize = pHwInfo->capabilityTable.requiredPreemptionSurfaceSize; size_t alignment = 256 * MemoryConstants::kiloByte; bool uncacheable = pDevice->getWaTable()->waCSRUncachable; pDevice->preemptionAllocation = outDevice.memoryManager->allocateGraphicsMemory(requiredSize, alignment, false, uncacheable); diff --git a/runtime/gen8/hw_info_bdw.cpp b/runtime/gen8/hw_info_bdw.cpp index 8082a4d170..2cee873dec 100644 --- a/runtime/gen8/hw_info_bdw.cpp +++ b/runtime/gen8/hw_info_bdw.cpp @@ -23,6 +23,7 @@ #include "hw_info.h" #include "hw_cmds.h" #include "runtime/helpers/engine_node.h" +#include "runtime/memory_manager/memory_constants.h" namespace OCLRT { @@ -68,11 +69,12 @@ const RuntimeCapabilityTable BDW::capabilityTable{ {false, false}, &isSimulationBDW, true, - true, // forceStatelessCompilationFor32Bit - false, // EnableKmdNotify - 30000, // delayKmdNotifyMicroseconds - false, // ftr64KBpages - EngineType::ENGINE_RCS // defaultEngineType + true, // forceStatelessCompilationFor32Bit + false, // EnableKmdNotify + 30000, // delayKmdNotifyMicroseconds + false, // ftr64KBpages + EngineType::ENGINE_RCS, // defaultEngineType + MemoryConstants::pageSize //requiredPreemptionSurfaceSize }; const HardwareInfo BDW_1x2x6::hwInfo = { diff --git a/runtime/gen9/hw_info_bxt.cpp b/runtime/gen9/hw_info_bxt.cpp index 0b9444d78c..686bbcffc7 100644 --- a/runtime/gen9/hw_info_bxt.cpp +++ b/runtime/gen9/hw_info_bxt.cpp @@ -23,6 +23,7 @@ #include "hw_info_bxt.h" #include "hw_cmds.h" #include "runtime/helpers/engine_node.h" +#include "runtime/memory_manager/memory_constants.h" namespace OCLRT { @@ -64,11 +65,12 @@ const RuntimeCapabilityTable BXT::capabilityTable{ {true, false}, &isSimulationBXT, true, - false, // forceStatelessCompilationFor32Bit - false, // EnableKmdNotify - 30000, // delayKmdNotifyMicroseconds - false, // ftr64KBpages - EngineType::ENGINE_RCS // defaultEngineType + false, // forceStatelessCompilationFor32Bit + false, // EnableKmdNotify + 30000, // delayKmdNotifyMicroseconds + false, // ftr64KBpages + EngineType::ENGINE_RCS, // defaultEngineType + MemoryConstants::pageSize //requiredPreemptionSurfaceSize }; const HardwareInfo BXT_1x2x6::hwInfo = { diff --git a/runtime/gen9/hw_info_cfl.cpp b/runtime/gen9/hw_info_cfl.cpp index 72193cee47..842e5ad464 100644 --- a/runtime/gen9/hw_info_cfl.cpp +++ b/runtime/gen9/hw_info_cfl.cpp @@ -23,6 +23,7 @@ #include "hw_info_cfl.h" #include "hw_cmds.h" #include "runtime/helpers/engine_node.h" +#include "runtime/memory_manager/memory_constants.h" namespace OCLRT { @@ -59,11 +60,12 @@ const RuntimeCapabilityTable CFL::capabilityTable{ {true, false}, &isSimulationCFL, true, - true, // forceStatelessCompilationFor32Bit - false, // EnableKmdNotify - 30000, // delayKmdNotifyMicroseconds - true, // ftr64KBpages - EngineType::ENGINE_RCS // defaultEngineType + true, // forceStatelessCompilationFor32Bit + false, // EnableKmdNotify + 30000, // delayKmdNotifyMicroseconds + true, // ftr64KBpages + EngineType::ENGINE_RCS, // defaultEngineType + MemoryConstants::pageSize //requiredPreemptionSurfaceSize }; const HardwareInfo CFL_1x2x6::hwInfo = { diff --git a/runtime/gen9/hw_info_glk.cpp b/runtime/gen9/hw_info_glk.cpp index cc2fe751f0..1333f051e7 100644 --- a/runtime/gen9/hw_info_glk.cpp +++ b/runtime/gen9/hw_info_glk.cpp @@ -23,6 +23,7 @@ #include "hw_info_glk.h" #include "hw_cmds.h" #include "runtime/helpers/engine_node.h" +#include "runtime/memory_manager/memory_constants.h" namespace OCLRT { @@ -59,11 +60,12 @@ const RuntimeCapabilityTable GLK::capabilityTable{ {true, false}, &isSimulationGLK, true, - false, // forceStatelessCompilationFor32Bit - true, // EnableKmdNotify - 30000, // delayKmdNotifyMicroseconds - false, // ftr64KBpages - EngineType::ENGINE_RCS // defaultEngineType + false, // forceStatelessCompilationFor32Bit + true, // EnableKmdNotify + 30000, // delayKmdNotifyMicroseconds + false, // ftr64KBpages + EngineType::ENGINE_RCS, // defaultEngineType + MemoryConstants::pageSize //requiredPreemptionSurfaceSize }; const HardwareInfo GLK_1x3x6::hwInfo = { diff --git a/runtime/gen9/hw_info_kbl.cpp b/runtime/gen9/hw_info_kbl.cpp index b677024e8e..6bb185e404 100644 --- a/runtime/gen9/hw_info_kbl.cpp +++ b/runtime/gen9/hw_info_kbl.cpp @@ -23,6 +23,7 @@ #include "hw_info_kbl.h" #include "hw_cmds.h" #include "runtime/helpers/engine_node.h" +#include "runtime/memory_manager/memory_constants.h" namespace OCLRT { @@ -59,11 +60,12 @@ const RuntimeCapabilityTable KBL::capabilityTable{ {true, false}, &isSimulationKBL, true, - true, // forceStatelessCompilationFor32Bit - false, // EnableKmdNotify - 30000, // delayKmdNotifyMicroseconds - true, // ftr64KBpages - EngineType::ENGINE_RCS // defaultEngineType + true, // forceStatelessCompilationFor32Bit + false, // EnableKmdNotify + 30000, // delayKmdNotifyMicroseconds + true, // ftr64KBpages + EngineType::ENGINE_RCS, // defaultEngineType + MemoryConstants::pageSize //requiredPreemptionSurfaceSize }; const HardwareInfo KBL_1x2x6::hwInfo = { diff --git a/runtime/gen9/hw_info_skl.cpp b/runtime/gen9/hw_info_skl.cpp index 8f8410fdfd..b04cdc3b43 100644 --- a/runtime/gen9/hw_info_skl.cpp +++ b/runtime/gen9/hw_info_skl.cpp @@ -23,6 +23,7 @@ #include "hw_info_skl.h" #include "hw_cmds.h" #include "runtime/helpers/engine_node.h" +#include "runtime/memory_manager/memory_constants.h" namespace OCLRT { @@ -67,11 +68,12 @@ const RuntimeCapabilityTable SKL::capabilityTable{ {true, false}, &isSimulationSKL, true, - true, // forceStatelessCompilationFor32Bit - false, // EnableKmdNotify - 30000, // delayKmdNotifyMicroseconds - true, // ftr64KBpages - EngineType::ENGINE_RCS // defaultEngineType + true, // forceStatelessCompilationFor32Bit + false, // EnableKmdNotify + 30000, // delayKmdNotifyMicroseconds + true, // ftr64KBpages + EngineType::ENGINE_RCS, // defaultEngineType + MemoryConstants::pageSize //requiredPreemptionSurfaceSize }; const HardwareInfo SKL_1x2x6::hwInfo = { diff --git a/runtime/helpers/hw_info.h b/runtime/helpers/hw_info.h index 0176073a4a..95ab9bb95f 100644 --- a/runtime/helpers/hw_info.h +++ b/runtime/helpers/hw_info.h @@ -69,6 +69,8 @@ struct RuntimeCapabilityTable { bool ftr64KBpages; EngineType defaultEngineType; + + size_t requiredPreemptionSurfaceSize; }; struct HardwareCapabilities { diff --git a/runtime/os_interface/linux/hw_info_config.cpp b/runtime/os_interface/linux/hw_info_config.cpp index 80cdc213a9..e9e8373de1 100644 --- a/runtime/os_interface/linux/hw_info_config.cpp +++ b/runtime/os_interface/linux/hw_info_config.cpp @@ -28,6 +28,7 @@ #include "runtime/os_interface/linux/os_interface.h" #include "runtime/os_interface/debug_settings_manager.h" #include "runtime/utilities/cpu_info.h" +#include "runtime/memory_manager/memory_constants.h" #include @@ -180,6 +181,7 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou static_cast(outHwInfo->pSkuTable->ftrGpGpuMidThreadLevelPreempt) && preemption, static_cast(outHwInfo->pSkuTable->ftrGpGpuThreadGroupLevelPreempt) && preemption, static_cast(outHwInfo->pSkuTable->ftrGpGpuMidBatchPreempt) && preemption); + outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte; outHwInfo->capabilityTable.enableKmdNotify = DebugManager.flags.OverrideEnableKmdNotify.get() >= 0 ? !!DebugManager.flags.OverrideEnableKmdNotify.get() diff --git a/runtime/os_interface/windows/device_factory.cpp b/runtime/os_interface/windows/device_factory.cpp index 9dbfa31c93..805506f8f7 100644 --- a/runtime/os_interface/windows/device_factory.cpp +++ b/runtime/os_interface/windows/device_factory.cpp @@ -30,6 +30,7 @@ #include "runtime/device/device.h" #include "runtime/os_interface/debug_settings_manager.h" #include "runtime/sku_info/operations/sku_info_receiver.h" +#include "runtime/memory_manager/memory_constants.h" namespace OCLRT { @@ -82,6 +83,7 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) { static_cast(adapterInfo->SkuTable.FtrGpGpuMidThreadLevelPreempt), static_cast(adapterInfo->SkuTable.FtrGpGpuThreadGroupLevelPreempt), static_cast(adapterInfo->SkuTable.FtrGpGpuMidBatchPreempt)); + tempHwInfos->capabilityTable.requiredPreemptionSurfaceSize = tempHwInfos->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte; // Instrumentation tempHwInfos[devNum].capabilityTable.instrumentationEnabled &= haveInstrumentation && (adapterInfo->Caps.InstrumentationIsEnabled != 0); diff --git a/unit_tests/os_interface/device_factory_tests.cpp b/unit_tests/os_interface/device_factory_tests.cpp index bc1d784a3b..a5212b0ebb 100644 --- a/unit_tests/os_interface/device_factory_tests.cpp +++ b/unit_tests/os_interface/device_factory_tests.cpp @@ -24,6 +24,7 @@ #include "runtime/helpers/options.h" #include "runtime/os_interface/device_factory.h" #include "runtime/os_interface/os_library.h" +#include "runtime/memory_manager/memory_constants.h" #include "unit_tests/fixtures/memory_management_fixture.h" #include "unit_tests/helpers/debug_manager_state_restore.h" #include "gtest/gtest.h" @@ -132,3 +133,13 @@ TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) { DeviceFactory::releaseDevices(); } + +TEST_F(DeviceFactoryTest, givenPointerToHwInfoWhenGetDevicedCalledThenRequiedSurfaceSizeIsSettedProperly) { + HardwareInfo *hwInfo = nullptr; + size_t numDevices = 0; + bool success = DeviceFactory::getDevices(&hwInfo, numDevices); + ASSERT_TRUE(success); + + EXPECT_EQ(hwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte, hwInfo->capabilityTable.requiredPreemptionSurfaceSize); + DeviceFactory::releaseDevices(); +} \ No newline at end of file diff --git a/unit_tests/os_interface/linux/hw_info_config_tests.cpp b/unit_tests/os_interface/linux/hw_info_config_tests.cpp index 80f3eef844..83e81c1068 100644 --- a/unit_tests/os_interface/linux/hw_info_config_tests.cpp +++ b/unit_tests/os_interface/linux/hw_info_config_tests.cpp @@ -352,3 +352,10 @@ TEST_F(HwInfoConfigTestLinuxDummy, givenPlatformEnabledFtrCompressionWhenInitial EXPECT_EQ(0, ret); EXPECT_FALSE(outHwInfo.capabilityTable.ftrCompression); } + +TEST_F(HwInfoConfigTestLinuxDummy, givenPointerToHwInfoWhenConfigureHwInfoCalledThenRequiedSurfaceSizeIsSettedProperly) { + EXPECT_EQ(MemoryConstants::pageSize, pInHwInfo->capabilityTable.requiredPreemptionSurfaceSize); + int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + EXPECT_EQ(0, ret); + EXPECT_EQ(outHwInfo.pSysInfo->CsrSizeInMb * MemoryConstants::megaByte, outHwInfo.capabilityTable.requiredPreemptionSurfaceSize); +} \ No newline at end of file