Move stepping getter functions from HwHelper to HwInfoConfig

Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
Related-To: NEO-4541
This commit is contained in:
Rafal Maziejuk
2021-08-27 13:30:39 +00:00
committed by Compute-Runtime-Automation
parent 13bea69877
commit a651e30aa1
28 changed files with 231 additions and 157 deletions

View File

@@ -25,6 +25,7 @@
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_banks.h"
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/os_context.h"
#include "opencl/source/command_stream/aub_command_stream_receiver_hw.h"
@@ -147,8 +148,8 @@ void AUBCommandStreamReceiverHw<GfxFamily>::initFile(const std::string &fileName
}
// Add the file header
auto &hwInfo = this->peekHwInfo();
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
stream->init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), aubDeviceId);
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
stream->init(hwInfoConfig.getAubStreamSteppingFromHwRevId(hwInfo), aubDeviceId);
}
}

View File

@@ -10,6 +10,7 @@
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "opencl/source/command_stream/aub_command_stream_receiver_hw.h"
#include "test.h"
@@ -44,8 +45,8 @@ void setupAUB(const NEO::Device *pDevice, aub_stream::EngineType engineType) {
// Header
auto &hwInfo = pDevice->getHardwareInfo();
auto deviceId = hwInfo.capabilityTable.aubDeviceId;
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
aubFile.init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), deviceId);
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
aubFile.init(hwInfoConfig.getAubStreamSteppingFromHwRevId(hwInfo), deviceId);
aubFile.writeMMIO(mmioBase + 0x229c, 0xffff8280);

View File

@@ -30,8 +30,8 @@ void setupAUBWithBatchBuffer(const NEO::Device *pDevice, aub_stream::EngineType
// Header
auto &hwInfo = pDevice->getHardwareInfo();
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
aubFile.init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), AUB::Traits::device);
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
aubFile.init(hwInfoConfig.getAubStreamSteppingFromHwRevId(hwInfo), AUB::Traits::device);
aubFile.writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x229c), 0xffff8280);

View File

@@ -30,8 +30,8 @@ void setupAUBWithBatchBuffer(const NEO::Device *pDevice, aub_stream::EngineType
// Header
auto &hwInfo = pDevice->getHardwareInfo();
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
aubFile.init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), AUB::Traits::device);
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
aubFile.init(hwInfoConfig.getAubStreamSteppingFromHwRevId(hwInfo), AUB::Traits::device);
aubFile.writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x229c), 0xffff8280);

View File

