Skip to content

Commit

Permalink
Improvements to align CTS and Spec for Device:
Browse files Browse the repository at this point in the history
- Rework urDeviceGetInfoTest to move all enums to their own tests instead of a switch case - oneapi-src#2290
- Remove the UR/OpenCL Device enum map function - no point maintaining both a switch case and a separate mapping function
- Update some spec wording for consistency
- Add missing Device info enums to OpenCL adapater
- Add new urDevicePartition test for checking UR_DEVICE_INFO_PARENT_DEVICE
- Move UUR_RETURN_ON_FATAL_FAILURE and UUR_ASSERT_SUCCESS_OR_UNSUPPORTED to join similar macros in checks.h
- Update spec to say info queries that return char[] are null-terminated
- Update UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH/HEIGHT/PITCH should be uint32_t, matching SYCL RT
- Add missing unsupported device enums to HIP adapter

wip
  • Loading branch information
martygrant committed Jan 27, 2025
1 parent e370a2b commit b12864d
Show file tree
Hide file tree
Showing 18 changed files with 3,620 additions and 908 deletions.
95 changes: 48 additions & 47 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1451,20 +1451,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet(
///////////////////////////////////////////////////////////////////////////////
/// @brief Supported platform info
typedef enum ur_platform_info_t {
/// [char[]] The string denoting name of the platform. The size of the
/// info needs to be dynamically queried.
UR_PLATFORM_INFO_NAME = 1,
/// [char[]] The string denoting name of the vendor of the platform. The
/// [char[]] The null-terminated string denoting name of the platform. The
/// size of the info needs to be dynamically queried.
UR_PLATFORM_INFO_NAME = 1,
/// [char[]] The null-terminated string denoting name of the vendor of the
/// platform. The size of the info needs to be dynamically queried.
UR_PLATFORM_INFO_VENDOR_NAME = 2,
/// [char[]] The string denoting the version of the platform. The size of
/// the info needs to be dynamically queried.
/// [char[]] The null-terminated string denoting the version of the
/// platform. The size of the info needs to be dynamically queried.
UR_PLATFORM_INFO_VERSION = 3,
/// [char[]] The string denoting extensions supported by the platform. The
/// size of the info needs to be dynamically queried.
/// [char[]] The null-terminated string denoting extensions supported by
/// the platform. The size of the info needs to be dynamically queried.
UR_PLATFORM_INFO_EXTENSIONS = 4,
/// [char[]] The string denoting profile of the platform. The size of the
/// info needs to be dynamically queried.
/// [char[]] The null-terminated string denoting profile of the platform.
/// The size of the info needs to be dynamically queried.
UR_PLATFORM_INFO_PROFILE = 5,
/// [::ur_platform_backend_t] The backend of the platform. Identifies the
/// native backend adapter implementing this platform.
Expand Down Expand Up @@ -2046,7 +2046,8 @@ typedef enum ur_device_info_t {
UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES = 60,
/// [::ur_queue_flags_t] host queue property bit-field
UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES = 61,
/// [char[]] a semi-colon separated list of built-in kernels
/// [char[]] a null-terminated semi-colon separated list of built-in
/// kernels
UR_DEVICE_INFO_BUILT_IN_KERNELS = 62,
/// [::ur_platform_handle_t] the platform associated with the device
UR_DEVICE_INFO_PLATFORM = 63,
Expand All @@ -2055,21 +2056,22 @@ typedef enum ur_device_info_t {
/// It is unsuitable for general use in applications. This feature is
/// provided for identifying memory leaks.
UR_DEVICE_INFO_REFERENCE_COUNT = 64,
/// [char[]] IL version
/// [char[]] null-terminated IL version
UR_DEVICE_INFO_IL_VERSION = 65,
/// [char[]] Device name
/// [char[]] null-terminated device name
UR_DEVICE_INFO_NAME = 66,
/// [char[]] Device vendor
/// [char[]] null-terminated device vendor
UR_DEVICE_INFO_VENDOR = 67,
/// [char[]] Driver version
/// [char[]] null-terminated driver version
UR_DEVICE_INFO_DRIVER_VERSION = 68,
/// [char[]] Device profile
/// [char[]] null-terminated device profile
UR_DEVICE_INFO_PROFILE = 69,
/// [char[]] Device version
/// [char[]] null-terminated device version
UR_DEVICE_INFO_VERSION = 70,
/// [char[]] Version of backend runtime
/// [char[]] null-terminated version of backend runtime
UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION = 71,
/// [char[]] Return a space separated list of extension names
/// [char[]] Return a null-terminated space separated list of extension
/// names
UR_DEVICE_INFO_EXTENSIONS = 72,
/// [size_t] Maximum size in bytes of internal printf buffer
UR_DEVICE_INFO_PRINTF_BUFFER_SIZE = 73,
Expand All @@ -2089,9 +2091,8 @@ typedef enum ur_device_info_t {
/// If the device does not support any affinity domains, then 0 will be
/// returned.
UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN = 78,
/// [::ur_device_partition_property_t[]] return an array of
/// ::ur_device_partition_property_t for properties specified in
/// ::urDevicePartition
/// [::ur_device_partition_property_t[]] returns an array of properties
/// specified in ::urDevicePartition
UR_DEVICE_INFO_PARTITION_TYPE = 79,
/// [uint32_t] max number of sub groups
UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS = 80,
Expand All @@ -2116,7 +2117,7 @@ typedef enum ur_device_info_t {
UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT = 87,
/// [uint8_t[]][optional-query] return device UUID
UR_DEVICE_INFO_UUID = 88,
/// [char[]][optional-query] return device PCI address
/// [char[]][optional-query] return null-terminated device PCI address
UR_DEVICE_INFO_PCI_ADDRESS = 89,
/// [uint32_t][optional-query] return Intel GPU EU count
UR_DEVICE_INFO_GPU_EU_COUNT = 90,
Expand Down Expand Up @@ -2227,14 +2228,14 @@ typedef enum ur_device_info_t {
/// [uint32_t] returns the required alignment of the pitch between two
/// rows of an image in bytes
UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP = 0x2004,
/// [size_t] returns the maximum linear width allowed for images allocated
/// using USM
/// [uint32_t] returns the maximum linear width allowed for images
/// allocated using USM
UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP = 0x2005,
/// [size_t] returns the maximum linear height allowed for images
/// [uint32_t] returns the maximum linear height allowed for images
/// allocated using USM
UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP = 0x2006,
/// [size_t] returns the maximum linear pitch allowed for images allocated
/// using USM
/// [uint32_t] returns the maximum linear pitch allowed for images
/// allocated using USM
UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP = 0x2007,
/// [::ur_bool_t] returns true if the device supports allocating mipmap
/// resources
Expand All @@ -2260,20 +2261,20 @@ typedef enum ur_device_info_t {
/// [::ur_bool_t] returns true if the device supports sampling cubemapped
/// images across face boundaries
UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP = 0x2011,
/// [::ur_bool_t] returns true if the device is capable of fetching USM
/// backed 1D sampled image data.
/// [::ur_bool_t] returns true if the device supports fetching USM backed
/// 1D sampled image data.
UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP = 0x2012,
/// [::ur_bool_t] returns true if the device is capable of fetching
/// non-USM backed 1D sampled image data.
/// [::ur_bool_t] returns true if the device supports fetching non-USM
/// backed 1D sampled image data.
UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP = 0x2013,
/// [::ur_bool_t] returns true if the device is capable of fetching USM
/// backed 2D sampled image data.
/// [::ur_bool_t] returns true if the device supports fetching USM backed
/// 2D sampled image data.
UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP = 0x2014,
/// [::ur_bool_t] returns true if the device is capable of fetching
/// non-USM backed 2D sampled image data.
/// [::ur_bool_t] returns true if the device supports fetching non-USM
/// backed 2D sampled image data.
UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP = 0x2015,
/// [::ur_bool_t] returns true if the device is capable of fetching
/// non-USM backed 3D sampled image data.
/// [::ur_bool_t] returns true if the device supports fetching non-USM
/// backed 3D sampled image data.
UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP = 0x2017,
/// [::ur_bool_t] returns true if the device supports timestamp recording
UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP = 0x2018,
Expand All @@ -2283,11 +2284,11 @@ typedef enum ur_device_info_t {
/// [::ur_bool_t] returns true if the device supports unique addressing
/// per dimension.
UR_DEVICE_INFO_BINDLESS_UNIQUE_ADDRESSING_PER_DIM_EXP = 0x201A,
/// [::ur_bool_t] returns true if the device is capable of sampling USM
/// backed 1D sampled image data.
/// [::ur_bool_t] returns true if the device supports sampling USM backed
/// 1D sampled image data.
UR_DEVICE_INFO_BINDLESS_SAMPLE_1D_USM_EXP = 0x201B,
/// [::ur_bool_t] returns true if the device is capable of sampling USM
/// backed 2D sampled image data.
/// [::ur_bool_t] returns true if the device supports sampling USM backed
/// 2D sampled image data.
UR_DEVICE_INFO_BINDLESS_SAMPLE_2D_USM_EXP = 0x201C,
/// [::ur_bool_t] returns true if the device supports enqueueing of native
/// work
Expand Down Expand Up @@ -5571,14 +5572,14 @@ typedef enum ur_program_info_t {
/// subset of those devices when the program is created using
/// ::urProgramCreateWithBinary.
UR_PROGRAM_INFO_DEVICES = 3,
/// [char[]] Return program IL if the program was created with
/// ::urProgramCreateWithIL, otherwise return size will be set to 0 and
/// nothing will be returned.
/// [char[]] Return null-terminated program IL if the program was created
/// with ::urProgramCreateWithIL, otherwise return size will be set to 0
/// and nothing will be returned.
UR_PROGRAM_INFO_IL = 4,
/// [size_t[]] Return program binary sizes for each device.
UR_PROGRAM_INFO_BINARY_SIZES = 5,
/// [unsigned char[]] Return program binaries for all devices for this
/// Program.
/// [unsigned char[]] Return null-terminated program binaries for all
/// devices for this Program.
UR_PROGRAM_INFO_BINARIES = 6,
/// [size_t][optional-query] Number of kernels in Program, return type
/// size_t.
Expand Down
18 changes: 9 additions & 9 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4684,9 +4684,9 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr,
os << ")";
} break;
case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: {
const size_t *tptr = (const size_t *)ptr;
if (sizeof(size_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t)
const uint32_t *tptr = (const uint32_t *)ptr;
if (sizeof(uint32_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t)
<< ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
Expand All @@ -4697,9 +4697,9 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr,
os << ")";
} break;
case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: {
const size_t *tptr = (const size_t *)ptr;
if (sizeof(size_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t)
const uint32_t *tptr = (const uint32_t *)ptr;
if (sizeof(uint32_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t)
<< ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
Expand All @@ -4710,9 +4710,9 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr,
os << ")";
} break;
case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: {
const size_t *tptr = (const size_t *)ptr;
if (sizeof(size_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t)
const uint32_t *tptr = (const uint32_t *)ptr;
if (sizeof(uint32_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t)
<< ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
Expand Down
22 changes: 11 additions & 11 deletions scripts/core/device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ etors:
- name: QUEUE_ON_HOST_PROPERTIES
desc: "[$x_queue_flags_t] host queue property bit-field"
- name: BUILT_IN_KERNELS
desc: "[char[]] a semi-colon separated list of built-in kernels"
desc: "[char[]] a null-terminated semi-colon separated list of built-in kernels"
- name: PLATFORM
desc: "[$x_platform_handle_t] the platform associated with the device"
- name: REFERENCE_COUNT
Expand All @@ -329,21 +329,21 @@ 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.
- name: IL_VERSION
desc: "[char[]] IL version"
desc: "[char[]] null-terminated IL version"
- name: NAME
desc: "[char[]] Device name"
desc: "[char[]] null-terminated device name"
- name: VENDOR
desc: "[char[]] Device vendor"
desc: "[char[]] null-terminated device vendor"
- name: DRIVER_VERSION
desc: "[char[]] Driver version"
desc: "[char[]] null-terminated driver version"
- name: PROFILE
desc: "[char[]] Device profile"
desc: "[char[]] null-terminated device profile"
- name: VERSION
desc: "[char[]] Device version"
desc: "[char[]] null-terminated device version"
- name: BACKEND_RUNTIME_VERSION
desc: "[char[]] Version of backend runtime"
desc: "[char[]] null-terminated version of backend runtime"
- name: EXTENSIONS
desc: "[char[]] Return a space separated list of extension names"
desc: "[char[]] Return a null-terminated space separated list of extension names"
- name: PRINTF_BUFFER_SIZE
desc: "[size_t] Maximum size in bytes of internal printf buffer"
- name: PREFERRED_INTEROP_USER_SYNC
Expand All @@ -359,7 +359,7 @@ etors:
[$x_device_affinity_domain_flags_t] Returns a bit-field of the supported affinity domains for partitioning.
If the device does not support any affinity domains, then 0 will be returned.
- name: PARTITION_TYPE
desc: "[$x_device_partition_property_t[]] return an array of $x_device_partition_property_t for properties specified in $xDevicePartition"
desc: "[$x_device_partition_property_t[]] returns an array of properties specified in $xDevicePartition"
- name: MAX_NUM_SUB_GROUPS
desc: "[uint32_t] max number of sub groups"
- name: SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS
Expand All @@ -379,7 +379,7 @@ etors:
- name: UUID
desc: "[uint8_t[]][optional-query] return device UUID"
- name: PCI_ADDRESS
desc: "[char[]][optional-query] return device PCI address"
desc: "[char[]][optional-query] return null-terminated device PCI address"
- name: GPU_EU_COUNT
desc: "[uint32_t][optional-query] return Intel GPU EU count"
- name: GPU_EU_SIMD_WIDTH
Expand Down
20 changes: 10 additions & 10 deletions scripts/core/exp-bindless-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ etors:
desc: "[uint32_t] returns the required alignment of the pitch between two rows of an image in bytes"
- name: MAX_IMAGE_LINEAR_WIDTH_EXP
value: "0x2005"
desc: "[size_t] returns the maximum linear width allowed for images allocated using USM"
desc: "[uint32_t] returns the maximum linear width allowed for images allocated using USM"
- name: MAX_IMAGE_LINEAR_HEIGHT_EXP
value: "0x2006"
desc: "[size_t] returns the maximum linear height allowed for images allocated using USM"
desc: "[uint32_t] returns the maximum linear height allowed for images allocated using USM"
- name: MAX_IMAGE_LINEAR_PITCH_EXP
value: "0x2007"
desc: "[size_t] returns the maximum linear pitch allowed for images allocated using USM"
desc: "[uint32_t] returns the maximum linear pitch allowed for images allocated using USM"
- name: MIPMAP_SUPPORT_EXP
value: "0x2008"
desc: "[$x_bool_t] returns true if the device supports allocating mipmap resources"
Expand All @@ -88,19 +88,19 @@ etors:
desc: "[$x_bool_t] returns true if the device supports sampling cubemapped images across face boundaries"
- name: BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP
value: "0x2012"
desc: "[$x_bool_t] returns true if the device is capable of fetching USM backed 1D sampled image data."
desc: "[$x_bool_t] returns true if the device supports fetching USM backed 1D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP
value: "0x2013"
desc: "[$x_bool_t] returns true if the device is capable of fetching non-USM backed 1D sampled image data."
desc: "[$x_bool_t] returns true if the device supports fetching non-USM backed 1D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP
value: "0x2014"
desc: "[$x_bool_t] returns true if the device is capable of fetching USM backed 2D sampled image data."
desc: "[$x_bool_t] returns true if the device supports fetching USM backed 2D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP
value: "0x2015"
desc: "[$x_bool_t] returns true if the device is capable of fetching non-USM backed 2D sampled image data."
desc: "[$x_bool_t] returns true if the device supports fetching non-USM backed 2D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP
value: "0x2017"
desc: "[$x_bool_t] returns true if the device is capable of fetching non-USM backed 3D sampled image data."
desc: "[$x_bool_t] returns true if the device supports fetching non-USM backed 3D sampled image data."
- name: IMAGE_ARRAY_SUPPORT_EXP
value: "0x2019"
desc: "[$x_bool_t] returns true if the device supports allocating and accessing image array resources."
Expand All @@ -109,10 +109,10 @@ etors:
desc: "[$x_bool_t] returns true if the device supports unique addressing per dimension."
- name: BINDLESS_SAMPLE_1D_USM_EXP
value: "0x201B"
desc: "[$x_bool_t] returns true if the device is capable of sampling USM backed 1D sampled image data."
desc: "[$x_bool_t] returns true if the device supports sampling USM backed 1D sampled image data."
- name: BINDLESS_SAMPLE_2D_USM_EXP
value: "0x201C"
desc: "[$x_bool_t] returns true if the device is capable of sampling USM backed 2D sampled image data."
desc: "[$x_bool_t] returns true if the device supports sampling USM backed 2D sampled image data."
--- #--------------------------------------------------------------------------
type: enum
extend: true
Expand Down
10 changes: 5 additions & 5 deletions scripts/core/platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ typed_etors: True
etors:
- name: NAME
value: "1"
desc: "[char[]] The string denoting name of the platform. The size of the info needs to be dynamically queried."
desc: "[char[]] The null-terminated string denoting name of the platform. The size of the info needs to be dynamically queried."
- name: VENDOR_NAME
value: "2"
desc: "[char[]] The string denoting name of the vendor of the platform. The size of the info needs to be dynamically queried."
desc: "[char[]] The null-terminated string denoting name of the vendor of the platform. The size of the info needs to be dynamically queried."
- name: VERSION
value: "3"
desc: "[char[]] The string denoting the version of the platform. The size of the info needs to be dynamically queried."
desc: "[char[]] The null-terminated string denoting the version of the platform. The size of the info needs to be dynamically queried."
- name: EXTENSIONS
value: "4"
desc: "[char[]] The string denoting extensions supported by the platform. The size of the info needs to be dynamically queried."
desc: "[char[]] The null-terminated string denoting extensions supported by the platform. The size of the info needs to be dynamically queried."
todo: "document extensions names and their meaning"
- name: PROFILE
value: "5"
desc: "[char[]] The string denoting profile of the platform. The size of the info needs to be dynamically queried."
desc: "[char[]] The null-terminated string denoting profile of the platform. The size of the info needs to be dynamically queried."
todo: "currently always return FULL_PROFILE, deprecate?"
- name: BACKEND
value: "6"
Expand Down
Loading

0 comments on commit b12864d

Please sign in to comment.