File tree 2 files changed +13
-10
lines changed
source/adapters/level_zero/v2
2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -115,10 +115,7 @@ ur_integrated_mem_handle_t::ur_integrated_mem_handle_t(
115
115
if (!ownHostPtr) {
116
116
return ;
117
117
}
118
- auto ret = hContext->getDefaultUSMPool ()->free (ptr);
119
- if (ret != UR_RESULT_SUCCESS) {
120
- logger::error (" Failed to free host memory: {}" , ret);
121
- }
118
+ ZE_CALL_NOCHECK (zeMemFree, (hContext->getZeHandle (), ptr));
122
119
});
123
120
}
124
121
@@ -234,10 +231,7 @@ ur_discrete_mem_handle_t::ur_discrete_mem_handle_t(
234
231
if (!ownZePtr) {
235
232
return ;
236
233
}
237
- auto ret = hContext->getDefaultUSMPool ()->free (ptr);
238
- if (ret != UR_RESULT_SUCCESS) {
239
- logger::error (" Failed to free device memory: {}" , ret);
240
- }
234
+ ZE_CALL_NOCHECK (zeMemFree, (hContext->getZeHandle (), ptr));
241
235
});
242
236
}
243
237
}
@@ -310,7 +304,10 @@ void *ur_discrete_mem_handle_t::mapHostPtr(
310
304
usm_unique_ptr_t mappedPtr =
311
305
usm_unique_ptr_t (ptr, [ownsAlloc = bool (mapToPtr), this ](void *p) {
312
306
if (ownsAlloc) {
313
- UR_CALL_THROWS (hContext->getDefaultUSMPool ()->free (p));
307
+ auto ret = hContext->getDefaultUSMPool ()->free (p);
308
+ if (ret != UR_RESULT_SUCCESS) {
309
+ logger::error (" Failed to mapped memory: {}" , ret);
310
+ }
314
311
}
315
312
});
316
313
Original file line number Diff line number Diff line change @@ -231,7 +231,13 @@ ur_result_t ur_usm_pool_handle_t_::allocate(
231
231
}
232
232
233
233
ur_result_t ur_usm_pool_handle_t_::free (void *ptr) {
234
- return umf::umf2urResult (umfFree (ptr));
234
+ auto umfPool = umfPoolByPtr (ptr);
235
+ if (umfPool) {
236
+ return umf::umf2urResult (umfPoolFree (umfPool, ptr));
237
+ } else {
238
+ logger::error (" Failed to find pool for pointer: {}" , ptr);
239
+ return UR_RESULT_ERROR_INVALID_VALUE;
240
+ }
235
241
}
236
242
237
243
namespace ur ::level_zero {
You can’t perform that action at this time.
0 commit comments