From c6faeb300b3d5bedfce6b9f2fdfdd2d95fc7e170 Mon Sep 17 00:00:00 2001 From: Dmitry Vodopyanov Date: Tue, 6 Jun 2023 14:07:59 +0200 Subject: [PATCH 1/3] Add UR_DEVICE_INFO_DEVICE_IP_VERSION property This patch extends `ur_device_info_t` with the new property `UR_DEVICE_INFO_DEVICE_IP_VERSION`. This property is needed to query the device architecture ID value as described in the [Level Zero spec](https://github.com/oneapi-src/level-zero-spec/pull/23). The property will be used in the implementation of host API of [sycl_ext_oneapi_device_architecture](https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_device_architecture.asciidoc) extension --- include/ur_api.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ur_api.h b/include/ur_api.h index 79b732acdd..b6f958cf6e 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -925,6 +925,9 @@ typedef enum ur_device_info_t { UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED = 111, ///< [::ur_bool_t] Return true if the device supports enqueing commands to ///< read and write pipes from the host. UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP = 112, ///< [uint32_t] The maximum number of registers available per block. + UR_DEVICE_INFO_DEVICE_IP_VERSION = 113, ///< [uint32_t] Device IP version. The meaning of the device IP version is + ///< implementation-defined, but newer devices should have a higher version + ///< than older devices. /// @cond UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond From f9cf6e7d516b1ec078d845c8668d6dc3c0897747 Mon Sep 17 00:00:00 2001 From: Dmitry Vodoypanov Date: Mon, 12 Jun 2023 09:36:46 -0400 Subject: [PATCH 2/3] Apply CR comment --- include/ur.py | 3 +++ include/ur_api.h | 8 ++++---- scripts/core/device.yml | 2 ++ source/common/ur_params.hpp | 18 ++++++++++++++++++ source/loader/layers/validation/ur_valddi.cpp | 2 +- source/loader/ur_libapi.cpp | 2 +- source/ur_api.cpp | 2 +- 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/include/ur.py b/include/ur.py index 867e04a6cc..a3ab80e809 100644 --- a/include/ur.py +++ b/include/ur.py @@ -565,6 +565,9 @@ class ur_device_info_v(IntEnum): HOST_PIPE_READ_WRITE_SUPPORTED = 111 ## [::ur_bool_t] Return true if the device supports enqueing commands to ## read and write pipes from the host. MAX_REGISTERS_PER_WORK_GROUP = 112 ## [uint32_t] The maximum number of registers available per block. + DEVICE_IP_VERSION = 113 ## [uint32_t] The device IP version. The meaning of the device IP version + ## is implementation-defined, but newer devices should have a higher + ## version than older devices. class ur_device_info_t(c_int): def __str__(self): diff --git a/include/ur_api.h b/include/ur_api.h index b6f958cf6e..8b260ebf8c 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -925,9 +925,9 @@ typedef enum ur_device_info_t { UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED = 111, ///< [::ur_bool_t] Return true if the device supports enqueing commands to ///< read and write pipes from the host. UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP = 112, ///< [uint32_t] The maximum number of registers available per block. - UR_DEVICE_INFO_DEVICE_IP_VERSION = 113, ///< [uint32_t] Device IP version. The meaning of the device IP version is - ///< implementation-defined, but newer devices should have a higher version - ///< than older devices. + UR_DEVICE_INFO_DEVICE_IP_VERSION = 113, ///< [uint32_t] The device IP version. The meaning of the device IP version + ///< is implementation-defined, but newer devices should have a higher + ///< version than older devices. /// @cond UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -952,7 +952,7 @@ typedef enum ur_device_info_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP < propName` +/// + `::UR_DEVICE_INFO_DEVICE_IP_VERSION < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/scripts/core/device.yml b/scripts/core/device.yml index 2e8caa20c6..651a11e1c5 100644 --- a/scripts/core/device.yml +++ b/scripts/core/device.yml @@ -383,6 +383,8 @@ etors: desc: "[$x_bool_t] Return true if the device supports enqueing commands to read and write pipes from the host." - name: MAX_REGISTERS_PER_WORK_GROUP desc: "[uint32_t] The maximum number of registers available per block." + - name: DEVICE_IP_VERSION + desc: "[uint32_t] The device IP version. The meaning of the device IP version is implementation-defined, but newer devices should have a higher version than older devices." --- #-------------------------------------------------------------------------- type: function desc: "Retrieves various information about device" diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 783d9ef03b..c6b35d8164 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -1732,6 +1732,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP: os << "UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP"; break; + + case UR_DEVICE_INFO_DEVICE_IP_VERSION: + os << "UR_DEVICE_INFO_DEVICE_IP_VERSION"; + break; default: os << "unknown enumerator"; break; @@ -3278,6 +3282,20 @@ inline void serializeTagged(std::ostream &os, const void *ptr, os << ")"; } break; + + case UR_DEVICE_INFO_DEVICE_IP_VERSION: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(uint32_t) << ")"; + return; + } + os << (void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; default: os << "unknown enumerator"; break; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index fe9d22d3a7..0f7b4376a1 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -369,7 +369,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP < propName) { + if (UR_DEVICE_INFO_DEVICE_IP_VERSION < propName) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 5bbd16a6c2..5f6b83e94c 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -436,7 +436,7 @@ ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP < propName` +/// + `::UR_DEVICE_INFO_DEVICE_IP_VERSION < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 6584106e66..60e950655f 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -360,7 +360,7 @@ ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP < propName` +/// + `::UR_DEVICE_INFO_DEVICE_IP_VERSION < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE From 53eb2104392c07fbdfa3a6425592164a977bdf1b Mon Sep 17 00:00:00 2001 From: Dmitry Vodoypanov Date: Tue, 13 Jun 2023 07:07:51 -0400 Subject: [PATCH 3/3] DEVICE_IP_VERSION -> IP_VERSION --- include/ur.py | 2 +- include/ur_api.h | 4 ++-- scripts/core/device.yml | 2 +- source/common/ur_params.hpp | 6 +++--- source/loader/layers/validation/ur_valddi.cpp | 2 +- source/loader/ur_libapi.cpp | 2 +- source/ur_api.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/ur.py b/include/ur.py index a3ab80e809..d498f17107 100644 --- a/include/ur.py +++ b/include/ur.py @@ -565,7 +565,7 @@ class ur_device_info_v(IntEnum): HOST_PIPE_READ_WRITE_SUPPORTED = 111 ## [::ur_bool_t] Return true if the device supports enqueing commands to ## read and write pipes from the host. MAX_REGISTERS_PER_WORK_GROUP = 112 ## [uint32_t] The maximum number of registers available per block. - DEVICE_IP_VERSION = 113 ## [uint32_t] The device IP version. The meaning of the device IP version + IP_VERSION = 113 ## [uint32_t] The device IP version. The meaning of the device IP version ## is implementation-defined, but newer devices should have a higher ## version than older devices. diff --git a/include/ur_api.h b/include/ur_api.h index 8b260ebf8c..9e6430f4ad 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -925,7 +925,7 @@ typedef enum ur_device_info_t { UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED = 111, ///< [::ur_bool_t] Return true if the device supports enqueing commands to ///< read and write pipes from the host. UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP = 112, ///< [uint32_t] The maximum number of registers available per block. - UR_DEVICE_INFO_DEVICE_IP_VERSION = 113, ///< [uint32_t] The device IP version. The meaning of the device IP version + UR_DEVICE_INFO_IP_VERSION = 113, ///< [uint32_t] The device IP version. The meaning of the device IP version ///< is implementation-defined, but newer devices should have a higher ///< version than older devices. /// @cond @@ -952,7 +952,7 @@ typedef enum ur_device_info_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_DEVICE_IP_VERSION < propName` +/// + `::UR_DEVICE_INFO_IP_VERSION < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/scripts/core/device.yml b/scripts/core/device.yml index 651a11e1c5..fc34bcc6fa 100644 --- a/scripts/core/device.yml +++ b/scripts/core/device.yml @@ -383,7 +383,7 @@ etors: desc: "[$x_bool_t] Return true if the device supports enqueing commands to read and write pipes from the host." - name: MAX_REGISTERS_PER_WORK_GROUP desc: "[uint32_t] The maximum number of registers available per block." - - name: DEVICE_IP_VERSION + - name: IP_VERSION desc: "[uint32_t] The device IP version. The meaning of the device IP version is implementation-defined, but newer devices should have a higher version than older devices." --- #-------------------------------------------------------------------------- type: function diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index c6b35d8164..4174456a0f 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -1733,8 +1733,8 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { os << "UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP"; break; - case UR_DEVICE_INFO_DEVICE_IP_VERSION: - os << "UR_DEVICE_INFO_DEVICE_IP_VERSION"; + case UR_DEVICE_INFO_IP_VERSION: + os << "UR_DEVICE_INFO_IP_VERSION"; break; default: os << "unknown enumerator"; @@ -3283,7 +3283,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_DEVICE_IP_VERSION: { + case UR_DEVICE_INFO_IP_VERSION: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { os << "invalid size (is: " << size diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 0f7b4376a1..68dcbbc045 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -369,7 +369,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (UR_DEVICE_INFO_DEVICE_IP_VERSION < propName) { + if (UR_DEVICE_INFO_IP_VERSION < propName) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 5f6b83e94c..61f702087e 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -436,7 +436,7 @@ ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_DEVICE_IP_VERSION < propName` +/// + `::UR_DEVICE_INFO_IP_VERSION < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 60e950655f..7a8071457a 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -360,7 +360,7 @@ ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_DEVICE_IP_VERSION < propName` +/// + `::UR_DEVICE_INFO_IP_VERSION < propName` /// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// + If `propName` is not supported by the adapter. /// - ::UR_RESULT_ERROR_INVALID_SIZE