@@ -7,7 +7,6 @@
#pragma once
#include "shared/source/aub/aub_helper.h"
#include "shared/source/helpers/hw_helper.h"
#include "opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.h"
@@ -32,8 +31,8 @@ void setupAUBWithBatchBuffer(const NEO::Device *pDevice, aub_stream::EngineType
// Header
auto &hwInfo = pDevice->getHardwareInfo();
auto deviceId = hwInfo.capabilityTable.aubDeviceId;
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
aubFile.init(hwHelper.getAubStreamSteppingFromHwRevId(hwInfo), deviceId);
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
aubFile.init(hwInfoConfig.getAubStreamSteppingFromHwRevId(hwInfo), deviceId);
aubFile.writeMMIO(AubMemDump::computeRegisterOffset(mmioBase, 0x229c), 0xffff8280);

View File

@@ -944,50 +944,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenDefaultHwHelperHwWhenIsWorkaround
EXPECT_FALSE(helper.isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo));
}
HWTEST_F(HwHelperTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConversionIsCorrect) {
auto &helper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
for (uint32_t testValue = 0; testValue < 0x10; testValue++) {
auto hwRevIdFromStepping = hwInfoConfig.getHwRevIdFromStepping(testValue, hardwareInfo);
if (hwRevIdFromStepping != CommonConstants::invalidStepping) {
hardwareInfo.platform.usRevId = hwRevIdFromStepping;
EXPECT_EQ(testValue, helper.getSteppingFromHwRevId(hardwareInfo));
}
hardwareInfo.platform.usRevId = testValue;
auto steppingFromHwRevId = helper.getSteppingFromHwRevId(hardwareInfo);
if (steppingFromHwRevId != CommonConstants::invalidStepping) {
EXPECT_EQ(testValue, hwInfoConfig.getHwRevIdFromStepping(steppingFromHwRevId, hardwareInfo));
}
}
}
HWTEST_F(HwHelperTest, givenVariousValuesWhenGettingAubStreamSteppingFromHwRevIdThenReturnValuesAreCorrect) {
struct MockHwHelper : HwHelperHw<FamilyType> {
uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override {
return returnedStepping;
}
uint32_t returnedStepping = 0;
};
MockHwHelper mockHwHelper;
mockHwHelper.returnedStepping = REVISION_A0;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwHelper.getAubStreamSteppingFromHwRevId(hardwareInfo));
mockHwHelper.returnedStepping = REVISION_A1;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwHelper.getAubStreamSteppingFromHwRevId(hardwareInfo));
mockHwHelper.returnedStepping = REVISION_A3;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwHelper.getAubStreamSteppingFromHwRevId(hardwareInfo));
mockHwHelper.returnedStepping = REVISION_B;
EXPECT_EQ(AubMemDump::SteppingValues::B, mockHwHelper.getAubStreamSteppingFromHwRevId(hardwareInfo));
mockHwHelper.returnedStepping = REVISION_C;
EXPECT_EQ(AubMemDump::SteppingValues::C, mockHwHelper.getAubStreamSteppingFromHwRevId(hardwareInfo));
mockHwHelper.returnedStepping = REVISION_D;
EXPECT_EQ(AubMemDump::SteppingValues::D, mockHwHelper.getAubStreamSteppingFromHwRevId(hardwareInfo));
mockHwHelper.returnedStepping = REVISION_K;
EXPECT_EQ(AubMemDump::SteppingValues::K, mockHwHelper.getAubStreamSteppingFromHwRevId(hardwareInfo));
mockHwHelper.returnedStepping = CommonConstants::invalidStepping;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwHelper.getAubStreamSteppingFromHwRevId(hardwareInfo));
}
HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsForceEmuInt32DivRemSPWARequiredCalledThenFalseIsReturned) {
if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
GTEST_SKIP();

View File

@@ -159,3 +159,46 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedForPageTableManagerSupportT
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
EXPECT_EQ(hwInfoConfig.isPageTableManagerSupported(pInHwInfo), UnitTestHelper<FamilyType>::isPageTableManagerSupported(pInHwInfo));
}
HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConversionIsCorrect) {
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
for (uint32_t testValue = 0; testValue < 0x10; testValue++) {
auto hwRevIdFromStepping = hwInfoConfig.getHwRevIdFromStepping(testValue, pInHwInfo);
if (hwRevIdFromStepping != CommonConstants::invalidStepping) {
pInHwInfo.platform.usRevId = hwRevIdFromStepping;
EXPECT_EQ(testValue, hwInfoConfig.getSteppingFromHwRevId(pInHwInfo));
}
pInHwInfo.platform.usRevId = testValue;
auto steppingFromHwRevId = hwInfoConfig.getSteppingFromHwRevId(pInHwInfo);
if (steppingFromHwRevId != CommonConstants::invalidStepping) {
EXPECT_EQ(testValue, hwInfoConfig.getHwRevIdFromStepping(steppingFromHwRevId, pInHwInfo));
}
}
}
HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenGettingAubStreamSteppingFromHwRevIdThenReturnValuesAreCorrect) {
struct MockHwInfoConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override {
return returnedStepping;
}
uint32_t returnedStepping = 0;
};
MockHwInfoConfig mockHwInfoConfig;
mockHwInfoConfig.returnedStepping = REVISION_A0;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
mockHwInfoConfig.returnedStepping = REVISION_A1;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
mockHwInfoConfig.returnedStepping = REVISION_A3;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
mockHwInfoConfig.returnedStepping = REVISION_B;
EXPECT_EQ(AubMemDump::SteppingValues::B, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
mockHwInfoConfig.returnedStepping = REVISION_C;
EXPECT_EQ(AubMemDump::SteppingValues::C, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
mockHwInfoConfig.returnedStepping = REVISION_D;
EXPECT_EQ(AubMemDump::SteppingValues::D, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
mockHwInfoConfig.returnedStepping = REVISION_K;
EXPECT_EQ(AubMemDump::SteppingValues::K, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
mockHwInfoConfig.returnedStepping = CommonConstants::invalidStepping;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
}

View File

@@ -126,6 +126,30 @@ template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (getSteppingFromHwRevId(hwInfo)) {
default:
case REVISION_A0:
case REVISION_A1:
case REVISION_A3:
return AubMemDump::SteppingValues::A;
case REVISION_B:
return AubMemDump::SteppingValues::B;
case REVISION_C:
return AubMemDump::SteppingValues::C;
case REVISION_D:
return AubMemDump::SteppingValues::D;
case REVISION_K:
return AubMemDump::SteppingValues::K;
}
}
} // namespace NEO
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
@@ -651,3 +675,8 @@ HWTEST_F(HwInfoConfigTestLinuxDummy, givenHardwareInfoWhenCallingIsPageTableMana
bool ret = hwConfig.isPageTableManagerSupported(outHwInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestLinuxDummy, givenHardwareInfoWhenCallingGetSteppingFromHwRevIdThenInvalidSteppingIsReturned) {
uint32_t ret = hwConfig.getSteppingFromHwRevId(outHwInfo);
EXPECT_EQ(CommonConstants::invalidStepping, ret);
}

View File

@@ -106,6 +106,30 @@ uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getHwRevIdFromStepping(uint32_t stepping,
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (getSteppingFromHwRevId(hwInfo)) {
default:
case REVISION_A0:
case REVISION_A1:
case REVISION_A3:
return AubMemDump::SteppingValues::A;
case REVISION_B:
return AubMemDump::SteppingValues::B;
case REVISION_C:
return AubMemDump::SteppingValues::C;
case REVISION_D:
return AubMemDump::SteppingValues::D;
case REVISION_K:
return AubMemDump::SteppingValues::K;
}
}
HwInfoConfigTestWindows::HwInfoConfigTestWindows() {
this->executionEnvironment = std::make_unique<MockExecutionEnvironment>();
this->rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
@@ -193,4 +217,9 @@ HWTEST_F(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingIsPageTableManager
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingGetSteppingFromHwRevIdThenInvalidSteppingIsReturned) {
uint32_t ret = hwConfig.getSteppingFromHwRevId(outHwInfo);
EXPECT_EQ(CommonConstants::invalidStepping, ret);
}
} // namespace NEO

View File

@@ -380,9 +380,9 @@ XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenBufferWhenProgrammingBltCommandThenS
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
PLATFORM platform = clDevice->getHardwareInfo().platform;
auto &hwHelper = HwHelper::get(platform.eRenderCoreFamily);
const auto &hwInfoConfig = *HwInfoConfig::get(platform.eProductFamily);
const bool isXeHPRev0 = (platform.eProductFamily == IGFX_XE_HP_SDV) &&
(hwHelper.getSteppingFromHwRevId(clDevice->getHardwareInfo()) < REVISION_B);
(hwInfoConfig.getSteppingFromHwRevId(clDevice->getHardwareInfo()) < REVISION_B);
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(clDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver);
MockContext context(clDevice.get());