Skip to content

Commit 4e9afb3

Browse files
refactor: Fix coverage issue with parse ccs mode
Signed-off-by: Aravind Gopalakrishnan <[email protected]>
1 parent 520dc15 commit 4e9afb3

File tree

3 files changed

+57
-42
lines changed

3 files changed

+57
-42
lines changed

shared/source/xe_hpc_core/pvc/os_agnostic_product_helper_pvc.inl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const RootDev
147147

148148
template <>
149149
void ProductHelperHw<gfxProduct>::parseCcsMode(std::string ccsModeString, std::unordered_map<uint32_t, uint32_t> &rootDeviceNumCcsMap, uint32_t rootDeviceIndex, RootDeviceEnvironment *rootDeviceEnvironment) const {
150-
151150
auto numberOfCcsEntries = StringHelpers::split(ccsModeString, ",");
152151

153152
for (const auto &entry : numberOfCcsEntries) {

shared/test/unit_test/device/neo_device_tests.cpp

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,38 @@ HWCMDTEST_F(IGFX_XE_HPC_CORE, DeviceTests, givenDeviceIsCreatedWithMalformedZexN
794794
}
795795
}
796796

797+
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenDeviceIsCreatedWithZexNumberOfCssEnvVariableDefinedForXeHpAndHwInfoCcsCountIsSetToDefaultWhenAdjustCcsCountForSpecificRootDeviceIsInvokedThenVerifyHwInfoCcsCountIsRestoredForAllDevices) {
798+
799+
VariableBackup<UltHwConfig> backup(&ultHwConfig);
800+
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
801+
DebugManagerStateRestore restorer;
802+
803+
debugManager.flags.ZEX_NUMBER_OF_CCS.set("2");
804+
debugManager.flags.SetCommandStreamReceiver.set(1);
805+
806+
auto hwInfo = *defaultHwInfo;
807+
808+
MockExecutionEnvironment executionEnvironment(&hwInfo, false, 2);
809+
executionEnvironment.incRefInternal();
810+
811+
UltDeviceFactory deviceFactory{2, 0, executionEnvironment};
812+
{
813+
auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
814+
hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
815+
816+
executionEnvironment.adjustCcsCount(0);
817+
EXPECT_EQ(std::min(2u, defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled), hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
818+
}
819+
820+
{
821+
auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[1]->getMutableHardwareInfo();
822+
hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
823+
824+
executionEnvironment.adjustCcsCount(1);
825+
EXPECT_EQ(std::min(2u, defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled), hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
826+
}
827+
}
828+
797829
HWCMDTEST_F(IGFX_XE_HPC_CORE, DeviceTests, givenDeviceIsCreatedWithZexNumberOfCssEnvVariableDefinedAndHwInfoCcsCountIsSetToDefaultWhenAdjustCcsCountForSpecificRootDeviceIsInvokedThenVerifyHwInfoCcsCountIsRestored) {
798830

799831
VariableBackup<UltHwConfig> backup(&ultHwConfig);
@@ -884,46 +916,7 @@ HWCMDTEST_F(IGFX_XE_HPC_CORE, DeviceTests, givenZexNumberOfCssAndZeAffinityMaskS
884916
}
885917
}
886918

887-
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZeAffinityMaskSetAndTilesAsDevicesModelForXeHpThenProperSubDeviceHierarchyMapisSet) {
888-
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZE_FLAT_DEVICE_HIERARCHY", "FLAT"}};
889-
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
890-
VariableBackup<UltHwConfig> backup(&ultHwConfig);
891-
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
892-
DebugManagerStateRestore restorer;
893-
894-
uint32_t numRootDevices = 4;
895-
uint32_t numSubDevices = 4;
896-
897-
debugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
898-
debugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
899-
900-
uint32_t expectedRootDevices = 4;
901-
debugManager.flags.ZE_AFFINITY_MASK.set("0,3,4,1.1,9,15,25");
902-
903-
debugManager.flags.SetCommandStreamReceiver.set(1);
904-
905-
auto hwInfo = *defaultHwInfo;
906-
907-
MockExecutionEnvironment executionEnvironment(&hwInfo, false, numRootDevices);
908-
executionEnvironment.incRefInternal();
909-
910-
auto devices = DeviceFactory::createDevices(executionEnvironment);
911-
EXPECT_EQ(devices.size(), expectedRootDevices);
912-
std::vector<uint32_t> expectedRootDeviceIndices = {0, 0, 1, 2};
913-
std::vector<uint32_t> expectedSubDeviceIndices = {0, 3, 0, 1};
914-
for (uint32_t i = 0u; i < devices.size(); i++) {
915-
std::tuple<uint32_t, uint32_t, uint32_t> subDeviceMap;
916-
EXPECT_TRUE(executionEnvironment.getSubDeviceHierarchy(i, &subDeviceMap));
917-
auto hwRootDeviceIndex = std::get<0>(subDeviceMap);
918-
auto hwSubDeviceIndex = std::get<1>(subDeviceMap);
919-
auto hwSubDevicesCount = std::get<2>(subDeviceMap);
920-
EXPECT_EQ(hwRootDeviceIndex, expectedRootDeviceIndices[i]);
921-
EXPECT_EQ(hwSubDeviceIndex, expectedSubDeviceIndices[i]);
922-
EXPECT_EQ(hwSubDevicesCount, numSubDevices);
923-
}
924-
}
925-
926-
HWCMDTEST_F(IGFX_XE_HPC_CORE, DeviceTests, givenZeAffinityMaskSetAndTilesAsDevicesModelThenProperSubDeviceHierarchyMapisSet) {
919+
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZeAffinityMaskSetAndTilesAsDevicesModelThenProperSubDeviceHierarchyMapisSet) {
927920
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZE_FLAT_DEVICE_HIERARCHY", "FLAT"}};
928921
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
929922
VariableBackup<UltHwConfig> backup(&ultHwConfig);

shared/test/unit_test/xe_hpc_core/pvc/device_tests_pvc.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022-2023 Intel Corporation
2+
* Copyright (C) 2022-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -46,6 +46,29 @@ PVCTEST_F(DeviceTestsPvc, WhenDeviceIsCreatedThenOnlyOneCcsEngineIsExposed) {
4646
EXPECT_EQ(1u, computeEngineGroup.engines.size());
4747
}
4848

49+
PVCTEST_F(DeviceTestsPvc, givenZexNumberOfCssEnvVariableDefinedForXeHpcWhenSingleDeviceIsCreatedThenCreateDevicesWithProperCcsCount) {
50+
VariableBackup<UltHwConfig> backup(&ultHwConfig);
51+
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
52+
DebugManagerStateRestore restorer;
53+
54+
debugManager.flags.ZEX_NUMBER_OF_CCS.set("0:4");
55+
debugManager.flags.SetCommandStreamReceiver.set(1);
56+
57+
auto hwInfo = *defaultHwInfo;
58+
59+
MockExecutionEnvironment executionEnvironment(&hwInfo, false, 1);
60+
executionEnvironment.incRefInternal();
61+
UltDeviceFactory deviceFactory{1, 0, executionEnvironment};
62+
63+
{
64+
auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
65+
hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
66+
67+
executionEnvironment.adjustCcsCount();
68+
EXPECT_EQ(std::min(4u, defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled), hardwareInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
69+
}
70+
}
71+
4972
struct MemoryManagerDirectSubmissionImplicitScalingPvcTest : public ::testing::Test {
5073

5174
void SetUp() override {

0 commit comments

Comments
 (0)