Release main copy engine from device and sub device

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-09-20 13:04:31 +00:00
committed by Compute-Runtime-Automation
parent 4332563433
commit e00a5e0a1e
2 changed files with 33 additions and 1 deletions

View File

@ -355,7 +355,9 @@ CommandStreamReceiver &CommandQueue::selectCsrForHostPtrAllocation(bool split, C
void CommandQueue::releaseMainCopyEngine() {
if (auto mainBcs = bcsEngines[0]; mainBcs != nullptr) {
auto &selectorCopyEngine = device->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
auto &selectorCopyEngineSubDevice = device->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
EngineHelpers::releaseBcsEngineType(mainBcs->getEngineType(), selectorCopyEngineSubDevice);
auto &selectorCopyEngine = device->getSelectorCopyEngine();
EngineHelpers::releaseBcsEngineType(mainBcs->getEngineType(), selectorCopyEngine);
}
}

View File

@ -2640,6 +2640,36 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedCcsOsContextWhenC
EXPECT_TRUE(osContext.isInitialized());
}
TEST_F(MultiTileFixture, givenMultiSubDeviceAndCommandQueueUsingMainCopyEngineWhenReleaseMainCopyEngineThenDeviceAndSubdeviceSelectorReset) {
REQUIRE_BLITTER_OR_SKIP(defaultHwInfo.get());
auto device = platform()->getClDevice(0);
auto subDevice = device->getSubDevice(0);
const cl_device_id deviceId = device;
auto returnStatus = CL_SUCCESS;
auto context = clCreateContext(nullptr, 1, &deviceId, nullptr, nullptr, &returnStatus);
EXPECT_EQ(CL_SUCCESS, returnStatus);
EXPECT_NE(nullptr, context);
auto commandQueue = clCreateCommandQueueWithProperties(context, device, nullptr, &returnStatus);
EXPECT_EQ(CL_SUCCESS, returnStatus);
EXPECT_NE(nullptr, commandQueue);
auto neoQueue = castToObject<CommandQueue>(commandQueue);
device->getSelectorCopyEngine().isMainUsed.store(true);
subDevice->getSelectorCopyEngine().isMainUsed.store(true);
neoQueue->releaseMainCopyEngine();
EXPECT_FALSE(device->getSelectorCopyEngine().isMainUsed.load());
EXPECT_FALSE(subDevice->getSelectorCopyEngine().isMainUsed.load());
clReleaseCommandQueue(commandQueue);
clReleaseContext(context);
}
TEST_F(MultiTileFixture, givenSubDeviceWhenQueueIsCreatedThenItContainsProperDevice) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
defaultHwInfo->capabilityTable.blitterOperationsSupported = true;