mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Improve calculateAvailableThreadCount implementation
Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
fe0c857f1a
commit
af91f94098
@ -1002,14 +1002,20 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, GivenBarrierEncodingWhenCallingGetBarr
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, GivenVariousValuesWhenCallingCalculateAvailableThreadCountThenCorrectValueIsReturned) {
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
auto result = hwHelper.calculateAvailableThreadCount(
|
||||
hardwareInfo.platform.eProductFamily,
|
||||
0,
|
||||
hardwareInfo.gtSystemInfo.EUCount,
|
||||
hardwareInfo.gtSystemInfo.ThreadCount / hardwareInfo.gtSystemInfo.EUCount);
|
||||
auto result = hwHelper.calculateAvailableThreadCount(hardwareInfo, 0);
|
||||
EXPECT_EQ(hardwareInfo.gtSystemInfo.ThreadCount, result);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, GivenModifiedGtSystemInfoWhenCallingCalculateAvailableThreadCountThenCorrectValueIsReturned) {
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
auto hwInfo = hardwareInfo;
|
||||
for (auto threadCount : {1u, 5u, 9u}) {
|
||||
hwInfo.gtSystemInfo.ThreadCount = threadCount;
|
||||
auto result = hwHelper.calculateAvailableThreadCount(hwInfo, 0);
|
||||
EXPECT_EQ(threadCount, result);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsOffsetToSkipSetFFIDGPWARequiredCalledThenFalseIsReturned) {
|
||||
if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
|
||||
GTEST_SKIP();
|
||||
@ -1481,3 +1487,30 @@ using LogicalStateHelperTest = ::testing::Test;
|
||||
HWTEST_F(LogicalStateHelperTest, whenCreatingLogicalStateHelperThenReturnNullptr) {
|
||||
EXPECT_EQ(nullptr, LogicalStateHelper::create<FamilyType>());
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTest, GivenVariousValuesAndXeHpAndLaterPlatformsWhenCallingCalculateAvailableThreadCountThenCorrectValueIsReturned, ATSOrDG2) {
|
||||
std::array<std::pair<uint32_t, uint32_t>, 3> grfTestInputs = {{{64, 8},
|
||||
{128, 8},
|
||||
{256, 4}}};
|
||||
|
||||
const auto &hwInfo = *defaultHwInfo;
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
for (const auto &[grfCount, expectedThreadCountPerEu] : grfTestInputs) {
|
||||
auto expected = expectedThreadCountPerEu * hwInfo.gtSystemInfo.EUCount;
|
||||
auto result = hwHelper.calculateAvailableThreadCount(hwInfo, grfCount);
|
||||
EXPECT_EQ(expected, result);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTest, GivenModifiedGtSystemInfoAndXeHpAndLaterPlatformsWhenCallingCalculateAvailableThreadCountThenCorrectValueIsReturned, ATSOrDG2) {
|
||||
std::array<std::tuple<uint32_t, uint32_t, uint32_t>, 3> testInputs = {{{1, 64, 1},
|
||||
{5, 128, 5},
|
||||
{8, 256, 4}}};
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
auto hwInfo = hardwareInfo;
|
||||
for (const auto &[threadCount, grfCount, expectedThreadCount] : testInputs) {
|
||||
hwInfo.gtSystemInfo.ThreadCount = threadCount;
|
||||
auto result = hwHelper.calculateAvailableThreadCount(hwInfo, grfCount);
|
||||
EXPECT_EQ(expectedThreadCount, result);
|
||||
}
|
||||
}
|
||||
|
@ -45,34 +45,34 @@ HWTEST2_F(HwHelperTestPvcAndLater, givenRenderEngineWhenRemapCalledThenUseCccs,
|
||||
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, EngineHelpers::remapEngineTypeToHwSpecific(aub_stream::EngineType::ENGINE_BCS, hardwareInfo));
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, GivenVariousValuesWhenCallingCalculateAvailableThreadCountThenCorrectValueIsReturned, IsAtLeastXeHpcCore) {
|
||||
struct TestInput {
|
||||
uint32_t grfCount;
|
||||
uint32_t expectedThreadCountPerEu;
|
||||
};
|
||||
|
||||
std::vector<TestInput> grfTestInputs = {
|
||||
{64, 16},
|
||||
{96, 10},
|
||||
{128, 8},
|
||||
{160, 6},
|
||||
{192, 5},
|
||||
{256, 4},
|
||||
};
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, GivenVariousValuesAndPvcAndLaterPlatformsWhenCallingCalculateAvailableThreadCountThenCorrectValueIsReturned, IsAtLeastXeHpcCore) {
|
||||
std::array<std::pair<uint32_t, uint32_t>, 6> grfTestInputs = {{{64, 16},
|
||||
{96, 10},
|
||||
{128, 8},
|
||||
{160, 6},
|
||||
{192, 5},
|
||||
{256, 4}}};
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
|
||||
for (auto &testInput : grfTestInputs) {
|
||||
auto expected = testInput.expectedThreadCountPerEu * hardwareInfo.gtSystemInfo.EUCount;
|
||||
auto result = hwHelper.calculateAvailableThreadCount(
|
||||
hardwareInfo.platform.eProductFamily,
|
||||
testInput.grfCount,
|
||||
hardwareInfo.gtSystemInfo.EUCount,
|
||||
hardwareInfo.gtSystemInfo.ThreadCount / hardwareInfo.gtSystemInfo.EUCount);
|
||||
for (const auto &[grfCount, expectedThreadCountPerEu] : grfTestInputs) {
|
||||
auto expected = expectedThreadCountPerEu * hardwareInfo.gtSystemInfo.EUCount;
|
||||
auto result = hwHelper.calculateAvailableThreadCount(hardwareInfo, grfCount);
|
||||
EXPECT_EQ(expected, result);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, GivenModifiedGtSystemInfoAndPvcAndLaterPlatformsWhenCallingCalculateAvailableThreadCountThenCorrectValueIsReturned, IsAtLeastXeHpcCore) {
|
||||
std::array<std::pair<uint32_t, uint32_t>, 3> testInputs = {{{64, 256},
|
||||
{96, 384},
|
||||
{128, 512}}};
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
auto hwInfo = hardwareInfo;
|
||||
for (const auto &[euCount, expectedThreadCount] : testInputs) {
|
||||
hwInfo.gtSystemInfo.EUCount = euCount;
|
||||
auto result = hwHelper.calculateAvailableThreadCount(hwInfo, 256);
|
||||
EXPECT_EQ(expectedThreadCount, result);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTestPvcAndLater, givenHwHelperWhenCheckIsUpdateTaskCountFromWaitSupportedThenReturnsTrue, IsAtLeastXeHpcCore) {
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
|
||||
|
Reference in New Issue
Block a user