From d31979b9c1b8afb17565ec2fe2c35f2543101a13 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Thu, 14 Nov 2024 20:08:38 +0000 Subject: [PATCH] [L0 v2] fix error reporting for urUSM*Alloc match the spec behavior --- source/adapters/level_zero/v2/usm.cpp | 8 ++++++-- test/conformance/usm/usm_adapter_level_zero_v2.match | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/adapters/level_zero/v2/usm.cpp b/source/adapters/level_zero/v2/usm.cpp index f23a6c6fe8..f31a2b5202 100644 --- a/source/adapters/level_zero/v2/usm.cpp +++ b/source/adapters/level_zero/v2/usm.cpp @@ -22,8 +22,12 @@ namespace umf { ur_result_t getProviderNativeError(const char *providerName, int32_t nativeError) { - if (strcmp(providerName, "Level Zero") == 0) { - return ze2urResult(static_cast(nativeError)); + if (strcmp(providerName, "LEVEL_ZERO") == 0) { + auto zeResult = static_cast(nativeError); + if (zeResult == ZE_RESULT_ERROR_UNSUPPORTED_SIZE) { + return UR_RESULT_ERROR_INVALID_USM_SIZE; + } + return ze2urResult(zeResult); } return UR_RESULT_ERROR_UNKNOWN; diff --git a/test/conformance/usm/usm_adapter_level_zero_v2.match b/test/conformance/usm/usm_adapter_level_zero_v2.match index 6c9b1a07a0..ad8e1888d4 100644 --- a/test/conformance/usm/usm_adapter_level_zero_v2.match +++ b/test/conformance/usm/usm_adapter_level_zero_v2.match @@ -1,4 +1 @@ -urUSMDeviceAllocTest.InvalidUSMSize/* urUSMGetMemAllocInfoTest.Success/*___UR_USM_ALLOC_INFO_POOL -urUSMHostAllocTest.InvalidUSMSize/* -urUSMSharedAllocTest.InvalidUSMSize/*