From 4f15365dae3dcda28b4d77dd1ecfb2bf189714ad Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Tue, 31 Aug 2021 15:17:18 +0000 Subject: [PATCH] Correct getDeviceMemoryName Signed-off-by: Kamil Kopryk Related-To: NEO-6112 --- level_zero/core/source/device/device_imp.cpp | 3 +-- .../unit_test/os_interface/hw_info_config_tests.cpp | 8 ++++++++ opencl/test/unit_test/xe_hp_core/xehp/CMakeLists.txt | 1 + .../test/unit_test/xe_hp_core/xehp/excludes_xehp.cpp | 10 ++++++++++ .../xe_hp_core/xehp/test_hw_info_config_xehp.inl | 8 ++++++++ shared/source/helpers/hw_helper.h | 3 --- shared/source/helpers/hw_helper_bdw_and_later.inl | 5 ----- shared/source/helpers/hw_helper_xehp_and_later.inl | 6 ------ shared/source/os_interface/hw_info_config.h | 2 ++ shared/source/os_interface/hw_info_config.inl | 6 ++++++ .../os_agnostic_hw_info_config_xe_hp_core.inl | 7 ++++++- .../os_interface/os_agnostic_hw_info_config_tests.cpp | 4 ++++ 12 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 opencl/test/unit_test/xe_hp_core/xehp/excludes_xehp.cpp diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index c28813e7f9..253fc83e38 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -272,10 +272,9 @@ ze_result_t DeviceImp::getMemoryProperties(uint32_t *pCount, ze_device_memory_pr } const auto &deviceInfo = this->neoDevice->getDeviceInfo(); - - strcpy_s(pMemProperties->name, ZE_MAX_DEVICE_NAME, getHwHelper().getDeviceMemoryName().c_str()); auto &hwInfo = this->getHwInfo(); auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); + strcpy_s(pMemProperties->name, ZE_MAX_DEVICE_NAME, hwInfoConfig.getDeviceMemoryName().c_str()); pMemProperties->maxClockRate = hwInfoConfig.getDeviceMemoryMaxClkRate(&hwInfo); pMemProperties->maxBusWidth = deviceInfo.addressBits; if (NEO::ImplicitScalingHelper::isImplicitScalingEnabled(this->getNEODevice()->getDeviceBitfield(), true) || 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 500fbfcfc1..a972c45961 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 @@ -17,6 +17,8 @@ #include "opencl/source/sampler/sampler.h" #include "opencl/test/unit_test/mocks/mock_context.h" +#include "gmock/gmock.h" + using namespace NEO; void HwInfoConfigTest::SetUp() { @@ -207,3 +209,9 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedForDefaultEngineTypeAdjustm const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily); EXPECT_FALSE(hwInfoConfig.isDefaultEngineTypeAdjustmentRequired(pInHwInfo)); } + +HWTEST_F(HwInfoConfigTest, whenCallingGetDeviceMemoryNameThenDdrIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily); + auto deviceMemoryName = hwInfoConfig.getDeviceMemoryName(); + EXPECT_THAT(deviceMemoryName, testing::HasSubstr(std::string("DDR"))); +} diff --git a/opencl/test/unit_test/xe_hp_core/xehp/CMakeLists.txt b/opencl/test/unit_test/xe_hp_core/xehp/CMakeLists.txt index 69240fbdb9..9879cb80f0 100644 --- a/opencl/test/unit_test/xe_hp_core/xehp/CMakeLists.txt +++ b/opencl/test/unit_test/xe_hp_core/xehp/CMakeLists.txt @@ -8,6 +8,7 @@ if(TESTS_XE_HP_SDV) set(IGDRCL_SRCS_tests_xe_hp_core_xehp ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/cache_flush_tests_xehp.inl + ${CMAKE_CURRENT_SOURCE_DIR}/excludes_xehp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_xehp.inl ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_xehp.inl ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_xehp.inl diff --git a/opencl/test/unit_test/xe_hp_core/xehp/excludes_xehp.cpp b/opencl/test/unit_test/xe_hp_core/xehp/excludes_xehp.cpp new file mode 100644 index 0000000000..15efc82d89 --- /dev/null +++ b/opencl/test/unit_test/xe_hp_core/xehp/excludes_xehp.cpp @@ -0,0 +1,10 @@ +/* + * Copyright (C) 2021 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "test.h" + +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, whenCallingGetDeviceMemoryNameThenDdrIsReturned, IGFX_XE_HP_SDV); diff --git a/opencl/test/unit_test/xe_hp_core/xehp/test_hw_info_config_xehp.inl b/opencl/test/unit_test/xe_hp_core/xehp/test_hw_info_config_xehp.inl index a8ef33427c..2c30c93e21 100644 --- a/opencl/test/unit_test/xe_hp_core/xehp/test_hw_info_config_xehp.inl +++ b/opencl/test/unit_test/xe_hp_core/xehp/test_hw_info_config_xehp.inl @@ -14,6 +14,8 @@ #include "opencl/test/unit_test/mocks/mock_context.h" #include "test.h" +#include "gmock/gmock.h" + using namespace NEO; using XeHPHwInfoConfig = ::testing::Test; @@ -66,6 +68,12 @@ XEHPTEST_F(XeHPHwInfoConfig, givenDebugVariableSetWhenConfiguringThenEnableRcs) EXPECT_TRUE(hwInfo.featureTable.ftrRcsNode); } +XEHPTEST_F(XeHPHwInfoConfig, givenXeHpWhenCallingGetDeviceMemoryNameThenHbmIsReturned) { + auto hwInfoConfig = HwInfoConfig::get(productFamily); + auto deviceMemoryName = hwInfoConfig->getDeviceMemoryName(); + EXPECT_THAT(deviceMemoryName, testing::HasSubstr(std::string("HBM"))); +} + using XeHPHwHelperTest = HwHelperTest; XEHPTEST_F(XeHPHwHelperTest, givenXeHPMultiConfigWhenAllowRenderCompressionIsCalledThenCorrectValueIsReturned) { diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index eb9d10e3da..f9250a02fb 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -93,7 +93,6 @@ class HwHelper { virtual const StackVec getThreadsPerEUConfigs() const = 0; virtual bool getEnableLocalMemory(const HardwareInfo &hwInfo) const = 0; virtual std::string getExtensions() const = 0; - virtual std::string getDeviceMemoryName() const = 0; static uint32_t getMaxThreadsForVfe(const HardwareInfo &hwInfo); virtual uint32_t getMetricsLibraryGenId() const = 0; virtual uint32_t getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const = 0; @@ -272,8 +271,6 @@ class HwHelperHw : public HwHelper { std::string getExtensions() const override; - std::string getDeviceMemoryName() const override; - uint32_t getMetricsLibraryGenId() const override; uint32_t getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const override; diff --git a/shared/source/helpers/hw_helper_bdw_and_later.inl b/shared/source/helpers/hw_helper_bdw_and_later.inl index 6672151c3b..66422e34a8 100644 --- a/shared/source/helpers/hw_helper_bdw_and_later.inl +++ b/shared/source/helpers/hw_helper_bdw_and_later.inl @@ -134,9 +134,4 @@ bool HwHelperHw::additionalPipeControlArgsRequired() const { return false; } -template -std::string HwHelperHw::getDeviceMemoryName() const { - return "DDR"; -} - } // namespace NEO diff --git a/shared/source/helpers/hw_helper_xehp_and_later.inl b/shared/source/helpers/hw_helper_xehp_and_later.inl index ffa1381fd4..a997e823f2 100644 --- a/shared/source/helpers/hw_helper_xehp_and_later.inl +++ b/shared/source/helpers/hw_helper_xehp_and_later.inl @@ -187,10 +187,4 @@ inline bool HwHelperHw::preferSmallWorkgroupSizeForKernel(const size_ } return true; } - -template -std::string HwHelperHw::getDeviceMemoryName() const { - return "HBM"; -} - } // namespace NEO diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index 30ca5fe5c3..297b75db84 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -52,6 +52,7 @@ class HwInfoConfig { virtual uint32_t getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const = 0; virtual void setAdditionalPipelineSelectFields(void *pipelineSelectCmd, const PipelineSelectArgs &pipelineSelectArgs, const HardwareInfo &hwInfo) = 0; virtual bool isDefaultEngineTypeAdjustmentRequired(const HardwareInfo &hwInfo) const = 0; + virtual std::string getDeviceMemoryName() const = 0; uint32_t threadsPerEu; }; @@ -86,6 +87,7 @@ class HwInfoConfigHw : public HwInfoConfig { uint32_t getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const override; void setAdditionalPipelineSelectFields(void *pipelineSelectCmd, const PipelineSelectArgs &pipelineSelectArgs, const HardwareInfo &hwInfo) override; bool isDefaultEngineTypeAdjustmentRequired(const HardwareInfo &hwInfo) const override; + std::string getDeviceMemoryName() const override; protected: HwInfoConfigHw() = default; diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 8e529b73d2..402f49f04f 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -140,4 +140,10 @@ template bool HwInfoConfigHw::isDefaultEngineTypeAdjustmentRequired(const HardwareInfo &hwInfo) const { return false; } + +template +std::string HwInfoConfigHw::getDeviceMemoryName() const { + return "DDR"; +} + } // namespace NEO diff --git a/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl b/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl index a62f729d76..0160d7d6c4 100644 --- a/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl +++ b/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl @@ -48,4 +48,9 @@ void HwInfoConfigHw::adjustSamplerState(void *sampler, const Har if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) { samplerState->setLowQualityFilter(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE); } -} \ No newline at end of file +} + +template <> +std::string HwInfoConfigHw::getDeviceMemoryName() const { + return "HBM"; +} diff --git a/shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.cpp b/shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.cpp index 735339cd81..4e166cfec8 100644 --- a/shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.cpp +++ b/shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.cpp @@ -117,6 +117,10 @@ uint32_t HwInfoConfigHw::getAubStreamSteppingFromHwRevId(const Har return AubMemDump::SteppingValues::K; } } +template <> +std::string HwInfoConfigHw::getDeviceMemoryName() const { + return ""; +} template <> void HwInfoConfigHw::setAdditionalPipelineSelectFields(void *pipelineSelectCmd, const PipelineSelectArgs &pipelineSelectArgs, const HardwareInfo &hwInfo) {