Skip to content

Commit bbfbf19

Browse files
Move allowStatelessCompression from HwHelper to HwInfoConfig
Signed-off-by: Rafal Maziejuk <[email protected]> Related-To: NEO-4541
1 parent 09e8bc4 commit bbfbf19

File tree

19 files changed

+121
-109
lines changed

19 files changed

+121
-109
lines changed

level_zero/core/test/unit_tests/sources/device/test_device.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ TEST_F(DeviceTest, givenCallToDevicePropertiesThenMaximumMemoryToBeAllocatedIsCo
640640
}
641641

642642
TEST_F(DeviceTest, whenCheckingIfStatelessCompressionIsSupportedThenReturnFalse) {
643-
auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
644-
EXPECT_FALSE(hwHelper.allowStatelessCompression(*defaultHwInfo));
643+
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
644+
EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(*defaultHwInfo));
645645
}
646646

647647
struct DeviceHwInfoTest : public ::testing::Test {

opencl/source/kernel/kernel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,8 +2485,8 @@ void Kernel::fillWithKernelObjsForAuxTranslation(KernelObjsForAuxTranslation &ke
24852485
}
24862486
}
24872487
}
2488-
auto &hwHelper = HwHelper::get(getDevice().getHardwareInfo().platform.eRenderCoreFamily);
2489-
if (hwHelper.allowStatelessCompression(getDevice().getHardwareInfo())) {
2488+
const auto &hwInfoConfig = *HwInfoConfig::get(getDevice().getHardwareInfo().platform.eProductFamily);
2489+
if (hwInfoConfig.allowStatelessCompression(getDevice().getHardwareInfo())) {
24902490
for (auto gfxAllocation : kernelUnifiedMemoryGfxAllocations) {
24912491
if ((gfxAllocation->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) ||
24922492
(gfxAllocation->getAllocationType() == GraphicsAllocation::AllocationType::SVM_GPU)) {
@@ -2806,8 +2806,8 @@ bool Kernel::requiresLimitedWorkgroupSize() const {
28062806
}
28072807

28082808
void Kernel::updateAuxTranslationRequired() {
2809-
auto &hwHelper = HwHelper::get(getDevice().getHardwareInfo().platform.eRenderCoreFamily);
2810-
if (hwHelper.allowStatelessCompression(getDevice().getHardwareInfo())) {
2809+
const auto &hwInfoConfig = *HwInfoConfig::get(getDevice().getHardwareInfo().platform.eProductFamily);
2810+
if (hwInfoConfig.allowStatelessCompression(getDevice().getHardwareInfo())) {
28112811
if (hasDirectStatelessAccessToHostMemory() || hasIndirectStatelessAccessToHostMemory()) {
28122812
setAuxTranslationRequired(true);
28132813
}

opencl/source/memory_manager/compression_selector_ocl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*
66
*/
77

8-
#include "shared/source/helpers/hw_helper.h"
98
#include "shared/source/memory_manager/compression_selector.h"
9+
#include "shared/source/os_interface/hw_info_config.h"
1010

1111
namespace NEO {
1212
bool CompressionSelector::preferRenderCompressedBuffer(const AllocationProperties &properties, const HardwareInfo &hwInfo) {
@@ -17,8 +17,8 @@ bool CompressionSelector::preferRenderCompressedBuffer(const AllocationPropertie
1717
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
1818
case GraphicsAllocation::AllocationType::SVM_GPU:
1919
case GraphicsAllocation::AllocationType::PRINTF_SURFACE: {
20-
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
21-
return hwHelper.allowStatelessCompression(hwInfo);
20+
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
21+
return hwInfoConfig.allowStatelessCompression(hwInfo);
2222
}
2323
default:
2424
return false;

opencl/source/program/printf_handler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "shared/source/helpers/hw_helper.h"
1313
#include "shared/source/helpers/ptr_math.h"
1414
#include "shared/source/memory_manager/memory_manager.h"
15+
#include "shared/source/os_interface/hw_info_config.h"
1516
#include "shared/source/program/print_formatter.h"
1617

1718
#include "opencl/source/cl_device/cl_device.h"
@@ -77,8 +78,8 @@ void PrintfHandler::makeResident(CommandStreamReceiver &commandStreamReceiver) {
7778
}
7879

7980
void PrintfHandler::printEnqueueOutput() {
80-
auto &helper = HwHelper::get(device.getHardwareInfo().platform.eRenderCoreFamily);
81-
if (helper.allowStatelessCompression(device.getHardwareInfo())) {
81+
const auto &hwInfoConfig = *HwInfoConfig::get(device.getHardwareInfo().platform.eProductFamily);
82+
if (hwInfoConfig.allowStatelessCompression(device.getHardwareInfo())) {
8283
auto printOutputSize = static_cast<uint32_t>(printfSurface->getUnderlyingBufferSize());
8384
auto printOutputDecompressed = std::make_unique<uint8_t[]>(printOutputSize);
8485
auto &bcsEngine = device.getEngine(EngineHelpers::getBcsEngineType(device.getHardwareInfo(), device.getDeviceBitfield(), device.getSelectorCopyEngine(), true), EngineUsage::Regular);

opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "shared/source/debug_settings/debug_settings_manager.h"
99
#include "shared/source/helpers/populate_factory.h"
10+
#include "shared/source/os_interface/hw_info_config.h"
1011

1112
#include "opencl/source/context/context.h"
1213
#include "opencl/source/helpers/cl_hw_helper_base.inl"
@@ -27,7 +28,7 @@ void populateFactoryTable<ClHwHelperHw<Family>>() {
2728

2829
template <>
2930
bool ClHwHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const HardwareInfo &hwInfo) const {
30-
if (HwHelperHw<Family>::get().allowStatelessCompression(hwInfo)) {
31+
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) {
3132
return false;
3233
} else {
3334
return !argAsPtr.isPureStateful();
@@ -36,7 +37,7 @@ bool ClHwHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, co
3637

3738
template <>
3839
bool ClHwHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) const {
39-
if (HwHelperHw<Family>::get().allowStatelessCompression(hwInfo)) {
40+
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) {
4041
return false;
4142
} else {
4243
return hasStatelessAccessToBuffer(kernelInfo);

opencl/test/unit_test/helpers/hw_helper_tests.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -878,23 +878,6 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForTilingSupportThenReturnValidVal
878878
}
879879
}
880880

881-
HWTEST_F(HwHelperTest, WhenAllowStatelessCompressionIsCalledThenReturnCorrectValue) {
882-
DebugManagerStateRestore restore;
883-
884-
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
885-
EXPECT_FALSE(hwHelper.allowStatelessCompression(hardwareInfo));
886-
887-
for (auto enable : {-1, 0, 1}) {
888-
DebugManager.flags.EnableStatelessCompression.set(enable);
889-
890-
if (enable > 0) {
891-
EXPECT_TRUE(hwHelper.allowStatelessCompression(hardwareInfo));
892-
} else {
893-
EXPECT_FALSE(hwHelper.allowStatelessCompression(hardwareInfo));
894-
}
895-
}
896-
}
897-
898881
HWTEST_F(HwHelperTest, WhenIsBankOverrideRequiredIsCalledThenFalseIsReturned) {
899882
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
900883
EXPECT_FALSE(hwHelper.isBankOverrideRequired(hardwareInfo));

opencl/test/unit_test/os_interface/hw_info_config_tests.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,20 @@ HWTEST_F(HwInfoConfigTest, WhenAllowRenderCompressionIsCalledThenTrueIsReturned)
225225
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
226226
EXPECT_TRUE(hwInfoConfig.allowRenderCompression(pInHwInfo));
227227
}
228+
229+
HWTEST_F(HwInfoConfigTest, WhenAllowStatelessCompressionIsCalledThenReturnCorrectValue) {
230+
DebugManagerStateRestore restore;
231+
232+
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
233+
EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(pInHwInfo));
234+
235+
for (auto enable : {-1, 0, 1}) {
236+
DebugManager.flags.EnableStatelessCompression.set(enable);
237+
238+
if (enable > 0) {
239+
EXPECT_TRUE(hwInfoConfig.allowStatelessCompression(pInHwInfo));
240+
} else {
241+
EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(pInHwInfo));
242+
}
243+
}
244+
}

opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -62,49 +62,6 @@ XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenXE_HP_COREWhenEnableStatelessComp
6262
EXPECT_FALSE(clHwHelper.requiresAuxResolves(kernelInfo, *defaultHwInfo));
6363
}
6464

65-
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenRevisionIsAtLeastBThenAllowStatelessCompression) {
66-
DebugManagerStateRestore restore;
67-
DebugManager.flags.CreateMultipleSubDevices.set(1);
68-
69-
auto &hwHelper = HwHelper::get(renderCoreFamily);
70-
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
71-
auto hwInfo = *defaultHwInfo;
72-
73-
for (auto revision : {REVISION_A0, REVISION_A1, REVISION_B}) {
74-
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo);
75-
if (revision < REVISION_B) {
76-
EXPECT_FALSE(hwHelper.allowStatelessCompression(hwInfo));
77-
} else {
78-
EXPECT_TRUE(hwHelper.allowStatelessCompression(hwInfo));
79-
}
80-
}
81-
}
82-
83-
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenCreateMultipleSubDevicesThenDontAllowStatelessCompression) {
84-
DebugManagerStateRestore restore;
85-
DebugManager.flags.CreateMultipleSubDevices.set(2);
86-
87-
auto &hwHelper = HwHelper::get(renderCoreFamily);
88-
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
89-
auto hwInfo = *defaultHwInfo;
90-
91-
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
92-
EXPECT_FALSE(hwHelper.allowStatelessCompression(hwInfo));
93-
}
94-
95-
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenCreateMultipleSubDevicesAndEnableMultitileCompressionThenAllowStatelessCompression) {
96-
DebugManagerStateRestore restore;
97-
DebugManager.flags.CreateMultipleSubDevices.set(4);
98-
DebugManager.flags.EnableMultiTileCompression.set(1);
99-
100-
auto &hwHelper = HwHelper::get(renderCoreFamily);
101-
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
102-
auto hwInfo = *defaultHwInfo;
103-
104-
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
105-
EXPECT_TRUE(hwHelper.allowStatelessCompression(hwInfo));
106-
}
107-
10865
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDifferentBufferSizesWhenEnableStatelessCompressionThenEveryBufferSizeIsSuitableForRenderCompression) {
10966
DebugManagerStateRestore restore;
11067
DebugManager.flags.EnableStatelessCompression.set(1);

shared/source/helpers/extra_allocation_data_xehp_and_later.inl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "shared/source/helpers/hw_helper.h"
99
#include "shared/source/memory_manager/allocation_properties.h"
10+
#include "shared/source/os_interface/hw_info_config.h"
1011

1112
namespace NEO {
1213

@@ -27,8 +28,8 @@ void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData,
2728
}
2829
}
2930

30-
auto &helper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
31-
if (helper.allowStatelessCompression(hwInfo)) {
31+
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
32+
if (hwInfoConfig.allowStatelessCompression(hwInfo)) {
3233
if (properties.allocationType == GraphicsAllocation::AllocationType::GLOBAL_SURFACE ||
3334
properties.allocationType == GraphicsAllocation::AllocationType::CONSTANT_SURFACE ||
3435
properties.allocationType == GraphicsAllocation::AllocationType::PRINTF_SURFACE) {

shared/source/helpers/hw_helper.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class HwHelper {
6767
virtual bool preferSmallWorkgroupSizeForKernel(const size_t size, const HardwareInfo &hwInfo) const = 0;
6868
virtual bool isBufferSizeSuitableForRenderCompression(const size_t size, const HardwareInfo &hwInfo) const = 0;
6969
virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0;
70-
virtual bool allowStatelessCompression(const HardwareInfo &hwInfo) const = 0;
7170
virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const = 0;
7271
virtual LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
7372
static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo);
@@ -312,8 +311,6 @@ class HwHelperHw : public HwHelper {
312311

313312
void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const override;
314313

315-
bool allowStatelessCompression(const HardwareInfo &hwInfo) const override;
316-
317314
bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const override;
318315

319316
LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;

0 commit comments

Comments
 (0)