From 44832413c9fc23b161305ebc33844a526a7cd0d6 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Mon, 11 Nov 2024 16:38:15 +0000 Subject: [PATCH 1/4] [UR] Stop using extension strings to report support for exp features. With this change all experimental features now add a ur_device_info_t enum which adapters report support through, and all EXTENSION_STRING macros have been removed. --- sycl/cmake/modules/FetchUnifiedRuntime.cmake | 2 +- sycl/cmake/modules/UnifiedRuntimeTag.cmake | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sycl/cmake/modules/FetchUnifiedRuntime.cmake b/sycl/cmake/modules/FetchUnifiedRuntime.cmake index 72841724fa01d..d0eff6cbe84f1 100644 --- a/sycl/cmake/modules/FetchUnifiedRuntime.cmake +++ b/sycl/cmake/modules/FetchUnifiedRuntime.cmake @@ -116,7 +116,7 @@ if(SYCL_UR_USE_FETCH_CONTENT) CACHE PATH "Path to external '${name}' adapter source dir" FORCE) endfunction() - set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") + set(UNIFIED_RUNTIME_REPO "https://github.com/aarongreig/unified-runtime.git") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/UnifiedRuntimeTag.cmake) set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES") diff --git a/sycl/cmake/modules/UnifiedRuntimeTag.cmake b/sycl/cmake/modules/UnifiedRuntimeTag.cmake index a4c494620fc92..72c3d898fb90f 100644 --- a/sycl/cmake/modules/UnifiedRuntimeTag.cmake +++ b/sycl/cmake/modules/UnifiedRuntimeTag.cmake @@ -1,7 +1 @@ -# commit 2eae687a4cf24ba02ee8e9ebb9552c1d392972ee -# Merge: 1ba7f39a 2a081891 -# Author: Callum Fare -# Date: Mon Nov 11 13:35:24 2024 +0000 -# Merge pull request #2112 from martygrant/martin/context-cts-spec-gap -# Improvements to align CTS and Spec for Context -set(UNIFIED_RUNTIME_TAG 2eae687a4cf24ba02ee8e9ebb9552c1d392972ee) +set(UNIFIED_RUNTIME_TAG aaron/stopUsingURExtStrings) From c896cdc89ea02a1902ca1d5f76269baba18fbf5b Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Mon, 11 Nov 2024 16:35:43 +0000 Subject: [PATCH 2/4] Stop reporting support for experimental features with extension strings. --- unified-runtime/include/ur_api.h | 49 ++++---------- unified-runtime/include/ur_print.hpp | 64 +++++++++++++++++++ .../scripts/core/EXP-COMMAND-BUFFER.rst | 39 +++-------- .../scripts/core/EXP-COOPERATIVE-KERNELS.rst | 30 +++++---- .../scripts/core/EXP-LAUNCH-PROPERTIES.rst | 21 +++--- .../scripts/core/EXP-MULTI-DEVICE-COMPILE.rst | 30 +++++---- unified-runtime/scripts/core/EXP-USM-P2P.rst | 19 ++++-- .../scripts/core/exp-command-buffer.yml | 5 -- .../scripts/core/exp-cooperative-kernels.yml | 15 +++-- .../scripts/core/exp-launch-properties.yml | 13 ++-- .../scripts/core/exp-multi-device-compile.yml | 15 +++-- unified-runtime/scripts/core/exp-usm-p2p.yml | 13 ++-- .../source/adapters/cuda/device.cpp | 16 +++-- .../source/adapters/hip/device.cpp | 40 +++++------- .../source/adapters/level_zero/device.cpp | 14 ++-- .../source/adapters/native_cpu/device.cpp | 12 ++++ .../source/adapters/opencl/device.cpp | 27 +++----- .../loader/layers/validation/ur_valddi.cpp | 2 +- unified-runtime/source/loader/ur_libapi.cpp | 2 +- unified-runtime/source/ur_api.cpp | 2 +- .../urEnqueueKernelLaunchAndMemcpyInOrder.cpp | 17 +---- .../conformance/exp_command_buffer/fixtures.h | 18 ++---- .../launch_properties.cpp | 20 ++---- .../test/conformance/exp_usm_p2p/usm_p2p.cpp | 18 ++---- unified-runtime/tools/urinfo/urinfo.hpp | 11 ++++ 25 files changed, 267 insertions(+), 245 deletions(-) diff --git a/unified-runtime/include/ur_api.h b/unified-runtime/include/ur_api.h index c390ed4410d16..b380bfe807508 100644 --- a/unified-runtime/include/ur_api.h +++ b/unified-runtime/include/ur_api.h @@ -2290,6 +2290,17 @@ typedef enum ur_device_info_t { /// [::ur_exp_device_2d_block_array_capability_flags_t] return a bit-field /// of Intel GPU 2D block array capabilities UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP = 0x2022, + /// [::ur_bool_t] Returns true if the device supports the use of kernel + /// launch properties. + UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP = 0x3000, + /// [::ur_bool_t] Returns true if the device supports the USM P2P + /// experimental feature. + UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP = 0x4000, + /// [::ur_bool_t] Returns true if the device supports cooperative kernels. + UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP = 0x5000, + /// [::ur_bool_t] Returns true if the device supports the multi device + /// compile experimental feature. + UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP = 0x7000, /// @cond UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -2315,7 +2326,7 @@ typedef enum ur_device_info_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName` +/// + `::UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -9946,13 +9957,6 @@ typedef enum ur_exp_command_buffer_command_info_t { } ur_exp_command_buffer_command_info_t; -/////////////////////////////////////////////////////////////////////////////// -#ifndef UR_COMMAND_BUFFER_EXTENSION_STRING_EXP -/// @brief The extension string which defines support for command-buffers which -/// is returned when querying device extensions. -#define UR_COMMAND_BUFFER_EXTENSION_STRING_EXP "ur_exp_command_buffer" -#endif // UR_COMMAND_BUFFER_EXTENSION_STRING_EXP - /////////////////////////////////////////////////////////////////////////////// /// @brief Command-Buffer Descriptor Type typedef struct ur_exp_command_buffer_desc_t { @@ -11235,13 +11239,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( #if !defined(__GNUC__) #pragma region cooperative_kernels_(experimental) #endif -/////////////////////////////////////////////////////////////////////////////// -#ifndef UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP -/// @brief The extension string which defines support for cooperative-kernels -/// which is returned when querying device extensions. -#define UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP "ur_exp_cooperative_kernels" -#endif // UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP - /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to execute a cooperative kernel /// @@ -11391,13 +11388,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueTimestampRecordingExp( #if !defined(__GNUC__) #pragma region launch_properties_(experimental) #endif -/////////////////////////////////////////////////////////////////////////////// -#ifndef UR_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP -/// @brief The extension string that defines support for the Launch Properties -/// extension, which is returned when querying device extensions. -#define UR_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP "ur_exp_launch_properties" -#endif // UR_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP - /////////////////////////////////////////////////////////////////////////////// /// @brief Specifies a launch property id /// @@ -11544,14 +11534,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( #if !defined(__GNUC__) #pragma region multi_device_compile_(experimental) #endif -/////////////////////////////////////////////////////////////////////////////// -#ifndef UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP -/// @brief The extension string which defines support for test -/// which is returned when querying device extensions. -#define UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP \ - "ur_exp_multi_device_compile" -#endif // UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP - /////////////////////////////////////////////////////////////////////////////// /// @brief Produces an executable program from one program, negates need for the /// linking step. @@ -11739,13 +11721,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMReleaseExp( #if !defined(__GNUC__) #pragma region usm_p2p_(experimental) #endif -/////////////////////////////////////////////////////////////////////////////// -#ifndef UR_USM_P2P_EXTENSION_STRING_EXP -/// @brief The extension string that defines support for USM P2P which is -/// returned when querying device extensions. -#define UR_USM_P2P_EXTENSION_STRING_EXP "ur_exp_usm_p2p" -#endif // UR_USM_P2P_EXTENSION_STRING_EXP - /////////////////////////////////////////////////////////////////////////////// /// @brief Supported peer info typedef enum ur_exp_peer_info_t { diff --git a/unified-runtime/include/ur_print.hpp b/unified-runtime/include/ur_print.hpp index 5c5f573477929..9fca6be1b8387 100644 --- a/unified-runtime/include/ur_print.hpp +++ b/unified-runtime/include/ur_print.hpp @@ -2975,6 +2975,18 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { case UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP: os << "UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP"; break; + case UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP: + os << "UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP: + os << "UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP: + os << "UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP: + os << "UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP"; + break; default: os << "unknown enumerator"; break; @@ -4966,6 +4978,58 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, os << ")"; } break; + case UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; default: os << "unknown enumerator"; return UR_RESULT_ERROR_INVALID_ENUMERATION; diff --git a/unified-runtime/scripts/core/EXP-COMMAND-BUFFER.rst b/unified-runtime/scripts/core/EXP-COMMAND-BUFFER.rst index 1a4925e83fa0f..cc65acb1f93ad 100644 --- a/unified-runtime/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/unified-runtime/scripts/core/EXP-COMMAND-BUFFER.rst @@ -40,36 +40,14 @@ Querying Command-Buffer Support -------------------------------------------------------------------------------- Support for command-buffers can be queried for a given device/adapter by using -the device info query with ${X}_DEVICE_INFO_EXTENSIONS. Adapters supporting this -experimental feature will report the string "ur_exp_command_buffer" in the -returned list of supported extensions. - -.. hint:: - The macro ${X}_COMMAND_BUFFER_EXTENSION_STRING_EXP is defined for the string - returned from extension queries for this feature. Since the actual string - may be subject to change it is safer to use this macro when querying for - support for this experimental feature. +the device info query with ${X}_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP. Adapters +supporting this experimental feature will report ``true``. .. parsed-literal:: - // Retrieve length of extension string - size_t returnedSize; - ${x}DeviceGetInfo(hDevice, ${X}_DEVICE_INFO_EXTENSIONS, 0, nullptr, - &returnedSize); - - // Retrieve extension string - std::unique_ptr returnedExtensions(new char[returnedSize]); - ${x}DeviceGetInfo(hDevice, ${X}_DEVICE_INFO_EXTENSIONS, returnedSize, - returnedExtensions.get(), nullptr); - - std::string_view ExtensionsString(returnedExtensions.get()); - bool CmdBufferSupport = - ExtensionsString.find(${X}_COMMAND_BUFFER_EXTENSION_STRING_EXP) - != std::string::npos; - -.. note:: - The ${X}_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP device info query exists to - serve the same purpose as ${X}_COMMAND_BUFFER_EXTENSION_STRING_EXP. + ur_bool_t CmdBufferSupport = false; + ${x}DeviceGetInfo(hDevice, ${X}_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP, + sizeof(CmdBufferSupport), &CmdBufferSupport, nullptr); Command-Buffer Creation -------------------------------------------------------------------------------- @@ -401,10 +379,6 @@ ${x}CommandBufferUpdateSignalEventExp there must also have been a non-null API -------------------------------------------------------------------------------- -Macros -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* ${X}_COMMAND_BUFFER_EXTENSION_STRING_EXP - Enums ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ${x}_device_info_t @@ -514,6 +488,9 @@ Changelog +-----------+-------------------------------------------------------+ | 1.7 | Remove command handle reference counting and querying | +-----------+-------------------------------------------------------+ +| 1.8 | Remove extension string macro, make device info enum | +| | primary mechanism for reporting support. | ++-----------+-------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- diff --git a/unified-runtime/scripts/core/EXP-COOPERATIVE-KERNELS.rst b/unified-runtime/scripts/core/EXP-COOPERATIVE-KERNELS.rst index c6b64ef66907d..ba055c48ff7a9 100644 --- a/unified-runtime/scripts/core/EXP-COOPERATIVE-KERNELS.rst +++ b/unified-runtime/scripts/core/EXP-COOPERATIVE-KERNELS.rst @@ -36,9 +36,10 @@ The functions defined here align with those specified in Level Zero. API -------------------------------------------------------------------------------- -Macros +Enums ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* ${X}_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP +* ${x}_device_info_t + * ${X}_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -47,22 +48,25 @@ Functions Changelog -------------------------------------------------------------------------------- -+-----------+------------------------+ -| Revision | Changes | -+===========+========================+ -| 1.0 | Initial Draft | -+-----------+------------------------+ ++-----------+---------------------------------------------+ +| Revision | Changes | ++===========+=============================================+ +| 1.0 | Initial Draft | ++-----------+---------------------------------------------+ +| 1.1 | Switch from extension string macro to | +| | device info enum for reporting support. | ++-----------+---------------------------------------------+ Support -------------------------------------------------------------------------------- -Adapters which support this experimental feature *must* return the valid string -defined in ``${X}_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP`` -as one of the options from ${x}DeviceGetInfo when querying for -${X}_DEVICE_INFO_EXTENSIONS. Conversely, before using any of the -functionality defined in this experimental feature the user *must* use the -device query to determine if the adapter supports this feature. +Adapters which support this experimental feature *must* return ``true`` when +queried for ${X}_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP via +${x}DeviceGetInfo. Conversely, before using any of the functionality defined in +this experimental feature the user *must* use the device query to determine if +the adapter supports this feature. Contributors -------------------------------------------------------------------------------- * Michael Aziz `michael.aziz@intel.com `_ +* Aaron Greig `aaron.greig@codeplay.com `_ diff --git a/unified-runtime/scripts/core/EXP-LAUNCH-PROPERTIES.rst b/unified-runtime/scripts/core/EXP-LAUNCH-PROPERTIES.rst index a0a116b293d1b..81703aaca503b 100644 --- a/unified-runtime/scripts/core/EXP-LAUNCH-PROPERTIES.rst +++ b/unified-runtime/scripts/core/EXP-LAUNCH-PROPERTIES.rst @@ -55,14 +55,12 @@ cooperative kernels Unified-Runtime extension. API -------------------------------------------------------------------------------- -Macros -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -* ${X}_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP - Enums ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* ${x}_device_info_t + * ${X}_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP + * ${x}_exp_launch_property_id_t Unions @@ -83,9 +81,12 @@ Functions Support -------------------------------------------------------------------------------- -Adapters which support this experimental feature *must* return the valid string -defined in ${X}_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP as one of the options from -${x}DeviceGetInfo when querying for ${X}_DEVICE_INFO_EXTENSIONS. +Adapters which support this experimental feature *must* return ``true`` when +queried for ${X}_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP via +${x}DeviceGetInfo. Conversely, before using any of the functionality defined +in this experimental feature the user *must* use the device query to determine +if the adapter supports this feature. + Changelog -------------------------------------------------------------------------------- @@ -95,8 +96,12 @@ Changelog +===========+=============================================+ | 1.0 | Initial Draft | +-----------+---------------------------------------------+ +| 1.1 | Switch from extension string macro to | +| | device info enum for reporting support. | ++-----------+---------------------------------------------+ Contributors -------------------------------------------------------------------------------- * JackAKirk `jack.kirk@codeplay.com `_ +* Aaron Greig `aaron.greig@codeplay.com `_ diff --git a/unified-runtime/scripts/core/EXP-MULTI-DEVICE-COMPILE.rst b/unified-runtime/scripts/core/EXP-MULTI-DEVICE-COMPILE.rst index d4c2a6cb7a7a7..19dc26268b318 100644 --- a/unified-runtime/scripts/core/EXP-MULTI-DEVICE-COMPILE.rst +++ b/unified-runtime/scripts/core/EXP-MULTI-DEVICE-COMPILE.rst @@ -32,6 +32,11 @@ future. API -------------------------------------------------------------------------------- +Enums +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* ${x}_device_info_t + * ${X}_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP + Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -42,23 +47,26 @@ Functions Changelog -------------------------------------------------------------------------------- -+-----------+------------------------+ -| Revision | Changes | -+===========+========================+ -| 1.0 | Initial Draft | -+-----------+------------------------+ ++-----------+---------------------------------------------+ +| Revision | Changes | ++===========+=============================================+ +| 1.0 | Initial Draft | ++-----------+---------------------------------------------+ +| 1.1 | Switch from extension string macro to | +| | device info enum for reporting support. | ++-----------+---------------------------------------------+ Support -------------------------------------------------------------------------------- -Adapters which support this experimental feature *must* return the valid string -defined in ``${X}_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP`` -as one of the options from ${x}DeviceGetInfo when querying for -${X}_DEVICE_INFO_EXTENSIONS. Conversely, before using any of the -functionality defined in this experimental feature the user *must* use the -device query to determine if the adapter supports this feature. +Adapters which support this experimental feature *must* return ``true`` when +queried for ${X}_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP via +${x}DeviceGetInfo. Conversely, before using any of the functionality defined +in this experimental feature the user *must* use the device query to determine +if the adapter supports this feature. Contributors -------------------------------------------------------------------------------- * Kenneth Benzie (Benie) `k.benzie@codeplay.com `_ +* Aaron Greig `aaron.greig@codeplay.com `_ diff --git a/unified-runtime/scripts/core/EXP-USM-P2P.rst b/unified-runtime/scripts/core/EXP-USM-P2P.rst index aa6c12ecb4745..c074de436819c 100644 --- a/unified-runtime/scripts/core/EXP-USM-P2P.rst +++ b/unified-runtime/scripts/core/EXP-USM-P2P.rst @@ -37,13 +37,12 @@ Level Zero. API -------------------------------------------------------------------------------- -Macros -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* ${X}_USM_P2P_EXTENSION_STRING_EXP - Enums ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* ${x}_device_info_t + * ${X}_DEVICE_INFO_USM_P2P_SUPPORT_EXP + * ${x}_exp_peer_info_t Functions @@ -55,9 +54,11 @@ Functions Support -------------------------------------------------------------------------------- -Adapters which support this experimental feature *must* return the valid string -defined in ``${X}_USM_P2P_EXTENSION_STRING_EXP`` as one of the options from -${x}DeviceGetInfo when querying for ${X}_DEVICE_INFO_EXTENSIONS. +Adapters which support this experimental feature *must* return ``true`` when +queried for ${X}_DEVICE_INFO_USM_P2P_SUPPORT_EXP via ${x}DeviceGetInfo. +Conversely, before using any of the functionality defined in this experimental +feature the user *must* use the device query to determine if the adapter +supports this feature. Changelog -------------------------------------------------------------------------------- @@ -71,8 +72,12 @@ Changelog +-----------+---------------------------------------------+ | 1.2 | Switch Info types from uint32_t to int | +-----------+---------------------------------------------+ +| 1.3 | Switch from extension string macro to | +| | device info enum for reporting support. | ++-----------+---------------------------------------------+ Contributors -------------------------------------------------------------------------------- * JackAKirk `jack.kirk@codeplay.com `_ +* Aaron Greig `aaron.greig@codeplay.com `_ diff --git a/unified-runtime/scripts/core/exp-command-buffer.yml b/unified-runtime/scripts/core/exp-command-buffer.yml index 680bc60f8d184..c06334e33eaf8 100644 --- a/unified-runtime/scripts/core/exp-command-buffer.yml +++ b/unified-runtime/scripts/core/exp-command-buffer.yml @@ -130,11 +130,6 @@ etors: The reference count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for identifying memory leaks. --- #-------------------------------------------------------------------------- -type: macro -desc: "The extension string which defines support for command-buffers which is returned when querying device extensions." -name: $X_COMMAND_BUFFER_EXTENSION_STRING_EXP -value: "\"$x_exp_command_buffer\"" ---- #-------------------------------------------------------------------------- type: struct desc: "Command-Buffer Descriptor Type" name: $x_exp_command_buffer_desc_t diff --git a/unified-runtime/scripts/core/exp-cooperative-kernels.yml b/unified-runtime/scripts/core/exp-cooperative-kernels.yml index 32082e797e245..9fbe0d8f8bb35 100644 --- a/unified-runtime/scripts/core/exp-cooperative-kernels.yml +++ b/unified-runtime/scripts/core/exp-cooperative-kernels.yml @@ -12,12 +12,15 @@ type: header desc: "Intel $OneApi Unified Runtime Experimental APIs for Cooperative Kernels" ordinal: "99" --- #-------------------------------------------------------------------------- -type: macro -desc: | - The extension string which defines support for cooperative-kernels - which is returned when querying device extensions. -name: $X_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP -value: "\"$x_exp_cooperative_kernels\"" +type: enum +extend: true +typed_etors: true +desc: "Extension enums for $x_device_info_t to support cooperative kernels." +name: $x_device_info_t +etors: + - name: COOPERATIVE_KERNEL_SUPPORT_EXP + value: "0x5000" + desc: "[$x_bool_t] Returns true if the device supports cooperative kernels." --- #-------------------------------------------------------------------------- type: function desc: "Enqueue a command to execute a cooperative kernel" diff --git a/unified-runtime/scripts/core/exp-launch-properties.yml b/unified-runtime/scripts/core/exp-launch-properties.yml index 2db278f1bb073..43e631a047c87 100644 --- a/unified-runtime/scripts/core/exp-launch-properties.yml +++ b/unified-runtime/scripts/core/exp-launch-properties.yml @@ -12,10 +12,15 @@ type: header desc: "Intel $OneApi Unified Runtime Experimental APIs for (kernel) Launch Properties" ordinal: "99" --- #-------------------------------------------------------------------------- -type: macro -desc: "The extension string that defines support for the Launch Properties extension, which is returned when querying device extensions." -name: $X_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP -value: "\"$x_exp_launch_properties\"" +type: enum +extend: true +typed_etors: true +desc: "Extension enums for $x_device_info_t to support launch properties." +name: $x_device_info_t +etors: + - name: LAUNCH_PROPERTIES_SUPPORT_EXP + value: "0x3000" + desc: "[$x_bool_t] Returns true if the device supports the use of kernel launch properties." --- #-------------------------------------------------------------------------- type: enum desc: "Specifies a launch property id" diff --git a/unified-runtime/scripts/core/exp-multi-device-compile.yml b/unified-runtime/scripts/core/exp-multi-device-compile.yml index 2553768ae62e9..bd17f5dc236b4 100644 --- a/unified-runtime/scripts/core/exp-multi-device-compile.yml +++ b/unified-runtime/scripts/core/exp-multi-device-compile.yml @@ -11,15 +11,18 @@ type: header desc: "Intel $OneApi Unified Runtime Experimental APIs for multi-device compile" ordinal: "99" - --- #-------------------------------------------------------------------------- -type: macro -desc: | - The extension string which defines support for test - which is returned when querying device extensions. name: $X_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP value: "\"$x_exp_multi_device_compile\"" - +type: enum +extend: true +typed_etors: true +desc: "Extension enums for $x_device_info_t to support multi device compile." +name: $x_device_info_t +etors: + - name: MULTI_DEVICE_COMPILE_SUPPORT_EXP + value: "0x7000" + desc: "[$x_bool_t] Returns true if the device supports the multi device compile experimental feature." --- #-------------------------------------------------------------------------- type: function desc: "Produces an executable program from one program, negates need for the linking step." diff --git a/unified-runtime/scripts/core/exp-usm-p2p.yml b/unified-runtime/scripts/core/exp-usm-p2p.yml index f3ba303c34bb8..5d1b109d5d40e 100644 --- a/unified-runtime/scripts/core/exp-usm-p2p.yml +++ b/unified-runtime/scripts/core/exp-usm-p2p.yml @@ -12,10 +12,15 @@ type: header desc: "Intel $OneApi Unified Runtime Experimental APIs for USM P2P" ordinal: "99" --- #-------------------------------------------------------------------------- -type: macro -desc: "The extension string that defines support for USM P2P which is returned when querying device extensions." -name: $X_USM_P2P_EXTENSION_STRING_EXP -value: "\"$x_exp_usm_p2p\"" +type: enum +extend: true +typed_etors: true +desc: "Extension enums for $x_device_info_t to support USM P2P." +name: $x_device_info_t +etors: + - name: USM_P2P_SUPPORT_EXP + value: "0x4000" + desc: "[$x_bool_t] Returns true if the device supports the USM P2P experimental feature." --- #-------------------------------------------------------------------------- type: enum desc: "Supported peer info" diff --git a/unified-runtime/source/adapters/cuda/device.cpp b/unified-runtime/source/adapters/cuda/device.cpp index 3e0ce05c27306..b8f108bd7fdac 100644 --- a/unified-runtime/source/adapters/cuda/device.cpp +++ b/unified-runtime/source/adapters/cuda/device.cpp @@ -616,13 +616,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, } case UR_DEVICE_INFO_EXTENSIONS: { - std::string SupportedExtensions = "cl_khr_fp64 cl_khr_subgroups "; + std::string SupportedExtensions = "cl_khr_fp64 "; SupportedExtensions += "cl_intel_devicelib_assert "; - // Return supported for the UR command-buffer experimental feature - SupportedExtensions += "ur_exp_command_buffer "; - SupportedExtensions += "ur_exp_usm_p2p "; - SupportedExtensions += "ur_exp_launch_properties "; - SupportedExtensions += " "; int Major = 0; int Minor = 0; @@ -1114,6 +1109,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, } case UR_DEVICE_INFO_LOW_POWER_EVENTS_EXP: return ReturnValue(false); + case UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP: + return ReturnValue(true); + case UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP: + return ReturnValue(true); + case UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP: + return ReturnValue(true); + case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP: + return ReturnValue(false); + default: break; } diff --git a/unified-runtime/source/adapters/hip/device.cpp b/unified-runtime/source/adapters/hip/device.cpp index 783f4899b9f23..b211c052d46b4 100644 --- a/unified-runtime/source/adapters/hip/device.cpp +++ b/unified-runtime/source/adapters/hip/device.cpp @@ -564,22 +564,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, // native asserts are in progress std::string SupportedExtensions = ""; SupportedExtensions += "cl_intel_devicelib_assert "; - SupportedExtensions += "ur_exp_usm_p2p "; - - int RuntimeVersion = 0; - UR_CHECK_ERROR(hipRuntimeGetVersion(&RuntimeVersion)); - - // Return supported for the UR command-buffer experimental feature on - // ROCM 5.5.1 and later. This is to workaround HIP driver bug - // https://github.com/ROCm/HIP/issues/2450 in older versions. - // - // The version is returned as (10000000 major + 1000000 minor + patch). - const int CmdBufDriverMinVersion = 50530202; // ROCM 5.5.1 - if (RuntimeVersion >= CmdBufDriverMinVersion) { - SupportedExtensions += "ur_exp_command_buffer "; - } - - SupportedExtensions += " "; hipDeviceProp_t Props; detail::ur::assertion(hipGetDeviceProperties(&Props, hDevice->get()) == @@ -1075,22 +1059,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, return ReturnValue( static_cast(0)); case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP: { - int DriverVersion = 0; - UR_CHECK_ERROR(hipDriverGetVersion(&DriverVersion)); + int RuntimeVersion = 0; + UR_CHECK_ERROR(hipRuntimeGetVersion(&RuntimeVersion)); // Return supported for the UR command-buffer experimental feature on // ROCM 5.5.1 and later. This is to workaround HIP driver bug // https://github.com/ROCm/HIP/issues/2450 in older versions. // // The version is returned as (10000000 major + 1000000 minor + patch). - const int CmdBufDriverMinVersion = 50530202; // ROCM 5.5.1 - return ReturnValue(DriverVersion >= CmdBufDriverMinVersion); + const int CmdBufRuntimeMinVersion = 50530202; // ROCM 5.5.1 + return ReturnValue(RuntimeVersion >= CmdBufRuntimeMinVersion); } case UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP: { - int DriverVersion = 0; - UR_CHECK_ERROR(hipDriverGetVersion(&DriverVersion)); - const int CmdBufDriverMinVersion = 50530202; // ROCM 5.5.1 - if (DriverVersion < CmdBufDriverMinVersion) { + int RuntimeVersion = 0; + UR_CHECK_ERROR(hipRuntimeGetVersion(&RuntimeVersion)); + const int CmdBufRuntimeMinVersion = 50530202; // ROCM 5.5.1 + if (RuntimeVersion < CmdBufRuntimeMinVersion) { return ReturnValue( static_cast(0)); } @@ -1107,6 +1091,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, case UR_DEVICE_INFO_LOW_POWER_EVENTS_EXP: { return ReturnValue(false); } + case UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP: + return ReturnValue(true); + case UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP: + return ReturnValue(false); + case UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP: + return ReturnValue(true); + case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP: + return ReturnValue(false); default: break; } diff --git a/unified-runtime/source/adapters/level_zero/device.cpp b/unified-runtime/source/adapters/level_zero/device.cpp index 0d5323f6c3b03..0e194d971054c 100644 --- a/unified-runtime/source/adapters/level_zero/device.cpp +++ b/unified-runtime/source/adapters/level_zero/device.cpp @@ -291,12 +291,6 @@ ur_result_t urDeviceGetInfo( (Device->ZeDeviceProperties->deviceId & 0xff0) == 0xbd0) SupportedExtensions += ("cl_intel_bfloat16_conversions "); - // Return supported for the UR command-buffer experimental feature - SupportedExtensions += ("ur_exp_command_buffer "); - // Return supported for the UR multi-device compile experimental feature - SupportedExtensions += ("ur_exp_multi_device_compile "); - SupportedExtensions += ("ur_exp_usm_p2p "); - return ReturnValue(SupportedExtensions.c_str()); } case UR_DEVICE_INFO_NAME: @@ -1210,6 +1204,14 @@ ur_result_t urDeviceGetInfo( return ReturnValue(false); case UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED: return ReturnValue(false); + case UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP: + return ReturnValue(true); + case UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP: + return ReturnValue(false); + case UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP: + return ReturnValue(true); + case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP: + return ReturnValue(true); default: logger::error("Unsupported ParamName in urGetDeviceInfo"); logger::error("ParamNameParamName={}(0x{})", ParamName, diff --git a/unified-runtime/source/adapters/native_cpu/device.cpp b/unified-runtime/source/adapters/native_cpu/device.cpp index 6deca1ac37ac2..8ad1185a9a2ff 100644 --- a/unified-runtime/source/adapters/native_cpu/device.cpp +++ b/unified-runtime/source/adapters/native_cpu/device.cpp @@ -434,6 +434,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, case UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS: return ReturnValue(false); + case UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP: + return ReturnValue(false); + + case UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP: + return ReturnValue(false); + + case UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP: + return ReturnValue(false); + + case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP: + return ReturnValue(true); + default: DIE_NO_IMPLEMENTATION; } diff --git a/unified-runtime/source/adapters/opencl/device.cpp b/unified-runtime/source/adapters/opencl/device.cpp index 1267b2e94177a..ce36f620bd4f3 100644 --- a/unified-runtime/source/adapters/opencl/device.cpp +++ b/unified-runtime/source/adapters/opencl/device.cpp @@ -1015,7 +1015,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, case UR_DEVICE_INFO_VERSION: case UR_EXT_DEVICE_INFO_OPENCL_C_VERSION: case UR_DEVICE_INFO_BUILT_IN_KERNELS: - case UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES: { + case UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES: + case UR_DEVICE_INFO_EXTENSIONS: { /* We can just use the OpenCL outputs because the sizes of OpenCL types * are the same as UR. * | CL | UR | Size | @@ -1124,22 +1125,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, return ReturnValue.template operator()(SubGroupSizes.data(), SubGroupSizes.size()); } - case UR_DEVICE_INFO_EXTENSIONS: { - cl_device_id Dev = cl_adapter::cast(hDevice); - size_t ExtSize = 0; - CL_RETURN_ON_FAILURE( - clGetDeviceInfo(Dev, CL_DEVICE_EXTENSIONS, 0, nullptr, &ExtSize)); - - std::string ExtStr(ExtSize, '\0'); - CL_RETURN_ON_FAILURE(clGetDeviceInfo(Dev, CL_DEVICE_EXTENSIONS, ExtSize, - ExtStr.data(), nullptr)); - - std::string SupportedExtensions(ExtStr.c_str()); - if (ExtStr.find("cl_khr_command_buffer") != std::string::npos) { - SupportedExtensions += " ur_exp_command_buffer"; - } - return ReturnValue(SupportedExtensions.c_str()); - } case UR_DEVICE_INFO_UUID: { // Use the cl_khr_device_uuid extension, if available. @@ -1227,6 +1212,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, return ReturnValue(false); case UR_DEVICE_INFO_LOW_POWER_EVENTS_EXP: return ReturnValue(false); + case UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP: + return ReturnValue(false); + case UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP: + return ReturnValue(false); + case UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP: + return ReturnValue(true); + case UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP: + return ReturnValue(false); default: { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp index acb1f65c94ce5..e4ae20fc504d3 100644 --- a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp +++ b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp @@ -496,7 +496,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( if (pPropValue == NULL && pPropSizeRet == NULL) return UR_RESULT_ERROR_INVALID_NULL_POINTER; - if (UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName) + if (UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP < propName) return UR_RESULT_ERROR_INVALID_ENUMERATION; if (propSize == 0 && pPropValue != NULL) diff --git a/unified-runtime/source/loader/ur_libapi.cpp b/unified-runtime/source/loader/ur_libapi.cpp index e5797537632bf..bfecfe12040b4 100644 --- a/unified-runtime/source/loader/ur_libapi.cpp +++ b/unified-runtime/source/loader/ur_libapi.cpp @@ -869,7 +869,7 @@ ur_result_t UR_APICALL urDeviceGetSelected( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName` +/// + `::UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/unified-runtime/source/ur_api.cpp b/unified-runtime/source/ur_api.cpp index c5651c0fc4f83..d17c5d6b69cdc 100644 --- a/unified-runtime/source/ur_api.cpp +++ b/unified-runtime/source/ur_api.cpp @@ -783,7 +783,7 @@ ur_result_t UR_APICALL urDeviceGetSelected( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName` +/// + `::UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/unified-runtime/test/conformance/enqueue/urEnqueueKernelLaunchAndMemcpyInOrder.cpp b/unified-runtime/test/conformance/enqueue/urEnqueueKernelLaunchAndMemcpyInOrder.cpp index c97471aee8a34..59051570bfe53 100644 --- a/unified-runtime/test/conformance/enqueue/urEnqueueKernelLaunchAndMemcpyInOrder.cpp +++ b/unified-runtime/test/conformance/enqueue/urEnqueueKernelLaunchAndMemcpyInOrder.cpp @@ -274,21 +274,10 @@ TEST_P(urEnqueueKernelLaunchIncrementMultiDeviceTest, Success) { auto waitOnEvent = std::get<0>(getParam()).value; auto runBackgroundCheck = std::get<1>(getParam()).value; - size_t returned_size; - ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_EXTENSIONS, 0, - nullptr, &returned_size)); - - std::unique_ptr returned_extensions(new char[returned_size]); - - ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_EXTENSIONS, - returned_size, returned_extensions.get(), + ur_bool_t usm_p2p_support = false; + ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP, + sizeof(usm_p2p_support), &usm_p2p_support, nullptr)); - - std::string_view extensions_string(returned_extensions.get()); - const bool usm_p2p_support = - extensions_string.find(UR_USM_P2P_EXTENSION_STRING_EXP) != - std::string::npos; - if (!usm_p2p_support) { GTEST_SKIP() << "EXP usm p2p feature is not supported."; } diff --git a/unified-runtime/test/conformance/exp_command_buffer/fixtures.h b/unified-runtime/test/conformance/exp_command_buffer/fixtures.h index e0ddc0b3898c0..f5ac7b1ecf4a4 100644 --- a/unified-runtime/test/conformance/exp_command_buffer/fixtures.h +++ b/unified-runtime/test/conformance/exp_command_buffer/fixtures.h @@ -16,20 +16,10 @@ namespace uur { namespace command_buffer { static void checkCommandBufferSupport(ur_device_handle_t device) { - size_t returned_size; - ASSERT_SUCCESS(urDeviceGetInfo(device, UR_DEVICE_INFO_EXTENSIONS, 0, nullptr, - &returned_size)); - - std::unique_ptr returned_extensions(new char[returned_size]); - - ASSERT_SUCCESS(urDeviceGetInfo(device, UR_DEVICE_INFO_EXTENSIONS, - returned_size, returned_extensions.get(), - nullptr)); - - std::string_view extensions_string(returned_extensions.get()); - bool command_buffer_support = - extensions_string.find(UR_COMMAND_BUFFER_EXTENSION_STRING_EXP) != - std::string::npos; + ur_bool_t command_buffer_support = false; + ASSERT_SUCCESS(urDeviceGetInfo( + device, UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP, + sizeof(command_buffer_support), &command_buffer_support, nullptr)); if (!command_buffer_support) { GTEST_SKIP() << "EXP command-buffer feature is not supported."; diff --git a/unified-runtime/test/conformance/exp_launch_properties/launch_properties.cpp b/unified-runtime/test/conformance/exp_launch_properties/launch_properties.cpp index 8de3fdaf4793d..b07e0521733df 100644 --- a/unified-runtime/test/conformance/exp_launch_properties/launch_properties.cpp +++ b/unified-runtime/test/conformance/exp_launch_properties/launch_properties.cpp @@ -22,21 +22,10 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE(urEnqueueKernelLaunchCustomTest); TEST_P(urEnqueueKernelLaunchCustomTest, Success) { UUR_KNOWN_FAILURE_ON(uur::NativeCPU{}); - size_t returned_size; - ASSERT_SUCCESS(urDeviceGetInfo(device, UR_DEVICE_INFO_EXTENSIONS, 0, nullptr, - &returned_size)); - - std::unique_ptr returned_extensions(new char[returned_size]); - - ASSERT_SUCCESS(urDeviceGetInfo(device, UR_DEVICE_INFO_EXTENSIONS, - returned_size, returned_extensions.get(), - nullptr)); - - std::string_view extensions_string(returned_extensions.get()); - const bool launch_properties_support = - extensions_string.find(UR_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP) != - std::string::npos; - + ur_bool_t launch_properties_support = false; + ASSERT_SUCCESS(urDeviceGetInfo( + device, UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP, + sizeof(launch_properties_support), &launch_properties_support, nullptr)); if (!launch_properties_support) { GTEST_SKIP() << "EXP launch properties feature is not supported."; } @@ -44,6 +33,7 @@ TEST_P(urEnqueueKernelLaunchCustomTest, Success) { std::vector props(1); props[0].id = UR_EXP_LAUNCH_PROPERTY_ID_IGNORE; + size_t returned_size = 0; ASSERT_SUCCESS(urDeviceGetInfo(device, UR_DEVICE_INFO_PROFILE, 0, nullptr, &returned_size)); diff --git a/unified-runtime/test/conformance/exp_usm_p2p/usm_p2p.cpp b/unified-runtime/test/conformance/exp_usm_p2p/usm_p2p.cpp index b978bae1c5b1a..126ed004f84ed 100644 --- a/unified-runtime/test/conformance/exp_usm_p2p/usm_p2p.cpp +++ b/unified-runtime/test/conformance/exp_usm_p2p/usm_p2p.cpp @@ -14,25 +14,15 @@ TEST_P(urP2PTest, Success) { GTEST_SKIP(); } - size_t returned_size; - ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_EXTENSIONS, 0, - nullptr, &returned_size)); - - std::unique_ptr returned_extensions(new char[returned_size]); - - ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_EXTENSIONS, - returned_size, returned_extensions.get(), + ur_bool_t usm_p2p_support = false; + ASSERT_SUCCESS(urDeviceGetInfo(devices[0], UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP, + sizeof(usm_p2p_support), &usm_p2p_support, nullptr)); - - std::string_view extensions_string(returned_extensions.get()); - const bool usm_p2p_support = - extensions_string.find(UR_USM_P2P_EXTENSION_STRING_EXP) != - std::string::npos; - if (!usm_p2p_support) { GTEST_SKIP() << "EXP usm p2p feature is not supported."; } + size_t returned_size = 0; int value; ASSERT_SUCCESS(urUsmP2PPeerAccessGetInfoExp( /// [in] handle of the command device object diff --git a/unified-runtime/tools/urinfo/urinfo.hpp b/unified-runtime/tools/urinfo/urinfo.hpp index d01245138f28e..b589670f8b2c8 100644 --- a/unified-runtime/tools/urinfo/urinfo.hpp +++ b/unified-runtime/tools/urinfo/urinfo.hpp @@ -420,5 +420,16 @@ inline void printDeviceInfos(ur_device_handle_t hDevice, std::cout << prefix; printDeviceInfo( hDevice, UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP); + std::cout << prefix; + printDeviceInfo(hDevice, + UR_DEVICE_INFO_LAUNCH_PROPERTIES_SUPPORT_EXP); + std::cout << prefix; + printDeviceInfo(hDevice, UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP); + std::cout << prefix; + printDeviceInfo(hDevice, + UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP); + std::cout << prefix; + printDeviceInfo(hDevice, + UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP); } } // namespace urinfo From aab090c4f6a486a7e1049bf06f634dda82f8ba84 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Tue, 12 Nov 2024 13:41:21 +0000 Subject: [PATCH 3/4] Fix incorrect enum value in multi-device compile. Also update DEVICE_INFO_EXTENSIONS description. --- unified-runtime/include/ur_api.h | 5 +++-- unified-runtime/scripts/core/device.yml | 2 +- unified-runtime/scripts/core/exp-multi-device-compile.yml | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/unified-runtime/include/ur_api.h b/unified-runtime/include/ur_api.h index b380bfe807508..1f88e1591227d 100644 --- a/unified-runtime/include/ur_api.h +++ b/unified-runtime/include/ur_api.h @@ -2060,7 +2060,8 @@ typedef enum ur_device_info_t { UR_DEVICE_INFO_VERSION = 70, /// [char[]] Version of backend runtime UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION = 71, - /// [char[]] Return a space separated list of extension names + /// [char[]] Return a string representing any backend extensions supported + /// by the adapter. Format and content is entirely adapter defined. UR_DEVICE_INFO_EXTENSIONS = 72, /// [size_t] Maximum size in bytes of internal printf buffer UR_DEVICE_INFO_PRINTF_BUFFER_SIZE = 73, @@ -2300,7 +2301,7 @@ typedef enum ur_device_info_t { UR_DEVICE_INFO_COOPERATIVE_KERNEL_SUPPORT_EXP = 0x5000, /// [::ur_bool_t] Returns true if the device supports the multi device /// compile experimental feature. - UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP = 0x7000, + UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP = 0x6000, /// @cond UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond diff --git a/unified-runtime/scripts/core/device.yml b/unified-runtime/scripts/core/device.yml index 1f94b20346042..88620a628f24f 100644 --- a/unified-runtime/scripts/core/device.yml +++ b/unified-runtime/scripts/core/device.yml @@ -343,7 +343,7 @@ etors: - name: BACKEND_RUNTIME_VERSION desc: "[char[]] Version of backend runtime" - name: EXTENSIONS - desc: "[char[]] Return a space separated list of extension names" + desc: "[char[]] Return a string representing any backend extensions supported by the adapter. Format and content is entirely adapter defined." - name: PRINTF_BUFFER_SIZE desc: "[size_t] Maximum size in bytes of internal printf buffer" - name: PREFERRED_INTEROP_USER_SYNC diff --git a/unified-runtime/scripts/core/exp-multi-device-compile.yml b/unified-runtime/scripts/core/exp-multi-device-compile.yml index bd17f5dc236b4..f010342c96061 100644 --- a/unified-runtime/scripts/core/exp-multi-device-compile.yml +++ b/unified-runtime/scripts/core/exp-multi-device-compile.yml @@ -12,8 +12,6 @@ type: header desc: "Intel $OneApi Unified Runtime Experimental APIs for multi-device compile" ordinal: "99" --- #-------------------------------------------------------------------------- -name: $X_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP -value: "\"$x_exp_multi_device_compile\"" type: enum extend: true typed_etors: true @@ -21,7 +19,7 @@ desc: "Extension enums for $x_device_info_t to support multi device compile." name: $x_device_info_t etors: - name: MULTI_DEVICE_COMPILE_SUPPORT_EXP - value: "0x7000" + value: "0x6000" desc: "[$x_bool_t] Returns true if the device supports the multi device compile experimental feature." --- #-------------------------------------------------------------------------- type: function From 748cf381eed372209ce2bfe5d3af403fe9d6ee4a Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Wed, 26 Feb 2025 10:53:07 +0000 Subject: [PATCH 4/4] Remove command buffer string from urmock override. --- sycl/unittests/helpers/UrMock.hpp | 2 +- unified-runtime/source/adapters/opencl/device.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sycl/unittests/helpers/UrMock.hpp b/sycl/unittests/helpers/UrMock.hpp index 53c4db96dd84d..cc4b3d7a0ef8f 100644 --- a/sycl/unittests/helpers/UrMock.hpp +++ b/sycl/unittests/helpers/UrMock.hpp @@ -156,7 +156,7 @@ inline ur_result_t mock_urDeviceGetInfo(void *pParams) { auto params = reinterpret_cast(pParams); constexpr char MockDeviceName[] = "Mock device"; constexpr char MockSupportedExtensions[] = - "cl_khr_fp64 cl_khr_fp16 cl_khr_il_program ur_exp_command_buffer"; + "cl_khr_fp64 cl_khr_fp16 cl_khr_il_program"; switch (*params->ppropName) { case UR_DEVICE_INFO_TYPE: { // Act like any device is a GPU. diff --git a/unified-runtime/source/adapters/opencl/device.cpp b/unified-runtime/source/adapters/opencl/device.cpp index 7d8e4e7dd30a9..47c648715651a 100644 --- a/unified-runtime/source/adapters/opencl/device.cpp +++ b/unified-runtime/source/adapters/opencl/device.cpp @@ -1545,6 +1545,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, CL_RETURN_ON_FAILURE(clGetDeviceInfo( cl_adapter::cast(hDevice), CL_DEVICE_EXTENSIONS, propSize, pPropValue, pPropSizeRet)); + return UR_RESULT_SUCCESS; } case UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP: return ReturnValue(false);