From 4bfc1404f8ef83316ba6610d5ab8504e5b5916a8 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Mon, 6 Nov 2023 16:18:09 +0000 Subject: [PATCH] [SYCL][PI][UR] Combined CTS fixes for CL adapter. Pulls in fixes from https://github.com/oneapi-src/unified-runtime/pull/1044 New UR commit hash 192e9404392c38ac43d09116d6c97e153c66f46b Also correct type in a couple of NUM_DEVICES PI queries, and implement a workaround in pi2ur for type mismatch between PI kernel num args query and UR equivalent. --- sycl/plugins/unified_runtime/CMakeLists.txt | 12 ++++++------ sycl/plugins/unified_runtime/pi2ur.hpp | 14 ++++++++++++-- sycl/source/backend.cpp | 4 ++-- sycl/source/detail/context_impl.cpp | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt index 1d4d0c52caa19..1a28369158d09 100644 --- a/sycl/plugins/unified_runtime/CMakeLists.txt +++ b/sycl/plugins/unified_runtime/CMakeLists.txt @@ -54,13 +54,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT) include(FetchContent) set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") - # commit ec7982bac6cb3a6b9ed610cd6b7cb41fcbc780dc - # Merge: 62e6d2f9 5fb82924 + # commit 192e9404392c38ac43d09116d6c97e153c66f46b + # Merge: 2f44433c f65473d9 # Author: Kenneth Benzie (Benie) - # Date: Wed Nov 8 13:32:46 2023 +0000 - # Merge pull request #1022 from 0x12CC/l0_usm_error_checking_2 - # [UR][L0] Propagate OOM errors from `USMAllocationMakeResident` - set(UNIFIED_RUNTIME_TAG ec7982bac6cb3a6b9ed610cd6b7cb41fcbc780dc) + # Date: Fri Nov 10 13:25:42 2023 +0000 + # Merge pull request #1044 from aarongreig/aaron/clCTSFixMegaBranch + # [OpenCL] Combined CTS fixes + set(UNIFIED_RUNTIME_TAG 192e9404392c38ac43d09116d6c97e153c66f46b) if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO) set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}") diff --git a/sycl/plugins/unified_runtime/pi2ur.hpp b/sycl/plugins/unified_runtime/pi2ur.hpp index 69637713fc6ba..d67f7837a2ad4 100644 --- a/sycl/plugins/unified_runtime/pi2ur.hpp +++ b/sycl/plugins/unified_runtime/pi2ur.hpp @@ -2336,8 +2336,18 @@ inline pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName, break; } case PI_KERNEL_INFO_NUM_ARGS: { - UrParamName = UR_KERNEL_INFO_NUM_ARGS; - break; + size_t NumArgs = 0; + HANDLE_ERRORS(urKernelGetInfo(UrKernel, UR_KERNEL_INFO_NUM_ARGS, + sizeof(NumArgs), &NumArgs, nullptr)); + if (ParamValueSizeRet) { + *ParamValueSizeRet = sizeof(uint32_t); + } + if (ParamValue) { + if (ParamValueSize != sizeof(uint32_t)) + return PI_ERROR_INVALID_BUFFER_SIZE; + *static_cast(ParamValue) = static_cast(NumArgs); + } + return PI_SUCCESS; } case PI_KERNEL_INFO_REFERENCE_COUNT: { UrParamName = UR_KERNEL_INFO_REFERENCE_COUNT; diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index b2cfa4e0465b1..82adf2f979bf9 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -174,10 +174,10 @@ make_kernel_bundle(pi_native_handle NativeHandle, const context &TargetContext, Plugin->call(PiProgram); std::vector ProgramDevices; - size_t NumDevices = 0; + uint32_t NumDevices = 0; Plugin->call( - PiProgram, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(size_t), &NumDevices, + PiProgram, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(NumDevices), &NumDevices, nullptr); ProgramDevices.resize(NumDevices); Plugin->call(PiProgram, PI_PROGRAM_INFO_DEVICES, diff --git a/sycl/source/detail/context_impl.cpp b/sycl/source/detail/context_impl.cpp index 3e8b13c40f9cc..fe41f1efe17d9 100644 --- a/sycl/source/detail/context_impl.cpp +++ b/sycl/source/detail/context_impl.cpp @@ -77,7 +77,7 @@ context_impl::context_impl(sycl::detail::pi::PiContext PiContext, MSupportBufferLocationByDevices(NotChecked) { std::vector DeviceIds; - size_t DevicesNum = 0; + uint32_t DevicesNum = 0; // TODO catch an exception and put it to list of asynchronous exceptions Plugin->call( MContext, PI_CONTEXT_INFO_NUM_DEVICES, sizeof(DevicesNum), &DevicesNum,