Skip to content

[UR] Add UR_DEVICE_INFO_IP_VERSION property #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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):
Expand Down
5 changes: 4 additions & 1 deletion include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_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
Expand All @@ -949,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_IP_VERSION < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
2 changes: 2 additions & 0 deletions scripts/core/device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 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"
Expand Down
18 changes: 18 additions & 0 deletions source/common/ur_params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_IP_VERSION:
os << "UR_DEVICE_INFO_IP_VERSION";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -3278,6 +3282,20 @@ inline void serializeTagged(std::ostream &os, const void *ptr,

os << ")";
} break;

case UR_DEVICE_INFO_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;
Expand Down
2 changes: 1 addition & 1 deletion source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_IP_VERSION < propName) {
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}

Expand Down
2 changes: 1 addition & 1 deletion source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_IP_VERSION < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
2 changes: 1 addition & 1 deletion source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_IP_VERSION < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down