@@ -20,12 +20,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMHostAlloc(ur_context_handle_t hContext,
2020 const ur_usm_desc_t *,
2121 ur_usm_pool_handle_t ,
2222 size_t size, void **ppMem) {
23- auto Res = olMemAlloc (hContext->Device ->OffloadDevice , OL_ALLOC_TYPE_HOST ,
24- size, ppMem);
25-
26- if (Res != OL_SUCCESS ) {
27- return offloadResultToUR (Res);
28- }
23+ OL_RETURN_ON_ERR (olMemAlloc (hContext->Device ->OffloadDevice ,
24+ OL_ALLOC_TYPE_HOST , size, ppMem));
2925
3026 hContext->AllocTypeMap .insert_or_assign (*ppMem, OL_ALLOC_TYPE_HOST );
3127 return UR_RESULT_SUCCESS ;
@@ -34,12 +30,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMHostAlloc(ur_context_handle_t hContext,
3430UR_APIEXPORT ur_result_t UR_APICALL urUSMDeviceAlloc (
3531 ur_context_handle_t hContext, ur_device_handle_t , const ur_usm_desc_t *,
3632 ur_usm_pool_handle_t , size_t size, void **ppMem) {
37- auto Res = olMemAlloc (hContext->Device ->OffloadDevice , OL_ALLOC_TYPE_DEVICE ,
38- size, ppMem);
39-
40- if (Res != OL_SUCCESS ) {
41- return offloadResultToUR (Res);
42- }
33+ OL_RETURN_ON_ERR (olMemAlloc (hContext->Device ->OffloadDevice ,
34+ OL_ALLOC_TYPE_DEVICE , size, ppMem));
4335
4436 hContext->AllocTypeMap .insert_or_assign (*ppMem, OL_ALLOC_TYPE_DEVICE );
4537 return UR_RESULT_SUCCESS ;
@@ -48,12 +40,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMDeviceAlloc(
4840UR_APIEXPORT ur_result_t UR_APICALL urUSMSharedAlloc (
4941 ur_context_handle_t hContext, ur_device_handle_t , const ur_usm_desc_t *,
5042 ur_usm_pool_handle_t , size_t size, void **ppMem) {
51- auto Res = olMemAlloc (hContext->Device ->OffloadDevice , OL_ALLOC_TYPE_MANAGED ,
52- size, ppMem);
53-
54- if (Res != OL_SUCCESS ) {
55- return offloadResultToUR (Res);
56- }
43+ OL_RETURN_ON_ERR (olMemAlloc (hContext->Device ->OffloadDevice ,
44+ OL_ALLOC_TYPE_MANAGED , size, ppMem));
5745
5846 hContext->AllocTypeMap .insert_or_assign (*ppMem, OL_ALLOC_TYPE_MANAGED );
5947 return UR_RESULT_SUCCESS ;
0 commit comments