fix: use regular engine for HP copy engine if no HP engine

- map HIGH PRIORTY queues to regular engine for copy engine if there is
no HP copy engine available

Related-To: NEO-11983

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe 2024-07-26 15:44:23 +00:00 committed by Compute-Runtime-Automation
parent 85df385582
commit a734a738fa
2 changed files with 32 additions and 2 deletions

View File

@ -1720,7 +1720,9 @@ ze_result_t DeviceImp::getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr
}
if (copyOnly && contextPriority == NEO::EngineUsage::highPriority) {
getCsrForHighPriority(csr, copyOnly);
if (getCsrForHighPriority(csr, copyOnly) != ZE_RESULT_SUCCESS) {
contextPriority = NEO::EngineUsage::regular;
}
}
auto &osContext = (*csr)->getOsContext();

View File

@ -4635,6 +4635,15 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor
engines.push_back({aub_stream::ENGINE_RCS, EngineUsage::regular});
}
for (uint32_t i = 1; i < hwInfo.featureTable.ftrBcsInfo.size(); i++) {
auto engineType = EngineHelpers::getBcsEngineAtIdx(i);
if (hwInfo.featureTable.ftrBcsInfo.test(i)) {
engines.push_back({engineType, EngineUsage::regular});
}
}
return engines;
}
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const override {
@ -4644,6 +4653,10 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor
if (engineType >= aub_stream::ENGINE_CCS && engineType < (aub_stream::ENGINE_CCS + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled)) {
return EngineGroupType::compute;
}
if (engineType == aub_stream::ENGINE_BCS1) {
return EngineGroupType::copy;
}
UNRECOVERABLE_IF(true);
}
};
@ -4656,6 +4669,8 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor
hwInfo.featureTable.flags.ftrCCSNode = true;
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2;
hwInfo.featureTable.ftrBcsInfo = 0b10;
hwInfo.capabilityTable.blitterOperationsSupported = true;
MockExecutionEnvironment mockExecutionEnvironment{&hwInfo};
RAIIGfxCoreHelperFactory<MockGfxCoreHelper> raii(*mockExecutionEnvironment.rootDeviceEnvironments[rootDeviceIndex]);
@ -4671,15 +4686,19 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor
auto &engineGroups = neoMockDevice->getRegularEngineGroups();
uint32_t count = static_cast<uint32_t>(engineGroups.size());
auto ordinal = 0u;
auto ordinalCopy = 0u;
for (uint32_t i = 0; i < count; i++) {
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::compute) {
ordinal = i;
break;
}
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::copy) {
ordinalCopy = i;
}
}
ASSERT_TRUE(engineGroups[ordinal].engineGroupType == NEO::EngineGroupType::compute);
ASSERT_TRUE(engineGroups[ordinalCopy].engineGroupType == NEO::EngineGroupType::copy);
uint32_t index = 1;
auto result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, false);
@ -4715,6 +4734,15 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor
ordinal = 100;
result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, false);
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, result);
// When no HP copy engine, then regular engine is returned
NEO::CommandStreamReceiver *bcsEngine = nullptr;
EXPECT_EQ(nullptr, neoMockDevice->getHpCopyEngine());
result = deviceImp.getCsrForOrdinalAndIndex(&bcsEngine, ordinalCopy, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, false);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
ASSERT_NE(nullptr, bcsEngine);
EXPECT_TRUE(bcsEngine->getOsContext().isRegular());
}
}