Skip to content

Commit e31edfc

Browse files
committed
lock added
1 parent f82218c commit e31edfc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

unified-runtime/source/adapters/level_zero/image_common.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,15 @@ ur_result_t urBindlessImagesUnsampledImageHandleDestroyExp(
470470

471471
UR_ASSERT(hContext && hDevice && hImage, UR_RESULT_ERROR_INVALID_NULL_HANDLE);
472472

473+
std::shared_lock<ur_shared_mutex> Lock(hDevice->Mutex);
473474
auto item = hDevice->ZeOffsetToImageHandleMap.find(hImage);
474475

475476
if (item != hDevice->ZeOffsetToImageHandleMap.end()) {
476477
ZE2UR_CALL(zeImageDestroy, (item->second));
477478
hDevice->ZeOffsetToImageHandleMap.erase(item);
479+
Lock.release();
478480
} else {
481+
Lock.release();
479482
return UR_RESULT_ERROR_INVALID_NULL_HANDLE;
480483
}
481484

@@ -790,8 +793,9 @@ ur_result_t urBindlessImagesMapExternalLinearMemoryExp(
790793
allocDesc.pNext = externalMemoryData->importExtensionDesc;
791794
void *mappedMemory;
792795

793-
ze_result_t zeResult = zeMemAllocDevice(hContext->getZeHandle(), &allocDesc, size,
794-
1, hDevice->ZeDevice, &mappedMemory);
796+
ze_result_t zeResult =
797+
zeMemAllocDevice(hContext->getZeHandle(), &allocDesc, size, 1,
798+
hDevice->ZeDevice, &mappedMemory);
795799
if (zeResult != ZE_RESULT_SUCCESS) {
796800
return UR_RESULT_ERROR_OUT_OF_RESOURCES;
797801
}

0 commit comments

Comments
 (0)