File tree Expand file tree Collapse file tree 7 files changed +55
-4
lines changed Expand file tree Collapse file tree 7 files changed +55
-4
lines changed Original file line number Diff line number Diff line change 2222
2323#include < cuda.h>
2424
25+ namespace umf {
26+ ur_result_t getProviderNativeError (const char *, int32_t ) {
27+ // TODO: implement when UMF supports CUDA
28+ return UR_RESULT_ERROR_UNKNOWN;
29+ }
30+ } // namespace umf
31+
2532// / USM: Implements USM Host allocations using CUDA Pinned Memory
2633// / https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#page-locked-host-memory
2734UR_APIEXPORT ur_result_t UR_APICALL
Original file line number Diff line number Diff line change 1818#include " ur_util.hpp"
1919#include " usm.hpp"
2020
21+ namespace umf {
22+ ur_result_t getProviderNativeError (const char *, int32_t ) {
23+ // TODO: implement when UMF supports HIP
24+ return UR_RESULT_ERROR_UNKNOWN;
25+ }
26+ } // namespace umf
27+
2128// / USM: Implements USM Host allocations using HIP Pinned Memory
2229UR_APIEXPORT ur_result_t UR_APICALL
2330urUSMHostAlloc (ur_context_handle_t hContext, const ur_usm_desc_t *pUSMDesc,
Original file line number Diff line number Diff line change 2323
2424#include < umf_helpers.hpp>
2525
26+ namespace umf {
27+ ur_result_t getProviderNativeError (const char *providerName,
28+ int32_t nativeError) {
29+ if (strcmp (providerName, " Level Zero" ) == 0 ) {
30+ return ze2urResult (static_cast <ze_result_t >(nativeError));
31+ }
32+
33+ return UR_RESULT_ERROR_UNKNOWN;
34+ }
35+ } // namespace umf
36+
2637usm::DisjointPoolAllConfigs DisjointPoolConfigInstance =
2738 InitializeDisjointPoolConfig ();
2839
Original file line number Diff line number Diff line change 1919#include < umf/pools/pool_proxy.h>
2020#include < umf/providers/provider_level_zero.h>
2121
22+ namespace umf {
23+ ur_result_t getProviderNativeError (const char *providerName,
24+ int32_t nativeError) {
25+ if (strcmp (providerName, " Level Zero" ) == 0 ) {
26+ return ze2urResult (static_cast <ze_result_t >(nativeError));
27+ }
28+
29+ return UR_RESULT_ERROR_UNKNOWN;
30+ }
31+ } // namespace umf
32+
2233static usm::DisjointPoolAllConfigs initializeDisjointPoolConfig () {
2334 const char *PoolUrTraceVal = std::getenv (" UR_L0_USM_ALLOCATOR_TRACE" );
2435
Original file line number Diff line number Diff line change 1515#include " context.hpp"
1616#include < cstdlib>
1717
18+ namespace umf {
19+ ur_result_t getProviderNativeError (const char *, int32_t ) {
20+ return UR_RESULT_ERROR_UNKNOWN;
21+ }
22+ } // namespace umf
23+
1824namespace native_cpu {
1925
2026static ur_result_t alloc_helper (ur_context_handle_t hContext,
Original file line number Diff line number Diff line change 1212
1313#include " common.hpp"
1414
15+ namespace umf {
16+ ur_result_t getProviderNativeError (const char *, int32_t ) {
17+ // TODO: implement when UMF supports OpenCL
18+ return UR_RESULT_ERROR_UNKNOWN;
19+ }
20+ } // namespace umf
21+
1522inline cl_mem_alloc_flags_intel
1623hostDescToClFlags (const ur_usm_host_desc_t &desc) {
1724 cl_mem_alloc_flags_intel allocFlags = 0 ;
Original file line number Diff line number Diff line change @@ -241,6 +241,9 @@ template <typename Type> umf_result_t &getPoolLastStatusRef() {
241241 return last_status;
242242}
243243
244+ ur_result_t getProviderNativeError (const char *providerName,
245+ int32_t nativeError);
246+
244247// / @brief translates UMF return values to UR.
245248// / This function assumes that the native error of
246249// / the last failed memory provider is ur_result_t.
@@ -256,16 +259,15 @@ inline ur_result_t umf2urResult(umf_result_t umfResult) {
256259 return UR_RESULT_ERROR_UNKNOWN;
257260 }
258261
259- ur_result_t Err = UR_RESULT_ERROR_UNKNOWN;
262+ int32_t Err = UR_RESULT_ERROR_UNKNOWN;
260263 const char *Msg = nullptr ;
261- umfMemoryProviderGetLastNativeError (hProvider, &Msg,
262- reinterpret_cast <int32_t *>(&Err));
264+ umfMemoryProviderGetLastNativeError (hProvider, &Msg, &Err);
263265
264266 if (Msg) {
265267 logger::error (" UMF failed with: {}" , Msg);
266268 }
267269
268- return Err;
270+ return getProviderNativeError ( umfMemoryProviderGetName (hProvider), Err) ;
269271 }
270272 case UMF_RESULT_ERROR_INVALID_ARGUMENT:
271273 return UR_RESULT_ERROR_INVALID_ARGUMENT;
You can’t perform that action at this time.
0 commit comments