From 5856c283c509bc96f0dd3d90a37fe01bcbd69aa4 Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Fri, 8 Oct 2021 13:01:26 +0000 Subject: [PATCH] Remove HardwareCapabilities struct Signed-off-by: Bartosz Dunajski --- .../unit_tests/sources/device/test_device.cpp | 5 ++--- opencl/source/cl_device/cl_device.cpp | 1 - opencl/source/cl_device/cl_device.h | 2 -- opencl/source/cl_device/cl_device_caps.cpp | 4 ++-- opencl/source/program/program.cpp | 2 +- .../command_queue/command_enqueue_fixture.h | 2 +- .../test/unit_test/device/device_caps_tests.cpp | 8 ++------ .../unit_test/gen11/hw_helper_tests_gen11.cpp | 7 ------- .../gen12lp/dg1/hw_helper_tests_dg1.cpp | 12 ------------ .../gen12lp/hw_helper_tests_gen12lp.inl | 11 ----------- .../unit_test/gen8/hw_helper_tests_gen8.cpp | 11 ----------- .../unit_test/gen9/hw_helper_tests_gen9.cpp | 7 ------- .../helpers/hw_helper_default_tests.cpp | 10 ---------- opencl/test/unit_test/helpers/hw_helper_tests.h | 2 -- .../helpers/hw_helper_tests_xehp_and_later.cpp | 12 ------------ opencl/test/unit_test/program/program_tests.cpp | 6 ++---- shared/source/device/device.cpp | 2 -- shared/source/device/device.h | 2 -- shared/source/device/device_caps.cpp | 2 +- shared/source/gen12lp/hw_helper_gen12lp.cpp | 9 ++------- shared/source/gen8/hw_helper_gen8.cpp | 17 ++++++++++++----- shared/source/helpers/hw_helper.h | 11 +++++++---- shared/source/helpers/hw_helper_base.inl | 17 ++++++++++++----- shared/source/helpers/hw_info.h | 7 ------- 24 files changed, 44 insertions(+), 125 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index 3e5451b016..8446e76117 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -810,12 +810,11 @@ TEST_F(DeviceTest, givenCallToDevicePropertiesThenMaximumMemoryToBeAllocatedIsCo deviceProperties.maxMemAllocSize = 0; device->getProperties(&deviceProperties); EXPECT_EQ(deviceProperties.maxMemAllocSize, this->neoDevice->getDeviceInfo().maxMemAllocSize); - HardwareCapabilities hwCaps = {0}; + auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); - hwHelper.setupHardwareCapabilities(&hwCaps, *defaultHwInfo); auto expectedSize = this->neoDevice->getDeviceInfo().globalMemSize; if (!this->neoDevice->getDeviceInfo().sharedSystemAllocationsSupport) { - expectedSize = std::min(expectedSize, hwCaps.maxMemAllocSize); + expectedSize = std::min(expectedSize, hwHelper.getMaxMemAllocSize()); } EXPECT_EQ(deviceProperties.maxMemAllocSize, expectedSize); } diff --git a/opencl/source/cl_device/cl_device.cpp b/opencl/source/cl_device/cl_device.cpp index 236bd490f5..16f8057781 100644 --- a/opencl/source/cl_device/cl_device.cpp +++ b/opencl/source/cl_device/cl_device.cpp @@ -162,7 +162,6 @@ Debugger *ClDevice::getDebugger() { return device.getDebugger(); } SourceLevelDebugger *ClDevice::getSourceLevelDebugger() { return device.getSourceLevelDebugger(); } ExecutionEnvironment *ClDevice::getExecutionEnvironment() const { return device.getExecutionEnvironment(); } const RootDeviceEnvironment &ClDevice::getRootDeviceEnvironment() const { return device.getRootDeviceEnvironment(); } -const HardwareCapabilities &ClDevice::getHardwareCapabilities() const { return device.getHardwareCapabilities(); } bool ClDevice::isFullRangeSvm() const { return device.isFullRangeSvm(); } bool ClDevice::areSharedSystemAllocationsAllowed() const { return device.areSharedSystemAllocationsAllowed(); } uint32_t ClDevice::getRootDeviceIndex() const { return device.getRootDeviceIndex(); } diff --git a/opencl/source/cl_device/cl_device.h b/opencl/source/cl_device/cl_device.h index 308dee3e9b..a6129bdab2 100644 --- a/opencl/source/cl_device/cl_device.h +++ b/opencl/source/cl_device/cl_device.h @@ -33,7 +33,6 @@ class Platform; class SourceLevelDebugger; struct DeviceInfo; struct EngineControl; -struct HardwareCapabilities; struct HardwareInfo; struct RootDeviceEnvironment; struct SelectorCopyEngine; @@ -85,7 +84,6 @@ class ClDevice : public BaseObject<_cl_device_id> { SourceLevelDebugger *getSourceLevelDebugger(); ExecutionEnvironment *getExecutionEnvironment() const; const RootDeviceEnvironment &getRootDeviceEnvironment() const; - const HardwareCapabilities &getHardwareCapabilities() const; bool isFullRangeSvm() const; bool areSharedSystemAllocationsAllowed() const; uint32_t getRootDeviceIndex() const; diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index 8985e890cd..9e00f93fb0 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -331,8 +331,8 @@ void ClDevice::initializeCaps() { deviceInfo.localMemType = CL_LOCAL; - deviceInfo.image3DMaxWidth = this->getHardwareCapabilities().image3DMaxWidth; - deviceInfo.image3DMaxHeight = this->getHardwareCapabilities().image3DMaxHeight; + deviceInfo.image3DMaxWidth = hwHelper.getMax3dImageWidthOrHeight(); + deviceInfo.image3DMaxHeight = hwHelper.getMax3dImageWidthOrHeight(); // cl_khr_image2d_from_buffer deviceInfo.imagePitchAlignment = hwHelper.getPitchAlignmentForImage(&hwInfo); diff --git a/opencl/source/program/program.cpp b/opencl/source/program/program.cpp index ee900e7b72..68cf274825 100644 --- a/opencl/source/program/program.cpp +++ b/opencl/source/program/program.cpp @@ -83,7 +83,7 @@ void Program::initInternalOptions(std::string &internalOptions) const { CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::bindlessMode); } - auto enableStatelessToStatefullWithOffset = pClDevice->getHardwareCapabilities().isStatelesToStatefullWithOffsetSupported; + auto enableStatelessToStatefullWithOffset = HwHelper::get(pClDevice->getHardwareInfo().platform.eRenderCoreFamily).isStatelesToStatefullWithOffsetSupported(); if (DebugManager.flags.EnableStatelessToStatefulBufferOffsetOpt.get() != -1) { enableStatelessToStatefullWithOffset = DebugManager.flags.EnableStatelessToStatefulBufferOffsetOpt.get() != 0; } diff --git a/opencl/test/unit_test/command_queue/command_enqueue_fixture.h b/opencl/test/unit_test/command_queue/command_enqueue_fixture.h index 86cda4b4e1..d1b7b58913 100644 --- a/opencl/test/unit_test/command_queue/command_enqueue_fixture.h +++ b/opencl/test/unit_test/command_queue/command_enqueue_fixture.h @@ -117,7 +117,7 @@ struct CommandQueueStateful : public CommandQueueHw { auto &device = dispatchInfo.begin()->getClDevice(); if (!device.areSharedSystemAllocationsAllowed()) { EXPECT_FALSE(kernel->getKernelInfo().kernelDescriptor.kernelAttributes.supportsBuffersBiggerThan4Gb()); - if (device.getHardwareCapabilities().isStatelesToStatefullWithOffsetSupported) { + if (HwHelperHw::get().isStatelesToStatefullWithOffsetSupported()) { EXPECT_TRUE(kernel->allBufferArgsStateful); } } else { diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 129b2fe292..31c9a25285 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -504,18 +504,14 @@ TEST_F(DeviceGetCapsTest, givenDeviceCapsWhenLocalMemoryIsEnabledThenCalculateGl EXPECT_EQ(sharedCaps.globalMemSize, expectedSize); } -TEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndSharedSystemAllocationsNotSupportedWhenCalculatingMaxAllocSizeThenAdjustToHWCap) { +HWTEST_F(DeviceGetCapsTest, givenGlobalMemSizeAndSharedSystemAllocationsNotSupportedWhenCalculatingMaxAllocSizeThenAdjustToHWCap) { DebugManagerStateRestore dbgRestorer; DebugManager.flags.EnableSharedSystemUsmSupport.set(0); auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); const auto &caps = device->getSharedDeviceInfo(); - HardwareCapabilities hwCaps = {0}; - auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); - hwHelper.setupHardwareCapabilities(&hwCaps, *defaultHwInfo); - uint64_t expectedSize = std::max((caps.globalMemSize / 2), static_cast(128ULL * MemoryConstants::megaByte)); - expectedSize = std::min(expectedSize, hwCaps.maxMemAllocSize); + expectedSize = std::min(expectedSize, HwHelperHw::get().getMaxMemAllocSize()); EXPECT_EQ(caps.maxMemAllocSize, expectedSize); } diff --git a/opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp b/opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp index e47b619ad0..3a6b17f0f8 100644 --- a/opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp +++ b/opencl/test/unit_test/gen11/hw_helper_tests_gen11.cpp @@ -31,13 +31,6 @@ GEN11TEST_F(HwHelperTestGen11, WhenAdjustingDefaultEngineTypeThenEngineTypeIsSet EXPECT_EQ(engineType, hardwareInfo.capabilityTable.defaultEngineType); } -GEN11TEST_F(HwHelperTestGen11, givenGen11PlatformWhenSetupHardwareCapabilitiesIsCalledThenDefaultImplementationIsUsed) { - auto &helper = HwHelper::get(renderCoreFamily); - - // Test default method implementation - testDefaultImplementationOfSetupHardwareCapabilities(helper, hardwareInfo); -} - GEN11TEST_F(HwHelperTestGen11, whenGetGpgpuEnginesThenReturnThreeRcsEngines) { whenGetGpgpuEnginesThenReturnTwoRcsEngines(pDevice->getHardwareInfo()); EXPECT_EQ(3u, pDevice->engines.size()); diff --git a/opencl/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp b/opencl/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp index de31462225..6b1cb51cc2 100644 --- a/opencl/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp +++ b/opencl/test/unit_test/gen12lp/dg1/hw_helper_tests_dg1.cpp @@ -14,18 +14,6 @@ using HwHelperTestDg1 = HwHelperTest; -DG1TEST_F(HwHelperTestDg1, givenDg1PlatformWhenSetupHardwareCapabilitiesIsCalledThenThenSpecificImplementationIsUsed) { - hardwareInfo.featureTable.ftrLocalMemory = true; - - HardwareCapabilities hwCaps = {0}; - auto &helper = HwHelper::get(renderCoreFamily); - helper.setupHardwareCapabilities(&hwCaps, hardwareInfo); - - EXPECT_EQ(2048u, hwCaps.image3DMaxHeight); - EXPECT_EQ(2048u, hwCaps.image3DMaxWidth); - EXPECT_TRUE(hwCaps.isStatelesToStatefullWithOffsetSupported); -} - DG1TEST_F(HwHelperTestDg1, givenDg1A0WhenAdjustDefaultEngineTypeCalledThenRcsIsReturned) { auto &helper = HwHelper::get(renderCoreFamily); const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); diff --git a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl index 57e7dbb397..4a1f5b6bb9 100644 --- a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl @@ -58,17 +58,6 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, WhenAdjustingDefaultEngineTypeThenRcsIsSet) { EXPECT_EQ(aub_stream::ENGINE_RCS, hardwareInfo.capabilityTable.defaultEngineType); } -GEN12LPTEST_F(HwHelperTestGen12Lp, givenGen12LpPlatformWhenSetupHardwareCapabilitiesIsCalledThenShouldSetCorrectValues) { - HardwareCapabilities hwCaps = {0}; - - auto &hwHelper = HwHelper::get(renderCoreFamily); - hwHelper.setupHardwareCapabilities(&hwCaps, hardwareInfo); - - EXPECT_EQ(2048u, hwCaps.image3DMaxHeight); - EXPECT_EQ(2048u, hwCaps.image3DMaxWidth); - EXPECT_TRUE(hwCaps.isStatelesToStatefullWithOffsetSupported); -} - GEN12LPTEST_F(HwHelperTestGen12Lp, givenDifferentSizesOfAllocationWhenCheckingCompressionPreferenceThenReturnCorrectValue) { auto &helper = HwHelper::get(renderCoreFamily); diff --git a/opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp b/opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp index 63eab47e3d..4bc19a79c3 100644 --- a/opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp +++ b/opencl/test/unit_test/gen8/hw_helper_tests_gen8.cpp @@ -34,17 +34,6 @@ GEN8TEST_F(HwHelperTestGen8, WhenAdjustingDefaultEngineTypeThenEngineTypeIsSet) EXPECT_EQ(engineType, hardwareInfo.capabilityTable.defaultEngineType); } -GEN8TEST_F(HwHelperTestGen8, givenGen8PlatformWhenSetupHardwareCapabilitiesIsCalledThenSpecificImplementationIsUsed) { - auto &helper = HwHelper::get(renderCoreFamily); - HardwareCapabilities hwCaps = {0}; - helper.setupHardwareCapabilities(&hwCaps, hardwareInfo); - - EXPECT_EQ(2048u, hwCaps.image3DMaxHeight); - EXPECT_EQ(2048u, hwCaps.image3DMaxWidth); - EXPECT_EQ(2 * MemoryConstants::gigaByte - 8 * MemoryConstants::megaByte, hwCaps.maxMemAllocSize); - EXPECT_FALSE(hwCaps.isStatelesToStatefullWithOffsetSupported); -} - GEN8TEST_F(HwHelperTestGen8, whenGetGpgpuEnginesThenReturnThreeEngines) { whenGetGpgpuEnginesThenReturnTwoRcsEngines(pDevice->getHardwareInfo()); EXPECT_EQ(3u, pDevice->engines.size()); diff --git a/opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp b/opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp index c479d32b66..d896fc8f4b 100644 --- a/opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp +++ b/opencl/test/unit_test/gen9/hw_helper_tests_gen9.cpp @@ -36,13 +36,6 @@ GEN9TEST_F(HwHelperTestGen9, WhenAdjustingDefaultEngineTypeThenEngineTypeIsSet) EXPECT_EQ(engineType, hardwareInfo.capabilityTable.defaultEngineType); } -GEN9TEST_F(HwHelperTestGen9, givenGen9PlatformWhenSetupHardwareCapabilitiesIsCalledThenDefaultImplementationIsUsed) { - auto &helper = HwHelper::get(renderCoreFamily); - - // Test default method implementation - testDefaultImplementationOfSetupHardwareCapabilities(helper, hardwareInfo); -} - GEN9TEST_F(HwHelperTestGen9, givenDebuggingActiveWhenSipKernelTypeIsQueriedThenDbgCsrLocalTypeIsReturned) { auto &helper = HwHelper::get(renderCoreFamily); diff --git a/opencl/test/unit_test/helpers/hw_helper_default_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_default_tests.cpp index b6a169bd69..2c33e51187 100644 --- a/opencl/test/unit_test/helpers/hw_helper_default_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_default_tests.cpp @@ -9,16 +9,6 @@ #include "opencl/test/unit_test/helpers/hw_helper_tests.h" -void testDefaultImplementationOfSetupHardwareCapabilities(HwHelper &hwHelper, const HardwareInfo &hwInfo) { - HardwareCapabilities hwCaps = {0}; - - hwHelper.setupHardwareCapabilities(&hwCaps, hwInfo); - - EXPECT_EQ(16384u, hwCaps.image3DMaxHeight); - EXPECT_EQ(16384u, hwCaps.image3DMaxWidth); - EXPECT_TRUE(hwCaps.isStatelesToStatefullWithOffsetSupported); -} - HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenHwHelperWhenAskedForHvAlign4RequiredThenReturnTrue) { auto &hwHelper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily); EXPECT_TRUE(hwHelper.hvAlign4Required()); diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.h b/opencl/test/unit_test/helpers/hw_helper_tests.h index 9389013dfe..f5630091f7 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.h +++ b/opencl/test/unit_test/helpers/hw_helper_tests.h @@ -18,8 +18,6 @@ using namespace NEO; using HwHelperTest = Test; -void testDefaultImplementationOfSetupHardwareCapabilities(HwHelper &hwHelper, const HardwareInfo &hwInfo); - struct ComputeSlmTestInput { uint32_t expected; uint32_t slmSize; diff --git a/opencl/test/unit_test/helpers/hw_helper_tests_xehp_and_later.cpp b/opencl/test/unit_test/helpers/hw_helper_tests_xehp_and_later.cpp index e2ac9cfe4b..6e78e2ee49 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests_xehp_and_later.cpp @@ -57,18 +57,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, GiveCcsNodeThenDefaultEng EXPECT_EQ(aub_stream::ENGINE_CCS, hardwareInfo.capabilityTable.defaultEngineType); } -HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, givenXeHPAndLaterPlatformWhenSetupHardwareCapabilitiesIsCalledThenThenSpecificImplementationIsUsed) { - hardwareInfo.featureTable.ftrLocalMemory = true; - - HardwareCapabilities hwCaps = {0}; - auto &helper = HwHelper::get(renderCoreFamily); - helper.setupHardwareCapabilities(&hwCaps, hardwareInfo); - - EXPECT_EQ(16384u, hwCaps.image3DMaxHeight); - EXPECT_EQ(16384u, hwCaps.image3DMaxWidth); - EXPECT_TRUE(hwCaps.isStatelesToStatefullWithOffsetSupported); -} - HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, givenXeHPAndLaterPlatformWithLocalMemoryFeatureWhenIsLocalMemoryEnabledIsCalledThenTrueIsReturned) { hardwareInfo.featureTable.ftrLocalMemory = true; diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 96839298d9..afa0bdb0e2 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -2210,13 +2210,11 @@ TEST_F(Program32BitTests, givenDeviceWithForce32BitAddressingOnWhenProgramIsCrea } } -TEST_F(ProgramTests, givenNewProgramThenStatelessToStatefulBufferOffsetOptimizationIsMatchingThePlatformEnablingStatus) { +HWTEST_F(ProgramTests, givenNewProgramThenStatelessToStatefulBufferOffsetOptimizationIsMatchingThePlatformEnablingStatus) { MockProgram program(pContext, false, toClDeviceVector(*pClDevice)); auto internalOptions = program.getInitInternalOptions(); - HardwareCapabilities hwCaps = {0}; - HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily).setupHardwareCapabilities(&hwCaps, pDevice->getHardwareInfo()); - if (hwCaps.isStatelesToStatefullWithOffsetSupported) { + if (HwHelperHw::get().isStatelesToStatefullWithOffsetSupported()) { EXPECT_TRUE(CompilerOptions::contains(internalOptions, CompilerOptions::hasBufferOffsetArg)); } else { EXPECT_FALSE(CompilerOptions::contains(internalOptions, CompilerOptions::hasBufferOffsetArg)); diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 44734c2225..8a71feea4e 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -204,8 +204,6 @@ bool Device::createDeviceImpl() { auto &hwInfo = getHardwareInfo(); preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo); - auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); - hwHelper.setupHardwareCapabilities(&this->hardwareCapabilities, hwInfo); executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->initGmm(); if (!getDebugger()) { diff --git a/shared/source/device/device.h b/shared/source/device/device.h index ea9452e208..64f04e742c 100644 --- a/shared/source/device/device.h +++ b/shared/source/device/device.h @@ -88,7 +88,6 @@ class Device : public ReferenceTrackedObject { ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; } const RootDeviceEnvironment &getRootDeviceEnvironment() const { return *executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]; } RootDeviceEnvironment &getRootDeviceEnvironmentRef() const { return *executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]; } - const HardwareCapabilities &getHardwareCapabilities() const { return hardwareCapabilities; } bool isFullRangeSvm() const { return getRootDeviceEnvironment().isFullRangeSvm(); } @@ -161,7 +160,6 @@ class Device : public ReferenceTrackedObject { DeviceInfo deviceInfo = {}; - HardwareCapabilities hardwareCapabilities = {}; std::unique_ptr performanceCounters; std::vector> commandStreamReceivers; std::vector engines; diff --git a/shared/source/device/device_caps.cpp b/shared/source/device/device_caps.cpp index ffac1393e1..0c37a1d6f7 100644 --- a/shared/source/device/device_caps.cpp +++ b/shared/source/device/device_caps.cpp @@ -74,7 +74,7 @@ void Device::initializeCaps() { if (!deviceInfo.sharedSystemAllocationsSupport) { deviceInfo.maxMemAllocSize = ApiSpecificConfig::getReducedMaxAllocSize(deviceInfo.maxMemAllocSize); - deviceInfo.maxMemAllocSize = std::min(deviceInfo.maxMemAllocSize, this->hardwareCapabilities.maxMemAllocSize); + deviceInfo.maxMemAllocSize = std::min(deviceInfo.maxMemAllocSize, hwHelper.getMaxMemAllocSize()); } // Some specific driver model configurations may impose additional limitations diff --git a/shared/source/gen12lp/hw_helper_gen12lp.cpp b/shared/source/gen12lp/hw_helper_gen12lp.cpp index 8baf131587..097f21a3ac 100644 --- a/shared/source/gen12lp/hw_helper_gen12lp.cpp +++ b/shared/source/gen12lp/hw_helper_gen12lp.cpp @@ -21,13 +21,8 @@ using Family = NEO::TGLLPFamily; namespace NEO { template <> -void HwHelperHw::setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) { - caps->image3DMaxHeight = 2048; - caps->image3DMaxWidth = 2048; - //With statefull messages we have an allocation cap of 4GB - //Reason to subtract 8KB is that driver may pad the buffer with addition pages for over fetching.. - caps->maxMemAllocSize = (4ULL * MemoryConstants::gigaByte) - (8ULL * MemoryConstants::kiloByte); - caps->isStatelesToStatefullWithOffsetSupported = true; +size_t HwHelperHw::getMax3dImageWidthOrHeight() const { + return 2048; } template <> diff --git a/shared/source/gen8/hw_helper_gen8.cpp b/shared/source/gen8/hw_helper_gen8.cpp index 7327fe9d81..9e6a29aa86 100644 --- a/shared/source/gen8/hw_helper_gen8.cpp +++ b/shared/source/gen8/hw_helper_gen8.cpp @@ -42,11 +42,18 @@ size_t HwHelperHw::getMaxBarrierRegisterPerSlice() const { } template <> -void HwHelperHw::setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) { - caps->image3DMaxHeight = 2048; - caps->image3DMaxWidth = 2048; - caps->maxMemAllocSize = 2 * MemoryConstants::gigaByte - 8 * MemoryConstants::megaByte; - caps->isStatelesToStatefullWithOffsetSupported = false; +size_t HwHelperHw::getMax3dImageWidthOrHeight() const { + return 2048; +} + +template <> +uint64_t HwHelperHw::getMaxMemAllocSize() const { + return (2 * MemoryConstants::gigaByte) - (8 * MemoryConstants::kiloByte); +} + +template <> +bool HwHelperHw::isStatelesToStatefullWithOffsetSupported() const { + return false; } template <> diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 56852b41d5..71372bb43b 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -32,7 +32,6 @@ class Gmm; struct AllocationData; struct AllocationProperties; struct EngineControl; -struct HardwareCapabilities; struct RootDeviceEnvironment; struct PipeControlArgs; @@ -49,7 +48,6 @@ class HwHelper { virtual uint32_t getPitchAlignmentForImage(const HardwareInfo *hwInfo) const = 0; virtual uint32_t getMaxNumSamplers() const = 0; virtual void adjustDefaultEngineType(HardwareInfo *pHwInfo) = 0; - virtual void setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) = 0; virtual bool isL3Configurable(const HardwareInfo &hwInfo) = 0; virtual SipKernelType getSipKernelType(bool debuggingActive) const = 0; virtual bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const = 0; @@ -147,6 +145,9 @@ class HwHelper { virtual bool isScratchSpaceSurfaceStateAccessible() const = 0; virtual uint64_t getRenderSurfaceStateBaseAddress(void *renderSurfaceState) const = 0; + virtual size_t getMax3dImageWidthOrHeight() const = 0; + virtual uint64_t getMaxMemAllocSize() const = 0; + virtual bool isStatelesToStatefullWithOffsetSupported() const = 0; protected: HwHelper() = default; @@ -213,8 +214,6 @@ class HwHelperHw : public HwHelper { void adjustDefaultEngineType(HardwareInfo *pHwInfo) override; - void setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) override; - bool isL3Configurable(const HardwareInfo &hwInfo) override; SipKernelType getSipKernelType(bool debuggingActive) const override; @@ -370,6 +369,10 @@ class HwHelperHw : public HwHelper { bool isScratchSpaceSurfaceStateAccessible() const override; uint64_t getRenderSurfaceStateBaseAddress(void *renderSurfaceState) const override; + size_t getMax3dImageWidthOrHeight() const override; + uint64_t getMaxMemAllocSize() const override; + bool isStatelesToStatefullWithOffsetSupported() const override; + protected: static const AuxTranslationMode defaultAuxTranslationMode; HwHelperHw() = default; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index ee3abcd4f7..4fd6d5f93c 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -38,13 +38,20 @@ bool HwHelperHw::isBufferSizeSuitableForRenderCompression(const size_t s } template -void HwHelperHw::setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) { - caps->image3DMaxHeight = 16384; - caps->image3DMaxWidth = 16384; +size_t HwHelperHw::getMax3dImageWidthOrHeight() const { + return 16384; +} + +template +uint64_t HwHelperHw::getMaxMemAllocSize() const { //With statefull messages we have an allocation cap of 4GB //Reason to subtract 8KB is that driver may pad the buffer with addition pages for over fetching.. - caps->maxMemAllocSize = (4ULL * MemoryConstants::gigaByte) - (8ULL * MemoryConstants::kiloByte); - caps->isStatelesToStatefullWithOffsetSupported = true; + return (4ULL * MemoryConstants::gigaByte) - (8ULL * MemoryConstants::kiloByte); +} + +template +bool HwHelperHw::isStatelesToStatefullWithOffsetSupported() const { + return true; } template diff --git a/shared/source/helpers/hw_info.h b/shared/source/helpers/hw_info.h index 07616a2ac7..b91a83799f 100644 --- a/shared/source/helpers/hw_info.h +++ b/shared/source/helpers/hw_info.h @@ -68,13 +68,6 @@ struct RuntimeCapabilityTable { bool fusedEuEnabled; }; -struct HardwareCapabilities { - size_t image3DMaxWidth; - size_t image3DMaxHeight; - uint64_t maxMemAllocSize; - bool isStatelesToStatefullWithOffsetSupported; -}; - struct HardwareInfo { HardwareInfo() = default; HardwareInfo(const PLATFORM *platform, const FeatureTable *featureTable, const WorkaroundTable *workaroundTable,