Skip to content

Commit 8f8370b

Browse files
Limit number of CCS engines on PVC
Expose only one CCS engine Related-To: NEO-7195 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 6aec85f commit 8f8370b

File tree

8 files changed

+66
-0
lines changed

8 files changed

+66
-0
lines changed

shared/source/execution_environment/execution_environment.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,14 @@ void ExecutionEnvironment::parseAffinityMask() {
199199

200200
rootDeviceEnvironments.swap(filteredEnvironments);
201201
}
202+
203+
void ExecutionEnvironment::adjustCcsCount() const {
204+
for (auto &rootDeviceEnvironment : rootDeviceEnvironments) {
205+
UNRECOVERABLE_IF(!rootDeviceEnvironment);
206+
auto hwInfo = rootDeviceEnvironment->getMutableHardwareInfo();
207+
auto hwInfoConfig = HwInfoConfig::get(hwInfo->platform.eProductFamily);
208+
hwInfoConfig->adjustNumberOfCcs(*hwInfo);
209+
}
210+
}
211+
202212
} // namespace NEO

shared/source/execution_environment/execution_environment.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
2727
virtual void prepareRootDeviceEnvironments(uint32_t numRootDevices);
2828
void prepareRootDeviceEnvironment(const uint32_t rootDeviceIndexForReInit);
2929
void parseAffinityMask();
30+
void adjustCcsCount() const;
3031
void sortNeoDevices();
3132
void sortNeoDevicesDRM();
3233
void sortNeoDevicesWDDM();

shared/source/os_interface/device_factory.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
9999
}
100100

101101
executionEnvironment.parseAffinityMask();
102+
executionEnvironment.adjustCcsCount();
102103
executionEnvironment.calculateMaxOsContextCount();
103104
return true;
104105
}
@@ -158,6 +159,7 @@ bool DeviceFactory::prepareDeviceEnvironments(ExecutionEnvironment &executionEnv
158159

159160
executionEnvironment.sortNeoDevices();
160161
executionEnvironment.parseAffinityMask();
162+
executionEnvironment.adjustCcsCount();
161163
executionEnvironment.calculateMaxOsContextCount();
162164

163165
return true;

shared/source/os_interface/hw_info_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class HwInfoConfig {
132132
virtual bool isAssignEngineRoundRobinSupported() const = 0;
133133
virtual uint32_t getL1CachePolicy() const = 0;
134134
virtual bool isEvictionWhenNecessaryFlagSupported() const = 0;
135+
virtual void adjustNumberOfCcs(HardwareInfo &hwInfo) const = 0;
135136

136137
MOCKABLE_VIRTUAL ~HwInfoConfig() = default;
137138

@@ -234,6 +235,7 @@ class HwInfoConfigHw : public HwInfoConfig {
234235
bool isAssignEngineRoundRobinSupported() const override;
235236
uint32_t getL1CachePolicy() const override;
236237
bool isEvictionWhenNecessaryFlagSupported() const override;
238+
void adjustNumberOfCcs(HardwareInfo &hwInfo) const override;
237239

238240
protected:
239241
HwInfoConfigHw() = default;

shared/source/os_interface/hw_info_config.inl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,4 +480,6 @@ uint32_t HwInfoConfigHw<gfxProduct>::getL1CachePolicy() const {
480480
return L1CachePolicyHelper<gfxProduct>::getL1CachePolicy();
481481
}
482482

483+
template <PRODUCT_FAMILY gfxProduct>
484+
void HwInfoConfigHw<gfxProduct>::adjustNumberOfCcs(HardwareInfo &hwInfo) const {}
483485
} // namespace NEO

shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,9 @@ bool HwInfoConfigHw<gfxProduct>::isComputeDispatchAllWalkerEnableInCfeStateRequi
193193
template <>
194194
bool HwInfoConfigHw<gfxProduct>::isIpSamplingSupported(const HardwareInfo &hwInfo) const {
195195
return PVC::isXt(hwInfo);
196+
}
197+
198+
template <>
199+
void HwInfoConfigHw<gfxProduct>::adjustNumberOfCcs(HardwareInfo &hwInfo) const {
200+
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
196201
}

shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ if(TESTS_PVC)
88
set(NEO_SHARED_TESTS_PVC
99
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
1010
${CMAKE_CURRENT_SOURCE_DIR}/device_binary_format_ar_tests_pvc.cpp
11+
${CMAKE_CURRENT_SOURCE_DIR}/device_tests_pvc.cpp
1112
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_walker_tests_pvc.cpp
1213
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_pvc.cpp
1314
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_tests_pvc.cpp
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (C) 2022 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/source/xe_hpc_core/hw_cmds_pvc.h"
9+
#include "shared/test/common/helpers/debug_manager_state_restore.h"
10+
#include "shared/test/common/helpers/default_hw_info.h"
11+
#include "shared/test/common/helpers/ult_hw_config.h"
12+
#include "shared/test/common/mocks/mock_device.h"
13+
#include "shared/test/common/mocks/mock_execution_environment.h"
14+
#include "shared/test/common/mocks/ult_device_factory.h"
15+
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
16+
#include "shared/test/common/test_macros/test.h"
17+
18+
using namespace NEO;
19+
20+
using DeviceTestsPvc = ::testing::Test;
21+
22+
PVCTEST_F(DeviceTestsPvc, WhenDeviceIsCreatedThenOnlyOneCcsEngineIsExposed) {
23+
VariableBackup<UltHwConfig> backup(&ultHwConfig);
24+
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
25+
DebugManagerStateRestore restorer;
26+
DebugManager.flags.SetCommandStreamReceiver.set(1);
27+
auto hwInfo = *defaultHwInfo;
28+
29+
hwInfo.featureTable.flags.ftrCCSNode = 1;
30+
hwInfo.gtSystemInfo.CCSInfo.IsValid = 1;
31+
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
32+
33+
MockExecutionEnvironment executionEnvironment(&hwInfo);
34+
executionEnvironment.incRefInternal();
35+
36+
UltDeviceFactory deviceFactory{1, 0, executionEnvironment};
37+
38+
auto device = deviceFactory.rootDevices[0];
39+
40+
auto computeEngineGroupIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
41+
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
42+
EXPECT_EQ(1u, computeEngineGroup.engines.size());
43+
}

0 commit comments

Comments
 (0)