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 22
22
23
23
#include < cuda.h>
24
24
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
+
25
32
// / USM: Implements USM Host allocations using CUDA Pinned Memory
26
33
// / https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#page-locked-host-memory
27
34
UR_APIEXPORT ur_result_t UR_APICALL
Original file line number Diff line number Diff line change 18
18
#include " ur_util.hpp"
19
19
#include " usm.hpp"
20
20
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
+
21
28
// / USM: Implements USM Host allocations using HIP Pinned Memory
22
29
UR_APIEXPORT ur_result_t UR_APICALL
23
30
urUSMHostAlloc (ur_context_handle_t hContext, const ur_usm_desc_t *pUSMDesc,
Original file line number Diff line number Diff line change 23
23
24
24
#include < umf_helpers.hpp>
25
25
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
+
26
37
usm::DisjointPoolAllConfigs DisjointPoolConfigInstance =
27
38
InitializeDisjointPoolConfig ();
28
39
Original file line number Diff line number Diff line change 19
19
#include < umf/pools/pool_proxy.h>
20
20
#include < umf/providers/provider_level_zero.h>
21
21
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
+
22
33
static usm::DisjointPoolAllConfigs initializeDisjointPoolConfig () {
23
34
const char *PoolUrTraceVal = std::getenv (" UR_L0_USM_ALLOCATOR_TRACE" );
24
35
Original file line number Diff line number Diff line change 15
15
#include " context.hpp"
16
16
#include < cstdlib>
17
17
18
+ namespace umf {
19
+ ur_result_t getProviderNativeError (const char *, int32_t ) {
20
+ return UR_RESULT_ERROR_UNKNOWN;
21
+ }
22
+ } // namespace umf
23
+
18
24
namespace native_cpu {
19
25
20
26
static ur_result_t alloc_helper (ur_context_handle_t hContext,
Original file line number Diff line number Diff line change 12
12
13
13
#include " common.hpp"
14
14
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
+
15
22
inline cl_mem_alloc_flags_intel
16
23
hostDescToClFlags (const ur_usm_host_desc_t &desc) {
17
24
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() {
241
241
return last_status;
242
242
}
243
243
244
+ ur_result_t getProviderNativeError (const char *providerName,
245
+ int32_t nativeError);
246
+
244
247
// / @brief translates UMF return values to UR.
245
248
// / This function assumes that the native error of
246
249
// / the last failed memory provider is ur_result_t.
@@ -256,16 +259,15 @@ inline ur_result_t umf2urResult(umf_result_t umfResult) {
256
259
return UR_RESULT_ERROR_UNKNOWN;
257
260
}
258
261
259
- ur_result_t Err = UR_RESULT_ERROR_UNKNOWN;
262
+ int32_t Err = UR_RESULT_ERROR_UNKNOWN;
260
263
const char *Msg = nullptr ;
261
- umfMemoryProviderGetLastNativeError (hProvider, &Msg,
262
- reinterpret_cast <int32_t *>(&Err));
264
+ umfMemoryProviderGetLastNativeError (hProvider, &Msg, &Err);
263
265
264
266
if (Msg) {
265
267
logger::error (" UMF failed with: {}" , Msg);
266
268
}
267
269
268
- return Err;
270
+ return getProviderNativeError ( umfMemoryProviderGetName (hProvider), Err) ;
269
271
}
270
272
case UMF_RESULT_ERROR_INVALID_ARGUMENT:
271
273
return UR_RESULT_ERROR_INVALID_ARGUMENT;
You can’t perform that action at this time.
0 commit comments