Skip to content

Commit 8000133

Browse files
refactor: add method to adjust regular context count
Related-To: NEO-12258 Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent 2f4d240 commit 8000133

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

shared/source/device/device.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ bool Device::createEngines() {
407407
highPriorityContextCount = highPriorityContextCount / hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
408408
}
409409

410+
if (engineGroupType == EngineGroupType::copy || engineGroupType == EngineGroupType::linkedCopy) {
411+
gfxCoreHelper.adjustCopyEngineRegularContextCount(engineGroup->engines.size(), contextCount);
412+
}
413+
410414
for (uint32_t engineIndex = 0; engineIndex < static_cast<uint32_t>(engineGroup->engines.size()); engineIndex++) {
411415
auto engineType = engineGroup->engines[engineIndex].getEngineType();
412416

shared/source/helpers/gfx_core_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class GfxCoreHelper {
179179
virtual bool areSecondaryContextsSupported() const = 0;
180180
virtual uint32_t getContextGroupContextsCount() const = 0;
181181
virtual uint32_t getContextGroupHpContextsCount(EngineGroupType type, bool hpEngineAvailable) const = 0;
182+
virtual void adjustCopyEngineRegularContextCount(const size_t enginesCount, uint32_t &contextCount) const = 0;
182183
virtual aub_stream::EngineType getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const = 0;
183184
virtual void initializeDefaultHpCopyEngine(const HardwareInfo &hwInfo) = 0;
184185

@@ -412,6 +413,7 @@ class GfxCoreHelperHw : public GfxCoreHelper {
412413
bool areSecondaryContextsSupported() const override;
413414
uint32_t getContextGroupContextsCount() const override;
414415
uint32_t getContextGroupHpContextsCount(EngineGroupType type, bool hpEngineAvailable) const override;
416+
void adjustCopyEngineRegularContextCount(const size_t enginesCount, uint32_t &contextCount) const override;
415417
aub_stream::EngineType getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const override;
416418
void initializeDefaultHpCopyEngine(const HardwareInfo &hwInfo) override;
417419

shared/source/helpers/gfx_core_helper_base.inl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,10 @@ uint32_t GfxCoreHelperHw<GfxFamily>::getContextGroupHpContextsCount(EngineGroupT
720720
return std::min(getContextGroupContextsCount() / 2, 4u);
721721
}
722722

723+
template <typename GfxFamily>
724+
void GfxCoreHelperHw<GfxFamily>::adjustCopyEngineRegularContextCount(const size_t enginesCount, uint32_t &contextCount) const {
725+
}
726+
723727
template <typename GfxFamily>
724728
aub_stream::EngineType GfxCoreHelperHw<GfxFamily>::getDefaultHpCopyEngine(const HardwareInfo &hwInfo) const {
725729
return hpCopyEngineType;

shared/test/unit_test/device/neo_device_tests.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,13 @@ HWTEST_F(DeviceTests, givenCopyEnginesWhenCreatingSecondaryContextsThenUseCopyTy
17011701
if (supportedRegular || supportedHp) {
17021702
auto usage = supportedRegular ? EngineUsage::regular : EngineUsage::highPriority;
17031703
EXPECT_NE(device->secondaryEngines.end(), device->secondaryEngines.find(engineType));
1704-
EXPECT_EQ(5u, device->secondaryEngines[engineType].engines.size());
1704+
1705+
auto expectedEngineCount = 5u;
1706+
if (supportedRegular) {
1707+
gfxCoreHelper.adjustCopyEngineRegularContextCount(device->secondaryEngines[engineType].engines.size(), expectedEngineCount);
1708+
}
1709+
1710+
EXPECT_EQ(expectedEngineCount, device->secondaryEngines[engineType].engines.size());
17051711

17061712
auto engine = device->getSecondaryEngineCsr({engineType, usage}, false);
17071713
ASSERT_NE(nullptr, engine);

0 commit comments

Comments
 (0)