Improve HostMemCapabilities helper method.

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-11-26 08:31:10 +00:00
committed by Compute-Runtime-Automation
parent cff80e38b8
commit beb04bd2f8
6 changed files with 40 additions and 6 deletions

View File

@ -8,6 +8,8 @@
#include "opencl/test/unit_test/os_interface/hw_info_config_tests.h" #include "opencl/test/unit_test/os_interface/hw_info_config_tests.h"
#include "shared/source/helpers/hw_helper.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" #include "opencl/source/cl_device/cl_device.h"
@ -30,6 +32,18 @@ void HwInfoConfigTest::TearDown() {
PlatformFixture::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) { TEST_F(HwInfoConfigTest, givenHwInfoConfigSetHwInfoValuesFromConfigStringReturnsSetsProperValues) {
uint64_t hwInfoConfig = 0x0; uint64_t hwInfoConfig = 0x0;

View File

@ -205,3 +205,4 @@ UseBindlessMode = -1
MediaVfeStateMaxSubSlices = -1 MediaVfeStateMaxSubSlices = -1
PrintBlitDispatchDetails = 0 PrintBlitDispatchDetails = 0
EnableMockSourceLevelDebugger = 0 EnableMockSourceLevelDebugger = 0
EnableHostUsmSupport = -1

View File

@ -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, 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, 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, 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, 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") DECLARE_DEBUG_VARIABLE(int32_t, EnableMockSourceLevelDebugger, 0, "Switches driver to mode with active debugger. Active modes: 1: opt-disabled, 2: opt-enabled")

View File

@ -58,6 +58,8 @@ class HwInfoConfigHw : public HwInfoConfig {
void enableRenderCompression(HardwareInfo *hwInfo); void enableRenderCompression(HardwareInfo *hwInfo);
void enableBlitterOperationsSupport(HardwareInfo *hwInfo); void enableBlitterOperationsSupport(HardwareInfo *hwInfo);
uint64_t getHostMemCapabilitiesValue();
bool getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo);
}; };
template <PRODUCT_FAMILY gfxProduct> template <PRODUCT_FAMILY gfxProduct>

View File

@ -56,4 +56,25 @@ template <PRODUCT_FAMILY gfxProduct>
uint64_t HwInfoConfigHw<gfxProduct>::getSingleDeviceSharedMemCapabilities() { uint64_t HwInfoConfigHw<gfxProduct>::getSingleDeviceSharedMemCapabilities() {
return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS); return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS);
} }
template <PRODUCT_FAMILY gfxProduct>
uint64_t HwInfoConfigHw<gfxProduct>::getHostMemCapabilitiesValue() {
return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS);
}
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo) {
return true;
}
template <PRODUCT_FAMILY gfxProduct>
uint64_t HwInfoConfigHw<gfxProduct>::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 } // namespace NEO

View File

@ -8,11 +8,6 @@
#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h"
namespace NEO { namespace NEO {
template <PRODUCT_FAMILY gfxProduct>
uint64_t HwInfoConfigHw<gfxProduct>::getHostMemCapabilities(const HardwareInfo * /*hwInfo*/) {
return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS);
}
template <PRODUCT_FAMILY gfxProduct> template <PRODUCT_FAMILY gfxProduct>
uint64_t HwInfoConfigHw<gfxProduct>::getCrossDeviceSharedMemCapabilities() { uint64_t HwInfoConfigHw<gfxProduct>::getCrossDeviceSharedMemCapabilities() {
return 0; return 0;