Skip to content

Commit 5440c83

Browse files
Fix to acquire lock during migrating shared allocation via makeResident() call
This fix is required to guarentee thread safety Signed-off-by: Vinod Tipparaju <[email protected]>
1 parent 7ac97fd commit 5440c83

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

level_zero/core/source/cmdqueue/cmdqueue_hw.inl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
311311
}
312312

313313
if (performMigration) {
314-
for (auto alloc : static_cast<DriverHandleImp *>(device->getDriverHandle())->sharedMakeResidentAllocations) {
314+
DriverHandleImp *driverHandleImp = static_cast<DriverHandleImp *>(device->getDriverHandle());
315+
std::lock_guard<std::mutex> lock(driverHandleImp->sharedMakeResidentAllocationsLock);
316+
for (auto alloc : driverHandleImp->sharedMakeResidentAllocations) {
315317
pageFaultManager->moveAllocationToGpuDomain(reinterpret_cast<void *>(alloc.second->getGpuAddress()));
316318
}
317319
}

0 commit comments

Comments
 (0)