From 3af465bf241fcb2635d6f8ec4c1ec7a73f929f90 Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Tue, 3 Oct 2023 13:32:00 +0200 Subject: [PATCH] [SYCL][UR][L0] Remove reduntant umf2urResult function --- source/adapters/level_zero/usm.cpp | 36 ++++-------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/source/adapters/level_zero/usm.cpp b/source/adapters/level_zero/usm.cpp index 47ad5c321f..f4e68d8195 100644 --- a/source/adapters/level_zero/usm.cpp +++ b/source/adapters/level_zero/usm.cpp @@ -20,34 +20,6 @@ #include -ur_result_t umf2urResult(umf_result_t umfResult) { - if (umfResult == UMF_RESULT_SUCCESS) - return UR_RESULT_SUCCESS; - - switch (umfResult) { - case UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY: - return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - case UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC: { - auto hProvider = umfGetLastFailedMemoryProvider(); - if (hProvider == nullptr) - return UR_RESULT_ERROR_UNKNOWN; - - ur_result_t Err = UR_RESULT_ERROR_UNKNOWN; - umfMemoryProviderGetLastNativeError(hProvider, nullptr, - reinterpret_cast(&Err)); - return Err; - } - case UMF_RESULT_ERROR_INVALID_ARGUMENT: - return UR_RESULT_ERROR_INVALID_ARGUMENT; - case UMF_RESULT_ERROR_INVALID_ALIGNMENT: - return UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT; - case UMF_RESULT_ERROR_NOT_SUPPORTED: - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - default: - return UR_RESULT_ERROR_UNKNOWN; - }; -} - usm::DisjointPoolAllConfigs InitializeDisjointPoolConfig() { const char *PoolUrConfigVal = std::getenv("SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR"); const char *PoolPiConfigVal = std::getenv("UR_L0_USM_ALLOCATOR"); @@ -315,7 +287,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMHostAlloc( *RetMem = umfPoolAlignedMalloc(hPoolInternal, Size, Align); if (*RetMem == nullptr) { auto umfRet = umfPoolGetLastAllocationError(hPoolInternal); - return umf2urResult(umfRet); + return umf::umf2urResult(umfRet); } if (IndirectAccessTrackingEnabled) { @@ -391,7 +363,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMDeviceAlloc( *RetMem = umfPoolAlignedMalloc(hPoolInternal, Size, Alignment); if (*RetMem == nullptr) { auto umfRet = umfPoolGetLastAllocationError(hPoolInternal); - return umf2urResult(umfRet); + return umf::umf2urResult(umfRet); } if (IndirectAccessTrackingEnabled) { @@ -488,7 +460,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMSharedAlloc( *RetMem = umfPoolAlignedMalloc(hPoolInternal, Size, Alignment); if (*RetMem == nullptr) { auto umfRet = umfPoolGetLastAllocationError(hPoolInternal); - return umf2urResult(umfRet); + return umf::umf2urResult(umfRet); } if (IndirectAccessTrackingEnabled) { @@ -925,7 +897,7 @@ ur_result_t USMFreeHelper(ur_context_handle_t Context, void *Ptr, auto umfRet = umfPoolFree(hPool, Ptr); if (IndirectAccessTrackingEnabled) UR_CALL(ContextReleaseHelper(Context)); - return umf2urResult(umfRet); + return umf::umf2urResult(umfRet); } UR_APIEXPORT ur_result_t UR_APICALL urUSMImportExp(ur_context_handle_t Context,