mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
feature: create secondary contexts for different engine types
Related-To: NEO-7824 Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a2a154ba4a
commit
913d5dc3b1
@@ -604,4 +604,5 @@ ReadOnlyAllocationsTypeMask = 0
|
||||
EnableLogLevel = 6
|
||||
EnableReusingGpuTimestamps = 0
|
||||
ForceCopyOperationOffloadForComputeCmdList = -1
|
||||
SecondaryContextEngineTypeMask = -1
|
||||
# Please don't edit below this line
|
||||
|
||||
@@ -1373,5 +1373,84 @@ HWTEST_F(DeviceTests, givenContextGroupEnabledAndAllocationUsedBySeconadryContex
|
||||
|
||||
EXPECT_EQ(0u, memoryManager->secondaryEngines[0].size());
|
||||
EXPECT_EQ(0u, memoryManager->allRegisteredEngines[0].size());
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceTests, givenCopyEnginesWhenCreatingSecondaryContextsThenUseCopyTypes) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
debugManager.flags.ContextGroupSize.set(5);
|
||||
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
hwInfo.featureTable.ftrBcsInfo = 0b1111;
|
||||
|
||||
auto executionEnvironment = NEO::MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
|
||||
executionEnvironment->incRefInternal();
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0));
|
||||
auto &gfxCoreHelper = device->getRootDeviceEnvironment().getHelper<GfxCoreHelper>();
|
||||
|
||||
auto memoryManager = static_cast<MockMemoryManager *>(executionEnvironment->memoryManager.get());
|
||||
|
||||
auto &enabledEngines = gfxCoreHelper.getGpgpuEngineInstances(device->getRootDeviceEnvironment());
|
||||
|
||||
for (auto engineType : {aub_stream::EngineType::ENGINE_BCS, aub_stream::EngineType::ENGINE_BCS1, aub_stream::EngineType::ENGINE_BCS2, aub_stream::EngineType::ENGINE_BCS3}) {
|
||||
auto supported = std::find_if(enabledEngines.begin(), enabledEngines.end(),
|
||||
[&engineType](const auto &engine) { return (engine.first == engineType) && (engine.second == EngineUsage::regular); }) != enabledEngines.end();
|
||||
|
||||
if (supported) {
|
||||
EXPECT_NE(device->secondaryEngines.end(), device->secondaryEngines.find(engineType));
|
||||
EXPECT_EQ(5u, device->secondaryEngines[engineType].engines.size());
|
||||
|
||||
auto engine = device->getSecondaryEngineCsr({engineType, EngineUsage::regular});
|
||||
ASSERT_NE(nullptr, engine);
|
||||
|
||||
auto csr = engine->commandStreamReceiver;
|
||||
auto engine2 = device->getSecondaryEngineCsr({engineType, EngineUsage::regular});
|
||||
ASSERT_NE(nullptr, engine2);
|
||||
|
||||
auto csr2 = engine2->commandStreamReceiver;
|
||||
ASSERT_NE(csr, csr2);
|
||||
|
||||
auto tagAddress = csr->getTagAddress();
|
||||
auto tagAddress2 = csr2->getTagAddress();
|
||||
|
||||
EXPECT_NE(csr->getOsContext().getContextId(), csr2->getOsContext().getContextId());
|
||||
EXPECT_NE(tagAddress, tagAddress2);
|
||||
} else {
|
||||
EXPECT_EQ(device->secondaryEngines.end(), device->secondaryEngines.find(engineType));
|
||||
}
|
||||
}
|
||||
|
||||
device.reset(nullptr);
|
||||
|
||||
EXPECT_EQ(0u, memoryManager->secondaryEngines[0].size());
|
||||
EXPECT_EQ(0u, memoryManager->allRegisteredEngines[0].size());
|
||||
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceTests, givenDebugFlagSetWhenCreatingSecondaryEnginesThenSkipSelectedEngineTypes) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
if (hwInfo.capabilityTable.defaultEngineType != aub_stream::EngineType::ENGINE_CCS) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
uint32_t computeEngineBit = 1 << static_cast<uint32_t>(aub_stream::EngineType::ENGINE_CCS);
|
||||
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
debugManager.flags.ContextGroupSize.set(5);
|
||||
debugManager.flags.SecondaryContextEngineTypeMask.set(~computeEngineBit);
|
||||
|
||||
hwInfo.featureTable.flags.ftrCCSNode = true;
|
||||
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
|
||||
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
|
||||
|
||||
auto executionEnvironment = NEO::MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
|
||||
executionEnvironment->incRefInternal();
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0));
|
||||
|
||||
EXPECT_EQ(device->secondaryEngines.end(), device->secondaryEngines.find(aub_stream::ENGINE_CCS));
|
||||
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
Reference in New Issue
Block a user