refactor: Add getTotalMemBankSize function to ReleaseHelper

Minor refactor of ULTs to not use hard coded banks size.

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2024-03-05 15:43:36 +00:00
committed by Compute-Runtime-Automation
parent a0faad6558
commit d25026b263
30 changed files with 120 additions and 45 deletions

View File

@@ -1017,7 +1017,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenSshSize
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenPhysicalAddressAllocatorIsCreatedThenItIsNotNull) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
std::unique_ptr<PhysicalAddressAllocator> allocator(aubCsr.createPhysicalAddressAllocator(&hardwareInfo));
std::unique_ptr<PhysicalAddressAllocator> allocator(aubCsr.createPhysicalAddressAllocator(&hardwareInfo, pDevice->getReleaseHelper()));
ASSERT_NE(nullptr, allocator);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -231,24 +231,26 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, whenPhys
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(new MockAubCsrXeHPAndLater<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
auto physicalAddressAllocator = std::unique_ptr<PhysicalAddressAllocator>(aubCsr->createPhysicalAddressAllocator(&pDevice->getHardwareInfo()));
auto physicalAddressAllocator = std::unique_ptr<PhysicalAddressAllocator>(aubCsr->createPhysicalAddressAllocator(&pDevice->getHardwareInfo(), pDevice->getReleaseHelper()));
auto allocator = reinterpret_cast<PhysicalAddressAllocatorHw<FamilyType> *>(physicalAddressAllocator.get());
auto expectedBankSize = AubHelper::getTotalMemBankSize(pDevice->getReleaseHelper());
EXPECT_EQ(32 * MemoryConstants::gigaByte, allocator->getBankSize());
EXPECT_EQ(expectedBankSize, allocator->getBankSize());
EXPECT_EQ(1u, allocator->getNumberOfBanks());
}
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, whenPhysicalAllocatorIsCreatedWith4TileConfigThenItHasCorrectBankSzieAndNumberOfBanks) {
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, whenPhysicalAllocatorIsCreatedWith4TileConfigThenItHasCorrectBankSizeAndNumberOfBanks) {
DebugManagerStateRestore restorer;
debugManager.flags.CreateMultipleSubDevices.set(4);
setUpImpl<FamilyType>();
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(new MockAubCsrXeHPAndLater<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
auto physicalAddressAllocator = std::unique_ptr<PhysicalAddressAllocator>(aubCsr->createPhysicalAddressAllocator(&pDevice->getHardwareInfo()));
auto physicalAddressAllocator = std::unique_ptr<PhysicalAddressAllocator>(aubCsr->createPhysicalAddressAllocator(&pDevice->getHardwareInfo(), pDevice->getReleaseHelper()));
auto allocator = reinterpret_cast<PhysicalAddressAllocatorHw<FamilyType> *>(physicalAddressAllocator.get());
auto expectedBankSize = AubHelper::getTotalMemBankSize(pDevice->getReleaseHelper()) / 4;
EXPECT_EQ(8 * MemoryConstants::gigaByte, allocator->getBankSize());
EXPECT_EQ(expectedBankSize, allocator->getBankSize());
EXPECT_EQ(4u, allocator->getNumberOfBanks());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -195,7 +195,7 @@ class XeHPAndLaterTileRangeRegisterTest : public DeviceFixture, public ::testing
template <typename FamilyType>
void setUpImpl() {
hardwareInfo = *defaultHwInfo;
auto releaseHelper = ReleaseHelper::create(hardwareInfo.ipVersion);
releaseHelper = ReleaseHelper::create(hardwareInfo.ipVersion);
hardwareInfoSetup[hardwareInfo.platform.eProductFamily](&hardwareInfo, true, 0, releaseHelper.get());
hardwareInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
DeviceFixture::setUpImpl(&hardwareInfo);
@@ -208,9 +208,9 @@ class XeHPAndLaterTileRangeRegisterTest : public DeviceFixture, public ::testing
DeviceFixture::tearDown();
}
void checkMMIOs(MMIOList &list, uint32_t tilesNumber, uint32_t localMemorySizeTotalInGB) {
void checkMMIOs(MMIOList &list, uint32_t tilesNumber) {
const uint32_t numberOfTiles = tilesNumber;
const uint32_t totalLocalMemorySizeGB = localMemorySizeTotalInGB;
const uint32_t totalLocalMemorySizeGB = static_cast<uint32_t>(AubHelper::getTotalMemBankSize(releaseHelper.get()) / MemoryConstants::gigaByte);
MMIOPair tileAddrRegisters[] = {{0x00004900, 0x0001},
{0x00004904, 0x0001},
@@ -234,6 +234,8 @@ class XeHPAndLaterTileRangeRegisterTest : public DeviceFixture, public ::testing
}
EXPECT_EQ(numberOfTiles, mmiosFound);
}
std::unique_ptr<ReleaseHelper> releaseHelper;
};
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenLocalMemoryEnabledWhenGlobalMmiosAreInitializedThenTileRangeRegistersAreProgrammed) {
@@ -245,7 +247,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenLocalMemory
csrSimulatedCommonHw->stream = stream.get();
csrSimulatedCommonHw->initGlobalMMIO();
checkMMIOs(stream->mmioList, 1, 32);
checkMMIOs(stream->mmioList, 1);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenLocalMemoryEnabledAnd4TileConfigWhenGlobalMmiosAreInitializedThenTileRangeRegistersAreProgrammed) {
@@ -259,7 +261,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenLocalMemory
csrSimulatedCommonHw->stream = stream.get();
csrSimulatedCommonHw->initGlobalMMIO();
checkMMIOs(stream->mmioList, 4, 32);
checkMMIOs(stream->mmioList, 4);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenAUBDumpForceAllToLocalMemoryWhenGlobalMmiosAreInitializedThenTileRangeRegistersAreProgrammed) {
@@ -274,5 +276,5 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenAUBDumpForc
csrSimulatedCommonHw->stream = stream.get();
csrSimulatedCommonHw->initGlobalMMIO();
checkMMIOs(stream->mmioList, 1, 32);
checkMMIOs(stream->mmioList, 1);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -135,8 +135,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, whenPhys
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield());
auto physicalAddressAllocator = tbxCsr->physicalAddressAllocator.get();
auto allocator = reinterpret_cast<PhysicalAddressAllocatorHw<FamilyType> *>(physicalAddressAllocator);
auto expectedBankSize = AubHelper::getTotalMemBankSize(pDevice->getReleaseHelper());
EXPECT_EQ(32 * MemoryConstants::gigaByte, allocator->getBankSize());
EXPECT_EQ(expectedBankSize, allocator->getBankSize());
EXPECT_EQ(1u, allocator->getNumberOfBanks());
}
@@ -148,8 +149,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, whenPhys
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield());
auto physicalAddressAllocator = tbxCsr->physicalAddressAllocator.get();
auto allocator = reinterpret_cast<PhysicalAddressAllocatorHw<FamilyType> *>(physicalAddressAllocator);
auto expectedBankSize = AubHelper::getTotalMemBankSize(pDevice->getReleaseHelper()) / 4;
EXPECT_EQ(8 * MemoryConstants::gigaByte, allocator->getBankSize());
EXPECT_EQ(expectedBankSize, allocator->getBankSize());
EXPECT_EQ(4u, allocator->getNumberOfBanks());
}

View File

@@ -446,7 +446,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, whenTbxCommandStreamReceiverIsCreatedThenPPG
HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCommandStreamReceiverWhenPhysicalAddressAllocatorIsCreatedThenItIsNotNull) {
MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield());
std::unique_ptr<PhysicalAddressAllocator> allocator(tbxCsr.createPhysicalAddressAllocator(&hardwareInfo));
std::unique_ptr<PhysicalAddressAllocator> allocator(tbxCsr.createPhysicalAddressAllocator(&hardwareInfo, pDevice->getReleaseHelper()));
ASSERT_NE(nullptr, allocator);
}