refactor: Fix coverage issue with parse ccs mode

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan
2025-03-19 20:38:53 +00:00
committed by Compute-Runtime-Automation
parent 520dc15889
commit 4e9afb32e6
3 changed files with 57 additions and 42 deletions

View File

@@ -794,6 +794,38 @@ HWCMDTEST_F(IGFX_XE_HPC_CORE, DeviceTests, givenDeviceIsCreatedWithMalformedZexN
}
}
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenDeviceIsCreatedWithZexNumberOfCssEnvVariableDefinedForXeHpAndHwInfoCcsCountIsSetToDefaultWhenAdjustCcsCountForSpecificRootDeviceIsInvokedThenVerifyHwInfoCcsCountIsRestoredForAllDevices) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
DebugManagerStateRestore restorer;
debugManager.flags.ZEX_NUMBER_OF_CCS.set("2");
debugManager.flags.SetCommandStreamReceiver.set(1);
auto hwInfo = *defaultHwInfo;
MockExecutionEnvironment executionEnvironment(&hwInfo, false, 2);
executionEnvironment.incRefInternal();
UltDeviceFactory deviceFactory{2, 0, executionEnvironment};
{
auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
executionEnvironment.adjustCcsCount(0);
EXPECT_EQ(std::min(2u, defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled), hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
}
{
auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[1]->getMutableHardwareInfo();
hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
executionEnvironment.adjustCcsCount(1);
EXPECT_EQ(std::min(2u, defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled), hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
}
}
HWCMDTEST_F(IGFX_XE_HPC_CORE, DeviceTests, givenDeviceIsCreatedWithZexNumberOfCssEnvVariableDefinedAndHwInfoCcsCountIsSetToDefaultWhenAdjustCcsCountForSpecificRootDeviceIsInvokedThenVerifyHwInfoCcsCountIsRestored) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
@@ -884,46 +916,7 @@ HWCMDTEST_F(IGFX_XE_HPC_CORE, DeviceTests, givenZexNumberOfCssAndZeAffinityMaskS
}
}
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZeAffinityMaskSetAndTilesAsDevicesModelForXeHpThenProperSubDeviceHierarchyMapisSet) {
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZE_FLAT_DEVICE_HIERARCHY", "FLAT"}};
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
DebugManagerStateRestore restorer;
uint32_t numRootDevices = 4;
uint32_t numSubDevices = 4;
debugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
debugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
uint32_t expectedRootDevices = 4;
debugManager.flags.ZE_AFFINITY_MASK.set("0,3,4,1.1,9,15,25");
debugManager.flags.SetCommandStreamReceiver.set(1);
auto hwInfo = *defaultHwInfo;
MockExecutionEnvironment executionEnvironment(&hwInfo, false, numRootDevices);
executionEnvironment.incRefInternal();
auto devices = DeviceFactory::createDevices(executionEnvironment);
EXPECT_EQ(devices.size(), expectedRootDevices);
std::vector<uint32_t> expectedRootDeviceIndices = {0, 0, 1, 2};
std::vector<uint32_t> expectedSubDeviceIndices = {0, 3, 0, 1};
for (uint32_t i = 0u; i < devices.size(); i++) {
std::tuple<uint32_t, uint32_t, uint32_t> subDeviceMap;
EXPECT_TRUE(executionEnvironment.getSubDeviceHierarchy(i, &subDeviceMap));
auto hwRootDeviceIndex = std::get<0>(subDeviceMap);
auto hwSubDeviceIndex = std::get<1>(subDeviceMap);
auto hwSubDevicesCount = std::get<2>(subDeviceMap);
EXPECT_EQ(hwRootDeviceIndex, expectedRootDeviceIndices[i]);
EXPECT_EQ(hwSubDeviceIndex, expectedSubDeviceIndices[i]);
EXPECT_EQ(hwSubDevicesCount, numSubDevices);
}
}
HWCMDTEST_F(IGFX_XE_HPC_CORE, DeviceTests, givenZeAffinityMaskSetAndTilesAsDevicesModelThenProperSubDeviceHierarchyMapisSet) {
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZeAffinityMaskSetAndTilesAsDevicesModelThenProperSubDeviceHierarchyMapisSet) {
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZE_FLAT_DEVICE_HIERARCHY", "FLAT"}};
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
VariableBackup<UltHwConfig> backup(&ultHwConfig);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2023 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -46,6 +46,29 @@ PVCTEST_F(DeviceTestsPvc, WhenDeviceIsCreatedThenOnlyOneCcsEngineIsExposed) {
EXPECT_EQ(1u, computeEngineGroup.engines.size());
}
PVCTEST_F(DeviceTestsPvc, givenZexNumberOfCssEnvVariableDefinedForXeHpcWhenSingleDeviceIsCreatedThenCreateDevicesWithProperCcsCount) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
DebugManagerStateRestore restorer;
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0:4");
debugManager.flags.SetCommandStreamReceiver.set(1);
auto hwInfo = *defaultHwInfo;
MockExecutionEnvironment executionEnvironment(&hwInfo, false, 1);
executionEnvironment.incRefInternal();
UltDeviceFactory deviceFactory{1, 0, executionEnvironment};
{
auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
executionEnvironment.adjustCcsCount();
EXPECT_EQ(std::min(4u, defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled), hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
}
}
struct MemoryManagerDirectSubmissionImplicitScalingPvcTest : public ::testing::Test {
void SetUp() override {