mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
GmmHelper::de/canonize to address width specified by HardwareInfo
Related-To: NEO-2941 Change-Id: Ibe09c9812dc109c06df1a308f831447f82bad57a Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
10d274daa9
commit
51a7b47cf0
@@ -336,39 +336,49 @@ TEST_F(GmmTests, givenNonZeroRowPitchWhenQueryImgFromBufferParamsThenUseUserValu
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, canonize) {
|
||||
uint64_t addr1 = 0x7777777777777777;
|
||||
uint64_t addrExpected1 = 0x0000777777777777;
|
||||
EXPECT_EQ(GmmHelper::canonize(addr1), addrExpected1);
|
||||
HardwareInfo hwInfo;
|
||||
|
||||
uint64_t addr2 = 0x7FFFFFFFFFFFFFFF;
|
||||
uint64_t addrExpected2 = 0xFFFFFFFFFFFFFFFF;
|
||||
EXPECT_EQ(GmmHelper::canonize(addr2), addrExpected2);
|
||||
// 48 bit - canonize to 48 bit
|
||||
hwInfo.capabilityTable.gpuAddressSpace = maxNBitValue(48); // 0x0000FFFFFFFFFFFF;
|
||||
auto gmmHelper = std::make_unique<GmmHelper>(nullptr, &hwInfo);
|
||||
|
||||
uint64_t addr3 = 0x7777777777777777;
|
||||
uint64_t addrExpected3 = 0x0000000077777777;
|
||||
EXPECT_EQ(GmmHelper::canonize<32>(addr3), addrExpected3);
|
||||
uint64_t testAddr1 = 0x7777777777777777;
|
||||
uint64_t goodAddr1 = 0x0000777777777777;
|
||||
EXPECT_EQ(GmmHelper::canonize(testAddr1), goodAddr1);
|
||||
|
||||
uint64_t addr4 = 0x77777777FFFFFFFF;
|
||||
uint64_t addrExpected4 = 0xFFFFFFFFFFFFFFFF;
|
||||
EXPECT_EQ(GmmHelper::canonize<32>(addr4), addrExpected4);
|
||||
uint64_t testAddr2 = 0x7FFFFFFFFFFFFFFF;
|
||||
uint64_t goodAddr2 = 0xFFFFFFFFFFFFFFFF;
|
||||
EXPECT_EQ(GmmHelper::canonize(testAddr2), goodAddr2);
|
||||
|
||||
// 36 bit - also canonize to 48 bit
|
||||
hwInfo.capabilityTable.gpuAddressSpace = maxNBitValue(36); // 0x0000000FFFFFFFFF;
|
||||
gmmHelper = std::make_unique<GmmHelper>(nullptr, &hwInfo);
|
||||
|
||||
EXPECT_EQ(GmmHelper::canonize(testAddr1), goodAddr1);
|
||||
EXPECT_EQ(GmmHelper::canonize(testAddr2), goodAddr2);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, decanonize) {
|
||||
uint64_t addr1 = 0x7777777777777777;
|
||||
uint64_t addrExpected1 = 0x0000777777777777;
|
||||
EXPECT_EQ(GmmHelper::decanonize(addr1), addrExpected1);
|
||||
HardwareInfo hwInfo;
|
||||
|
||||
uint64_t addr2 = 0x7FFFFFFFFFFFFFFF;
|
||||
uint64_t addrExpected2 = 0x0000FFFFFFFFFFFF;
|
||||
EXPECT_EQ(GmmHelper::decanonize(addr2), addrExpected2);
|
||||
// 48 bit - decanonize to 48 bit
|
||||
hwInfo.capabilityTable.gpuAddressSpace = maxNBitValue(48); //0x0000FFFFFFFFFFFF;
|
||||
auto gmmHelper = std::make_unique<GmmHelper>(nullptr, &hwInfo);
|
||||
|
||||
uint64_t addr3 = 0x7777777777777777;
|
||||
uint64_t addrExpected3 = 0x0000000077777777;
|
||||
EXPECT_EQ(GmmHelper::decanonize<32>(addr3), addrExpected3);
|
||||
uint64_t testAddr1 = 0x7777777777777777;
|
||||
uint64_t goodAddr1 = 0x0000777777777777;
|
||||
EXPECT_EQ(GmmHelper::decanonize(testAddr1), goodAddr1);
|
||||
|
||||
uint64_t addr4 = 0x7FFFFFFFFFFFFFFF;
|
||||
uint64_t addrExpected4 = 0x00000000FFFFFFFF;
|
||||
EXPECT_EQ(GmmHelper::decanonize<32>(addr4), addrExpected4);
|
||||
uint64_t testAddr2 = 0x7FFFFFFFFFFFFFFF;
|
||||
uint64_t goodAddr2 = 0x0000FFFFFFFFFFFF;
|
||||
EXPECT_EQ(GmmHelper::decanonize(testAddr2), goodAddr2);
|
||||
|
||||
// 36 bit - also decanonize to 48 bit
|
||||
hwInfo.capabilityTable.gpuAddressSpace = maxNBitValue(36); // 0x0000000FFFFFFFFF;
|
||||
gmmHelper = std::make_unique<GmmHelper>(nullptr, &hwInfo);
|
||||
|
||||
EXPECT_EQ(GmmHelper::decanonize(testAddr1), goodAddr1);
|
||||
EXPECT_EQ(GmmHelper::decanonize(testAddr2), goodAddr2);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenMipmapedInputWhenAskedForHalingThenNonDefaultValueIsReturned) {
|
||||
|
||||
Reference in New Issue
Block a user