From f5fbb5e913e5ef8df2d8cf5c1a1febb15bca380e Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 20 Jul 2023 17:19:16 +0100 Subject: [PATCH] [ur] Add missing virtual memory support query Introduce the missing `UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT` enumeration for use with `urDeviceGetInfo` to determine if the device supports the virtual memory interfaces. --- include/ur.py | 1 + include/ur_api.h | 1 + scripts/core/device.yml | 2 ++ source/common/ur_params.hpp | 18 ++++++++++++++++++ test/conformance/device/urDeviceGetInfo.cpp | 3 ++- 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/ur.py b/include/ur.py index 770e1d68a2..f48acbd21b 100644 --- a/include/ur.py +++ b/include/ur.py @@ -826,6 +826,7 @@ class ur_device_info_v(IntEnum): 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. + VIRTUAL_MEMORY_SUPPORT = 114 ## [::ur_bool_t] return true if the device supports virtual memory. BINDLESS_IMAGES_SUPPORT_EXP = 0x2000 ## [::ur_bool_t] returns true if the device supports the creation of ## bindless images BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP = 0x2001 ## [::ur_bool_t] returns true if the device supports the creation of diff --git a/include/ur_api.h b/include/ur_api.h index 9c14872325..1ff0ba0905 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -1453,6 +1453,7 @@ typedef enum ur_device_info_t { 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. + UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT = 114, ///< [::ur_bool_t] return true if the device supports virtual memory. UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP = 0x2000, ///< [::ur_bool_t] returns true if the device supports the creation of ///< bindless images UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP = 0x2001, ///< [::ur_bool_t] returns true if the device supports the creation of diff --git a/scripts/core/device.yml b/scripts/core/device.yml index 3697095eea..4fd4b09d93 100644 --- a/scripts/core/device.yml +++ b/scripts/core/device.yml @@ -383,6 +383,8 @@ etors: desc: "[uint32_t] The maximum number of registers available per block." - 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." + - name: VIRTUAL_MEMORY_SUPPORT + desc: "[$x_bool_t] return true if the device supports virtual memory." --- #-------------------------------------------------------------------------- type: function desc: "Retrieves various information about device" diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 8278d36e04..2f9789506e 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -2768,6 +2768,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { os << "UR_DEVICE_INFO_IP_VERSION"; break; + case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: + os << "UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT"; + break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: os << "UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP"; break; @@ -4392,6 +4396,20 @@ inline void serializeTagged(std::ostream &os, const void *ptr, os << ")"; } break; + case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: { + 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; + } + os << (void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { diff --git a/test/conformance/device/urDeviceGetInfo.cpp b/test/conformance/device/urDeviceGetInfo.cpp index 3eb73cb53c..e5e9f7c310 100644 --- a/test/conformance/device/urDeviceGetInfo.cpp +++ b/test/conformance/device/urDeviceGetInfo.cpp @@ -231,7 +231,8 @@ INSTANTIATE_TEST_SUITE_P( UR_DEVICE_INFO_ASYNC_BARRIER, // UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT, // UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED, // - UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP // + UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP, // + UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT // ), [](const ::testing::TestParamInfo &info) { std::stringstream ss;