Skip to content

Commit 9a9c057

Browse files
authored
Merge pull request #573 from dm-vodopyanov/extend-ur_device_info_t-with-device_ip
[UR] Add UR_DEVICE_INFO_IP_VERSION property
2 parents 9f0d891 + 53eb210 commit 9a9c057

File tree

7 files changed

+30
-4
lines changed

7 files changed

+30
-4
lines changed

include/ur.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ class ur_device_info_v(IntEnum):
569569
HOST_PIPE_READ_WRITE_SUPPORTED = 111 ## [::ur_bool_t] Return true if the device supports enqueing commands to
570570
## read and write pipes from the host.
571571
MAX_REGISTERS_PER_WORK_GROUP = 112 ## [uint32_t] The maximum number of registers available per block.
572+
IP_VERSION = 113 ## [uint32_t] The device IP version. The meaning of the device IP version
573+
## is implementation-defined, but newer devices should have a higher
574+
## version than older devices.
572575

573576
class ur_device_info_t(c_int):
574577
def __str__(self):

include/ur_api.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,9 @@ typedef enum ur_device_info_t {
929929
UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED = 111, ///< [::ur_bool_t] Return true if the device supports enqueing commands to
930930
///< read and write pipes from the host.
931931
UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP = 112, ///< [uint32_t] The maximum number of registers available per block.
932+
UR_DEVICE_INFO_IP_VERSION = 113, ///< [uint32_t] The device IP version. The meaning of the device IP version
933+
///< is implementation-defined, but newer devices should have a higher
934+
///< version than older devices.
932935
/// @cond
933936
UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff
934937
/// @endcond
@@ -953,7 +956,7 @@ typedef enum ur_device_info_t {
953956
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
954957
/// + `NULL == hDevice`
955958
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
956-
/// + `::UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP < propName`
959+
/// + `::UR_DEVICE_INFO_IP_VERSION < propName`
957960
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
958961
/// + If `propName` is not supported by the adapter.
959962
/// - ::UR_RESULT_ERROR_INVALID_SIZE

scripts/core/device.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ etors:
383383
desc: "[$x_bool_t] Return true if the device supports enqueing commands to read and write pipes from the host."
384384
- name: MAX_REGISTERS_PER_WORK_GROUP
385385
desc: "[uint32_t] The maximum number of registers available per block."
386+
- name: IP_VERSION
387+
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."
386388
--- #--------------------------------------------------------------------------
387389
type: function
388390
desc: "Retrieves various information about device"

source/common/ur_params.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
17561756
case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP:
17571757
os << "UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP";
17581758
break;
1759+
1760+
case UR_DEVICE_INFO_IP_VERSION:
1761+
os << "UR_DEVICE_INFO_IP_VERSION";
1762+
break;
17591763
default:
17601764
os << "unknown enumerator";
17611765
break;
@@ -3302,6 +3306,20 @@ inline void serializeTagged(std::ostream &os, const void *ptr,
33023306

33033307
os << ")";
33043308
} break;
3309+
3310+
case UR_DEVICE_INFO_IP_VERSION: {
3311+
const uint32_t *tptr = (const uint32_t *)ptr;
3312+
if (sizeof(uint32_t) > size) {
3313+
os << "invalid size (is: " << size
3314+
<< ", expected: >=" << sizeof(uint32_t) << ")";
3315+
return;
3316+
}
3317+
os << (void *)(tptr) << " (";
3318+
3319+
os << *tptr;
3320+
3321+
os << ")";
3322+
} break;
33053323
default:
33063324
os << "unknown enumerator";
33073325
break;

source/loader/layers/validation/ur_valddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo(
369369
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
370370
}
371371

372-
if (UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP < propName) {
372+
if (UR_DEVICE_INFO_IP_VERSION < propName) {
373373
return UR_RESULT_ERROR_INVALID_ENUMERATION;
374374
}
375375

source/loader/ur_libapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ ur_result_t UR_APICALL urDeviceGet(
436436
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
437437
/// + `NULL == hDevice`
438438
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
439-
/// + `::UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP < propName`
439+
/// + `::UR_DEVICE_INFO_IP_VERSION < propName`
440440
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
441441
/// + If `propName` is not supported by the adapter.
442442
/// - ::UR_RESULT_ERROR_INVALID_SIZE

source/ur_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ ur_result_t UR_APICALL urDeviceGet(
360360
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
361361
/// + `NULL == hDevice`
362362
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
363-
/// + `::UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP < propName`
363+
/// + `::UR_DEVICE_INFO_IP_VERSION < propName`
364364
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
365365
/// + If `propName` is not supported by the adapter.
366366
/// - ::UR_RESULT_ERROR_INVALID_SIZE

0 commit comments

Comments
 (0)