From beb04bd2f8a71d78f1ed0c3a99ac1dc9de29efc8 Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Thu, 26 Nov 2020 08:31:10 +0000 Subject: [PATCH] Improve HostMemCapabilities helper method. Signed-off-by: Bartosz Dunajski --- .../os_interface/hw_info_config_tests.cpp | 14 +++++++++++++ .../test/unit_test/test_files/igdrcl.config | 3 ++- .../debug_settings/debug_variables_base.inl | 1 + shared/source/os_interface/hw_info_config.h | 2 ++ shared/source/os_interface/hw_info_config.inl | 21 +++++++++++++++++++ .../os_interface/hw_info_config_bdw_plus.inl | 5 ----- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp b/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp index 2e5d02c69c..f5e28585e9 100644 --- a/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp +++ b/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp @@ -8,6 +8,8 @@ #include "opencl/test/unit_test/os_interface/hw_info_config_tests.h" #include "shared/source/helpers/hw_helper.h" +#include "shared/source/os_interface/hw_info_config.h" +#include "shared/test/unit_test/helpers/debug_manager_state_restore.h" #include "opencl/source/cl_device/cl_device.h" @@ -30,6 +32,18 @@ void HwInfoConfigTest::TearDown() { PlatformFixture::TearDown(); } +HWTEST_F(HwInfoConfigTest, givenDebugFlagSetWhenAskingForHostMemCapabilitesThenReturnCorrectValue) { + DebugManagerStateRestore restore; + + auto hwInfoConfig = HwInfoConfig::get(pInHwInfo.platform.eProductFamily); + + DebugManager.flags.EnableHostUsmSupport.set(0); + EXPECT_EQ(0u, hwInfoConfig->getHostMemCapabilities(&pInHwInfo)); + + DebugManager.flags.EnableHostUsmSupport.set(1); + EXPECT_NE(0u, hwInfoConfig->getHostMemCapabilities(&pInHwInfo)); +} + TEST_F(HwInfoConfigTest, givenHwInfoConfigSetHwInfoValuesFromConfigStringReturnsSetsProperValues) { uint64_t hwInfoConfig = 0x0; diff --git a/opencl/test/unit_test/test_files/igdrcl.config b/opencl/test/unit_test/test_files/igdrcl.config index 9c8af91922..a9da66421c 100644 --- a/opencl/test/unit_test/test_files/igdrcl.config +++ b/opencl/test/unit_test/test_files/igdrcl.config @@ -204,4 +204,5 @@ DoNotFlushCaches = false UseBindlessMode = -1 MediaVfeStateMaxSubSlices = -1 PrintBlitDispatchDetails = 0 -EnableMockSourceLevelDebugger = 0 \ No newline at end of file +EnableMockSourceLevelDebugger = 0 +EnableHostUsmSupport = -1 \ No newline at end of file diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index d76f9c99cc..1af6dce934 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -80,6 +80,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideRevision, -1, "-1: default, >=0: Revisi DECLARE_DEBUG_VARIABLE(int32_t, ForceCacheFlushForBcs, -1, "Force cache flush from gpgpu engine before dispatching BCS copy. -1: default, 1: enabled, 0: disabled") 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") DECLARE_DEBUG_VARIABLE(int32_t, EnableUsmCompression, -1, "enable compression support for L0 USM Device and Shared Device side: -1 default, 0: disable, 1: enable") +DECLARE_DEBUG_VARIABLE(int32_t, EnableHostUsmSupport, -1, "-1: default, 0: disable, 1: enable, Enables USM host memory") DECLARE_DEBUG_VARIABLE(int32_t, MediaVfeStateMaxSubSlices, -1, ">=0: Programs Media Vfe State Maximum Number of Dual-Subslices to given value ") DECLARE_DEBUG_VARIABLE(int32_t, EnableMockSourceLevelDebugger, 0, "Switches driver to mode with active debugger. Active modes: 1: opt-disabled, 2: opt-enabled") diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index 356a1fd43b..03b8633029 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -58,6 +58,8 @@ class HwInfoConfigHw : public HwInfoConfig { void enableRenderCompression(HardwareInfo *hwInfo); void enableBlitterOperationsSupport(HardwareInfo *hwInfo); + uint64_t getHostMemCapabilitiesValue(); + bool getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo); }; template diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index be2ae653fa..e7b24e2d45 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -56,4 +56,25 @@ template uint64_t HwInfoConfigHw::getSingleDeviceSharedMemCapabilities() { return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS); } + +template +uint64_t HwInfoConfigHw::getHostMemCapabilitiesValue() { + return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS); +} + +template +bool HwInfoConfigHw::getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo) { + return true; +} + +template +uint64_t HwInfoConfigHw::getHostMemCapabilities(const HardwareInfo *hwInfo) { + bool supported = getHostMemCapabilitiesSupported(hwInfo); + + if (DebugManager.flags.EnableHostUsmSupport.get() != -1) { + supported = !!DebugManager.flags.EnableHostUsmSupport.get(); + } + + return (supported ? getHostMemCapabilitiesValue() : 0); +} } // namespace NEO diff --git a/shared/source/os_interface/hw_info_config_bdw_plus.inl b/shared/source/os_interface/hw_info_config_bdw_plus.inl index a0afdacbef..cedfa5ae57 100644 --- a/shared/source/os_interface/hw_info_config_bdw_plus.inl +++ b/shared/source/os_interface/hw_info_config_bdw_plus.inl @@ -8,11 +8,6 @@ #include "shared/source/os_interface/hw_info_config.h" namespace NEO { -template -uint64_t HwInfoConfigHw::getHostMemCapabilities(const HardwareInfo * /*hwInfo*/) { - return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS); -} - template uint64_t HwInfoConfigHw::getCrossDeviceSharedMemCapabilities() { return 0;