File tree 2 files changed +10
-0
lines changed
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,9 @@ struct ur_device_handle_t_ {
114
114
bool maxLocalMemSizeChosen () { return MaxLocalMemSizeChosen; };
115
115
116
116
uint32_t getNumComputeUnits () const noexcept { return NumComputeUnits; };
117
+
118
+ // bookkeeping for mipmappedArray leaks in Mapping external Memory
119
+ std::map<CUarray, CUmipmappedArray> ChildCuarrayFromMipmapMap;
117
120
};
118
121
119
122
int getAttribute (ur_device_handle_t Device, CUdevice_attribute Attribute);
Original file line number Diff line number Diff line change @@ -430,6 +430,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageFreeExp(
430
430
ScopedContext Active (hDevice);
431
431
try {
432
432
UR_CHECK_ERROR (cuArrayDestroy ((CUarray)hImageMem));
433
+ if (auto it = hDevice->ChildCuarrayFromMipmapMap .find ((CUarray)hImageMem);
434
+ it != hDevice->ChildCuarrayFromMipmapMap .end ()) {
435
+ UR_CHECK_ERROR (cuMipmappedArrayDestroy ((CUmipmappedArray)it->second ));
436
+ hDevice->ChildCuarrayFromMipmapMap .erase (it);
437
+ }
433
438
} catch (ur_result_t Err) {
434
439
return Err;
435
440
} catch (...) {
@@ -1104,6 +1109,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp(
1104
1109
CUarray memArray;
1105
1110
UR_CHECK_ERROR (cuMipmappedArrayGetLevel (&memArray, memMipMap, 0 ));
1106
1111
1112
+ hDevice->ChildCuarrayFromMipmapMap .emplace (memArray, memMipMap);
1113
+
1107
1114
*phImageMem = (ur_exp_image_mem_native_handle_t )memArray;
1108
1115
}
1109
1116
You can’t perform that action at this time.
0 commit comments