From 63bfd36232841f1de08c39944cfbe154fb4b2583 Mon Sep 17 00:00:00 2001 From: Michal Mrozek Date: Mon, 27 Jan 2020 18:02:27 +0100 Subject: [PATCH] Add function to query minimal SIMD size. Change-Id: I9b6815b3559f7cdd8eddd05ad78c721a360814ef Signed-off-by: Michal Mrozek --- core/helpers/hw_helper.h | 3 +++ core/helpers/hw_helper_base.inl | 5 +++++ runtime/device/device_caps.cpp | 2 +- unit_tests/helpers/hw_helper_tests.cpp | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/helpers/hw_helper.h b/core/helpers/hw_helper.h index 86cdd42f3b..1578846020 100644 --- a/core/helpers/hw_helper.h +++ b/core/helpers/hw_helper.h @@ -72,6 +72,7 @@ class HwHelper { uint32_t threadsPerEu) = 0; virtual uint32_t alignSlmSize(uint32_t slmSize) = 0; virtual bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) = 0; + virtual uint32_t getMinimalSIMDSize() = 0; virtual bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) const = 0; static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo); @@ -193,6 +194,8 @@ class HwHelperHw : public HwHelper { bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) override; + uint32_t getMinimalSIMDSize() override; + protected: static const AuxTranslationMode defaultAuxTranslationMode; HwHelperHw() = default; diff --git a/core/helpers/hw_helper_base.inl b/core/helpers/hw_helper_base.inl index a2ca78d4a1..e36ea579cc 100644 --- a/core/helpers/hw_helper_base.inl +++ b/core/helpers/hw_helper_base.inl @@ -277,6 +277,11 @@ bool HwHelperHw::isForceEmuInt32DivRemSPWARequired(const HardwareInfo return false; } +template +inline uint32_t HwHelperHw::getMinimalSIMDSize() { + return 8u; +} + template uint32_t HwHelperHw::getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const { return HwHelper::getMaxThreadsForWorkgroup(hwInfo, maxNumEUsPerSubSlice); diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index a72baa1b53..3c93f6ab7d 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -277,7 +277,7 @@ void Device::initializeCaps() { deviceInfo.maxNumEUsPerSubSlice = 0; deviceInfo.maxSliceCount = systemInfo.SliceCount; deviceInfo.numThreadsPerEU = 0; - auto simdSizeUsed = DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.get() ? 32u : 8u; + auto simdSizeUsed = DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.get() ? 32u : hwHelper.getMinimalSIMDSize(); deviceInfo.maxNumEUsPerSubSlice = (systemInfo.EuCountPerPoolMin == 0 || hwInfo.featureTable.ftrPooledEuEnabled == 0) ? (systemInfo.EUCount / systemInfo.SubSliceCount) diff --git a/unit_tests/helpers/hw_helper_tests.cpp b/unit_tests/helpers/hw_helper_tests.cpp index 006d7e13a3..b03cf5661c 100644 --- a/unit_tests/helpers/hw_helper_tests.cpp +++ b/unit_tests/helpers/hw_helper_tests.cpp @@ -806,3 +806,8 @@ HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsForceEmuInt32DivRemSPWARequir auto &helper = HwHelper::get(renderCoreFamily); EXPECT_FALSE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo)); } + +HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenMinimalSIMDSizeIsQueriedThen8IsReturned) { + auto &helper = HwHelper::get(renderCoreFamily); + EXPECT_EQ(8u, helper.getMinimalSIMDSize()); +}