Add adjustAddressWidthFor Canonize helper

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
Related-To: NEO-5285
This commit is contained in:
Kamil Kopryk
2020-11-27 14:26:12 +01:00
committed by Compute-Runtime-Automation
parent 4602220e62
commit 0d94f289b4
5 changed files with 31 additions and 2 deletions

View File

@@ -348,7 +348,18 @@ TEST_F(GmmTests, givenNonZeroRowPitchWhenQueryImgFromBufferParamsThenUseUserValu
EXPECT_EQ(imgInfo.rowPitch, expectedRowPitch);
}
TEST_F(GmmTests, WhenCanonizingThenCorrectAddressIsReturned) {
struct GmmTestsCanonize : public GmmTests {
void SetUp() override {
uint32_t addressWidth = 48u;
HwHelper::get(renderCoreFamily).adjustAddressWidthForCanonize(addressWidth);
if (addressWidth != 48u) {
GTEST_SKIP();
}
GmmTests::SetUp();
}
};
TEST_F(GmmTestsCanonize, WhenCanonizingThenCorrectAddressIsReturned) {
auto hwInfo = *defaultHwInfo;
// 48 bit - canonize to 48 bit
@@ -371,7 +382,7 @@ TEST_F(GmmTests, WhenCanonizingThenCorrectAddressIsReturned) {
EXPECT_EQ(GmmHelper::canonize(testAddr2), goodAddr2);
}
TEST_F(GmmTests, WhenDecanonizingThenCorrectAddressIsReturned) {
TEST_F(GmmTestsCanonize, WhenDecanonizingThenCorrectAddressIsReturned) {
auto hwInfo = *defaultHwInfo;
// 48 bit - decanonize to 48 bit

View File

@@ -1051,6 +1051,14 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForIsaSystemMemoryPlacementThenRet
EXPECT_NE(localMemoryEnabled, hwHelper.useSystemMemoryPlacementForISA(hardwareInfo));
}
HWTEST_F(HwHelperTest, givenHwHelperWhenAdjustAddressWidthForCanonizeThenAddressWidthDoesntChange) {
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
uint32_t addressWidth = 48;
hwHelper.adjustAddressWidthForCanonize(addressWidth);
EXPECT_EQ(48u, addressWidth);
}
HWTEST2_F(HwInfoConfigCommonTest, givenDebugFlagSetWhenEnablingBlitterOperationsSupportThenHonorTheFlag, IsAtLeastGen12lp) {
DebugManagerStateRestore restore{};
HardwareInfo hardwareInfo = *defaultHwInfo;

View File

@@ -8,6 +8,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/os_interface/os_library.h"
@@ -37,7 +38,9 @@ uint32_t GmmHelper::getMOCS(uint32_t type) const {
GmmHelper::GmmHelper(OSInterface *osInterface, const HardwareInfo *pHwInfo) : hwInfo(pHwInfo) {
auto hwInfoAddressWidth = Math::log2(hwInfo->capabilityTable.gpuAddressSpace + 1);
HwHelper::get(hwInfo->platform.eRenderCoreFamily).adjustAddressWidthForCanonize(hwInfoAddressWidth);
GmmHelper::addressWidth = std::max(hwInfoAddressWidth, static_cast<uint32_t>(48));
gmmClientContext = GmmHelper::createGmmContextWrapperFunc(osInterface, const_cast<HardwareInfo *>(pHwInfo));
UNRECOVERABLE_IF(!gmmClientContext);
}

View File

@@ -124,6 +124,7 @@ class HwHelper {
virtual size_t getMaxFillPaternSizeForCopyEngine() const = 0;
virtual bool isMediaBlockIOSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isCopyOnlyEngineType(EngineGroupType type) const = 0;
virtual void adjustAddressWidthForCanonize(uint32_t &addressWidth) const = 0;
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
@@ -314,6 +315,8 @@ class HwHelperHw : public HwHelper {
bool isCopyOnlyEngineType(EngineGroupType type) const override;
void adjustAddressWidthForCanonize(uint32_t &addressWidth) const override;
protected:
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;

View File

@@ -510,4 +510,8 @@ bool HwHelperHw<GfxFamily>::isCopyOnlyEngineType(EngineGroupType type) const {
return NEO::EngineGroupType::Copy == type;
}
template <typename GfxFamily>
void HwHelperHw<GfxFamily>::adjustAddressWidthForCanonize(uint32_t &addressWidth) const {
}
} // namespace NEO