Skip to content

Commit beb04bd

Browse files
Improve HostMemCapabilities helper method.
Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent cff80e3 commit beb04bd

File tree

6 files changed

+40
-6
lines changed

6 files changed

+40
-6
lines changed

opencl/test/unit_test/os_interface/hw_info_config_tests.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "opencl/test/unit_test/os_interface/hw_info_config_tests.h"
99

1010
#include "shared/source/helpers/hw_helper.h"
11+
#include "shared/source/os_interface/hw_info_config.h"
12+
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
1113

1214
#include "opencl/source/cl_device/cl_device.h"
1315

@@ -30,6 +32,18 @@ void HwInfoConfigTest::TearDown() {
3032
PlatformFixture::TearDown();
3133
}
3234

35+
HWTEST_F(HwInfoConfigTest, givenDebugFlagSetWhenAskingForHostMemCapabilitesThenReturnCorrectValue) {
36+
DebugManagerStateRestore restore;
37+
38+
auto hwInfoConfig = HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
39+
40+
DebugManager.flags.EnableHostUsmSupport.set(0);
41+
EXPECT_EQ(0u, hwInfoConfig->getHostMemCapabilities(&pInHwInfo));
42+
43+
DebugManager.flags.EnableHostUsmSupport.set(1);
44+
EXPECT_NE(0u, hwInfoConfig->getHostMemCapabilities(&pInHwInfo));
45+
}
46+
3347
TEST_F(HwInfoConfigTest, givenHwInfoConfigSetHwInfoValuesFromConfigStringReturnsSetsProperValues) {
3448
uint64_t hwInfoConfig = 0x0;
3549

opencl/test/unit_test/test_files/igdrcl.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,5 @@ DoNotFlushCaches = false
204204
UseBindlessMode = -1
205205
MediaVfeStateMaxSubSlices = -1
206206
PrintBlitDispatchDetails = 0
207-
EnableMockSourceLevelDebugger = 0
207+
EnableMockSourceLevelDebugger = 0
208+
EnableHostUsmSupport = -1

shared/source/debug_settings/debug_variables_base.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideRevision, -1, "-1: default, >=0: Revisi
8080
DECLARE_DEBUG_VARIABLE(int32_t, ForceCacheFlushForBcs, -1, "Force cache flush from gpgpu engine before dispatching BCS copy. -1: default, 1: enabled, 0: disabled")
8181
DECLARE_DEBUG_VARIABLE(int32_t, ForceGpgpuSubmissionForBcsEnqueue, -1, "-1: Default, 1: Submit gpgpu command buffer with cache flushing and completion synchronization, 0: Do nothing, if possible")
8282
DECLARE_DEBUG_VARIABLE(int32_t, EnableUsmCompression, -1, "enable compression support for L0 USM Device and Shared Device side: -1 default, 0: disable, 1: enable")
83+
DECLARE_DEBUG_VARIABLE(int32_t, EnableHostUsmSupport, -1, "-1: default, 0: disable, 1: enable, Enables USM host memory")
8384
DECLARE_DEBUG_VARIABLE(int32_t, MediaVfeStateMaxSubSlices, -1, ">=0: Programs Media Vfe State Maximum Number of Dual-Subslices to given value ")
8485
DECLARE_DEBUG_VARIABLE(int32_t, EnableMockSourceLevelDebugger, 0, "Switches driver to mode with active debugger. Active modes: 1: opt-disabled, 2: opt-enabled")
8586

shared/source/os_interface/hw_info_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class HwInfoConfigHw : public HwInfoConfig {
5858

5959
void enableRenderCompression(HardwareInfo *hwInfo);
6060
void enableBlitterOperationsSupport(HardwareInfo *hwInfo);
61+
uint64_t getHostMemCapabilitiesValue();
62+
bool getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo);
6163
};
6264

6365
template <PRODUCT_FAMILY gfxProduct>

shared/source/os_interface/hw_info_config.inl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,25 @@ template <PRODUCT_FAMILY gfxProduct>
5656
uint64_t HwInfoConfigHw<gfxProduct>::getSingleDeviceSharedMemCapabilities() {
5757
return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS);
5858
}
59+
60+
template <PRODUCT_FAMILY gfxProduct>
61+
uint64_t HwInfoConfigHw<gfxProduct>::getHostMemCapabilitiesValue() {
62+
return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS);
63+
}
64+
65+
template <PRODUCT_FAMILY gfxProduct>
66+
bool HwInfoConfigHw<gfxProduct>::getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo) {
67+
return true;
68+
}
69+
70+
template <PRODUCT_FAMILY gfxProduct>
71+
uint64_t HwInfoConfigHw<gfxProduct>::getHostMemCapabilities(const HardwareInfo *hwInfo) {
72+
bool supported = getHostMemCapabilitiesSupported(hwInfo);
73+
74+
if (DebugManager.flags.EnableHostUsmSupport.get() != -1) {
75+
supported = !!DebugManager.flags.EnableHostUsmSupport.get();
76+
}
77+
78+
return (supported ? getHostMemCapabilitiesValue() : 0);
79+
}
5980
} // namespace NEO

shared/source/os_interface/hw_info_config_bdw_plus.inl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
#include "shared/source/os_interface/hw_info_config.h"
99

1010
namespace NEO {
11-
template <PRODUCT_FAMILY gfxProduct>
12-
uint64_t HwInfoConfigHw<gfxProduct>::getHostMemCapabilities(const HardwareInfo * /*hwInfo*/) {
13-
return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS);
14-
}
15-
1611
template <PRODUCT_FAMILY gfxProduct>
1712
uint64_t HwInfoConfigHw<gfxProduct>::getCrossDeviceSharedMemCapabilities() {
1813
return 0;

0 commit comments

Comments
 (0)