From e5d6a91af7849e912d32548ce0a51ee360339410 Mon Sep 17 00:00:00 2001 From: Michael Aziz Date: Thu, 28 Sep 2023 09:15:09 -0700 Subject: [PATCH 1/8] [UR][L0] Propagate errors from `USMAllocationMakeResident` This change ensures that USM allocation APIs don't return `UR_RESULT_SUCCESS` when an error occurs within `USMAllocationMakeResident`. Signed-off-by: Michael Aziz --- source/adapters/level_zero/usm.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/source/adapters/level_zero/usm.cpp b/source/adapters/level_zero/usm.cpp index d06a0353e4..d75f3872b1 100644 --- a/source/adapters/level_zero/usm.cpp +++ b/source/adapters/level_zero/usm.cpp @@ -192,9 +192,8 @@ static ur_result_t USMDeviceAllocImpl(void **ResultPtr, reinterpret_cast(*ResultPtr) % Alignment == 0, UR_RESULT_ERROR_INVALID_VALUE); - USMAllocationMakeResident(USMDeviceAllocationForceResidency, Context, Device, - *ResultPtr, Size); - return UR_RESULT_SUCCESS; + return USMAllocationMakeResident(USMDeviceAllocationForceResidency, Context, + Device, *ResultPtr, Size); } static ur_result_t USMSharedAllocImpl(void **ResultPtr, @@ -225,11 +224,9 @@ static ur_result_t USMSharedAllocImpl(void **ResultPtr, reinterpret_cast(*ResultPtr) % Alignment == 0, UR_RESULT_ERROR_INVALID_VALUE); - USMAllocationMakeResident(USMSharedAllocationForceResidency, Context, Device, - *ResultPtr, Size); - // TODO: Handle PI_MEM_ALLOC_DEVICE_READ_ONLY. - return UR_RESULT_SUCCESS; + return USMAllocationMakeResident(USMSharedAllocationForceResidency, Context, + Device, *ResultPtr, Size); } static ur_result_t USMHostAllocImpl(void **ResultPtr, @@ -247,9 +244,8 @@ static ur_result_t USMHostAllocImpl(void **ResultPtr, reinterpret_cast(*ResultPtr) % Alignment == 0, UR_RESULT_ERROR_INVALID_VALUE); - USMAllocationMakeResident(USMHostAllocationForceResidency, Context, nullptr, - *ResultPtr, Size); - return UR_RESULT_SUCCESS; + return USMAllocationMakeResident(USMHostAllocationForceResidency, Context, + nullptr, *ResultPtr, Size); } UR_APIEXPORT ur_result_t UR_APICALL urUSMHostAlloc( From 49770f51ac69c485f7ed5c2bc36732e54f8def07 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Fri, 29 Sep 2023 14:21:23 +0100 Subject: [PATCH 2/8] Add CODEOWNERS file Adapter implementations are being moved into the repo we should mirror the code ownership of those implementations. This patch adds a CODEOWNERS file which matches the pre adapter move ownership to be used as a baseline for future changes for each individual adapter. --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..aca73e5708 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @oneapi-src/unified-runtime-maintain From 6180a78e8bff683c8d944686823b45d3fe939468 Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Mon, 2 Oct 2023 16:26:36 +0200 Subject: [PATCH 3/8] [UR][L0] Fix minor code duplication - Second return has no effect - Checking the same flag twice has no effect --- source/adapters/level_zero/context.cpp | 14 ++++++-------- source/adapters/level_zero/event.cpp | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/source/adapters/level_zero/context.cpp b/source/adapters/level_zero/context.cpp index c9496dda2c..2bd893b043 100644 --- a/source/adapters/level_zero/context.cpp +++ b/source/adapters/level_zero/context.cpp @@ -432,14 +432,12 @@ ur_result_t ur_context_handle_t_::finalize() { for (auto &List : ZeComputeCommandListCache) { for (auto &Item : List.second) { ze_command_list_handle_t ZeCommandList = Item.first; - if (ZeCommandList) - if (ZeCommandList) { - auto ZeResult = - ZE_CALL_NOCHECK(zeCommandListDestroy, (ZeCommandList)); - // Gracefully handle the case that L0 was already unloaded. - if (ZeResult && ZeResult != ZE_RESULT_ERROR_UNINITIALIZED) - return ze2urResult(ZeResult); - } + if (ZeCommandList) { + auto ZeResult = ZE_CALL_NOCHECK(zeCommandListDestroy, (ZeCommandList)); + // Gracefully handle the case that L0 was already unloaded. + if (ZeResult && ZeResult != ZE_RESULT_ERROR_UNINITIALIZED) + return ze2urResult(ZeResult); + } } } for (auto &List : ZeCopyCommandListCache) { diff --git a/source/adapters/level_zero/event.cpp b/source/adapters/level_zero/event.cpp index 08f3131d35..b979c8ab15 100644 --- a/source/adapters/level_zero/event.cpp +++ b/source/adapters/level_zero/event.cpp @@ -423,7 +423,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetInfo( } } return ReturnValue(Result); - return UR_RESULT_SUCCESS; } case UR_EVENT_INFO_REFERENCE_COUNT: { return ReturnValue(Event->RefCount.load()); From 484cd0716682b0f7c39ca5c740e19d0e44568342 Mon Sep 17 00:00:00 2001 From: Nicolas Miller Date: Tue, 10 Oct 2023 11:42:52 +0100 Subject: [PATCH 4/8] Add code owners for the CUDA and HIP adapters --- .github/CODEOWNERS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index aca73e5708..36915710d0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,5 @@ * @oneapi-src/unified-runtime-maintain + +# CUDA and HIP plugins +source/adapters/cuda @JackAKirk @jchlanda @ldrumm @mmoadeli @npmiller +source/adapters/hip @JackAKirk @jchlanda @ldrumm @mmoadeli @npmiller From a6f382a77ad1df43f4d1b9900953c66b93b7f255 Mon Sep 17 00:00:00 2001 From: Nicolas Miller Date: Wed, 11 Oct 2023 17:29:31 +0100 Subject: [PATCH 5/8] Use teams for plugin codeowners --- .github/CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 36915710d0..e93ad596f0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,5 @@ * @oneapi-src/unified-runtime-maintain # CUDA and HIP plugins -source/adapters/cuda @JackAKirk @jchlanda @ldrumm @mmoadeli @npmiller -source/adapters/hip @JackAKirk @jchlanda @ldrumm @mmoadeli @npmiller +source/adapters/cuda @oneapi-src/unified-runtime-cuda-write +source/adapters/hip @oneapi-src/unified-runtime-hip-write From 463e7ce0295fa07bc1b5f21c6ab4c9d7b52f920e Mon Sep 17 00:00:00 2001 From: Nicolas Miller Date: Wed, 11 Oct 2023 17:35:08 +0100 Subject: [PATCH 6/8] Use CUDA team for HIP adapter too The HIP team needs some fixing up currently so use the CUDA team for now. --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e93ad596f0..5c86f83bf0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,4 +2,4 @@ # CUDA and HIP plugins source/adapters/cuda @oneapi-src/unified-runtime-cuda-write -source/adapters/hip @oneapi-src/unified-runtime-hip-write +source/adapters/hip @oneapi-src/unified-runtime-cuda-write From 3f831b2a6319243b8e0aaf5ad7f97d5219198345 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 12 Oct 2023 11:44:40 +0100 Subject: [PATCH 7/8] [UR][L0] Add adapter source to codeowners file --- .github/CODEOWNERS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5c86f83bf0..19e119df72 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,8 @@ * @oneapi-src/unified-runtime-maintain -# CUDA and HIP plugins +# Level Zero adapter +source/adapters/level_zero @oneapi-src/unified-runtime-level-zero-write + +# CUDA and HIP adapters source/adapters/cuda @oneapi-src/unified-runtime-cuda-write source/adapters/hip @oneapi-src/unified-runtime-cuda-write From 9af962be74e9cf9be7601c98d040fc3081b3b425 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Fri, 13 Oct 2023 11:23:19 +0100 Subject: [PATCH 8/8] Update HIP adapter codeowners to use specific team --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 19e119df72..b667ce6860 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,4 +5,4 @@ source/adapters/level_zero @oneapi-src/unified-runtime-level-zero-write # CUDA and HIP adapters source/adapters/cuda @oneapi-src/unified-runtime-cuda-write -source/adapters/hip @oneapi-src/unified-runtime-cuda-write +source/adapters/hip @oneapi-src/unified-runtime-hip-write