Skip to content

Commit c4ce13a

Browse files
committed
Explicitly define which info queries are optional.
This is now reflected in the spec and in the CTS tests.
1 parent be849b2 commit c4ce13a

File tree

13 files changed

+152
-106
lines changed

13 files changed

+152
-106
lines changed

include/ur_api.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ typedef enum ur_device_info_t {
14081408
UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE = 23, ///< [uint32_t] native vector width for double
14091409
UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF = 24, ///< [uint32_t] native vector width for half float
14101410
UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY = 25, ///< [uint32_t] max clock frequency in MHz
1411-
UR_DEVICE_INFO_MEMORY_CLOCK_RATE = 26, ///< [uint32_t] memory clock frequency in MHz
1411+
UR_DEVICE_INFO_MEMORY_CLOCK_RATE = 26, ///< [uint32_t] memory clock frequency in MHz (optional)
14121412
UR_DEVICE_INFO_ADDRESS_BITS = 27, ///< [uint32_t] address bits
14131413
UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE = 28, ///< [uint64_t] max memory allocation size
14141414
UR_DEVICE_INFO_IMAGE_SUPPORTED = 29, ///< [::ur_bool_t] images are supported
@@ -1432,7 +1432,7 @@ typedef enum ur_device_info_t {
14321432
UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE = 44, ///< [uint32_t] global memory cache line size in bytes
14331433
UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE = 45, ///< [uint64_t] size of global memory cache in bytes
14341434
UR_DEVICE_INFO_GLOBAL_MEM_SIZE = 46, ///< [uint64_t] size of global memory in bytes
1435-
UR_DEVICE_INFO_GLOBAL_MEM_FREE = 47, ///< [uint64_t] size of global memory which is free in bytes
1435+
UR_DEVICE_INFO_GLOBAL_MEM_FREE = 47, ///< [uint64_t] size of global memory which is free in bytes (optional)
14361436
UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE = 48, ///< [uint64_t] max constant buffer size in bytes
14371437
UR_DEVICE_INFO_MAX_CONSTANT_ARGS = 49, ///< [uint32_t] max number of __const declared arguments in a kernel
14381438
UR_DEVICE_INFO_LOCAL_MEM_TYPE = 50, ///< [::ur_device_local_mem_type_t] local memory type
@@ -1490,15 +1490,15 @@ typedef enum ur_device_info_t {
14901490
///< shared memory access
14911491
UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT = 87, ///< [::ur_device_usm_access_capability_flags_t] support USM system wide
14921492
///< shared memory access
1493-
UR_DEVICE_INFO_UUID = 88, ///< [char[]] return device UUID
1494-
UR_DEVICE_INFO_PCI_ADDRESS = 89, ///< [char[]] return device PCI address
1495-
UR_DEVICE_INFO_GPU_EU_COUNT = 90, ///< [uint32_t] return Intel GPU EU count
1496-
UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH = 91, ///< [uint32_t] return Intel GPU EU SIMD width
1497-
UR_DEVICE_INFO_GPU_EU_SLICES = 92, ///< [uint32_t] return Intel GPU number of slices
1498-
UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE = 93, ///< [uint32_t] return Intel GPU EU count per subslice
1499-
UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE = 94, ///< [uint32_t] return Intel GPU number of subslices per slice
1500-
UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU = 95, ///< [uint32_t] return Intel GPU number of threads per EU
1501-
UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH = 96, ///< [uint32_t] return max memory bandwidth in Mb/s
1493+
UR_DEVICE_INFO_UUID = 88, ///< [char[]] return device UUID (optional)
1494+
UR_DEVICE_INFO_PCI_ADDRESS = 89, ///< [char[]] return device PCI address (optional)
1495+
UR_DEVICE_INFO_GPU_EU_COUNT = 90, ///< [uint32_t] return Intel GPU EU count (optional)
1496+
UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH = 91, ///< [uint32_t] return Intel GPU EU SIMD width (optional)
1497+
UR_DEVICE_INFO_GPU_EU_SLICES = 92, ///< [uint32_t] return Intel GPU number of slices (optional)
1498+
UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE = 93, ///< [uint32_t] return Intel GPU EU count per subslice (optional)
1499+
UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE = 94, ///< [uint32_t] return Intel GPU number of subslices per slice (optional)
1500+
UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU = 95, ///< [uint32_t] return Intel GPU number of threads per EU (optional)
1501+
UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH = 96, ///< [uint32_t] return max memory bandwidth in Mb/s (optional)
15021502
UR_DEVICE_INFO_IMAGE_SRGB = 97, ///< [::ur_bool_t] device supports sRGB images
15031503
UR_DEVICE_INFO_BUILD_ON_SUBDEVICE = 98, ///< [::ur_bool_t] Return true if sub-device should do its own program
15041504
///< build
@@ -1518,16 +1518,17 @@ typedef enum ur_device_info_t {
15181518
UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS = 106, ///< [::ur_bool_t] support the ::urKernelSetSpecializationConstants entry
15191519
///< point
15201520
UR_DEVICE_INFO_MEMORY_BUS_WIDTH = 107, ///< [uint32_t] return the width in bits of the memory bus interface of the
1521-
///< device.
1521+
///< device (optional).
15221522
UR_DEVICE_INFO_MAX_WORK_GROUPS_3D = 108, ///< [size_t[3]] return max 3D work groups
15231523
UR_DEVICE_INFO_ASYNC_BARRIER = 109, ///< [::ur_bool_t] return true if Async Barrier is supported
15241524
UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT = 110, ///< [::ur_bool_t] return true if specifying memory channels is supported
15251525
UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED = 111, ///< [::ur_bool_t] Return true if the device supports enqueueing commands
15261526
///< to read and write pipes from the host.
15271527
UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP = 112, ///< [uint32_t] The maximum number of registers available per block.
1528+
///< (optional)
15281529
UR_DEVICE_INFO_IP_VERSION = 113, ///< [uint32_t] The device IP version. The meaning of the device IP version
15291530
///< is implementation-defined, but newer devices should have a higher
1530-
///< version than older devices.
1531+
///< version than older devices. (optional)
15311532
UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT = 114, ///< [::ur_bool_t] return true if the device supports virtual memory.
15321533
UR_DEVICE_INFO_ESIMD_SUPPORT = 115, ///< [::ur_bool_t] return true if the device supports ESIMD.
15331534
UR_DEVICE_INFO_COMPONENT_DEVICES = 116, ///< [::ur_device_handle_t[]] The set of component devices contained by
@@ -4286,9 +4287,9 @@ typedef enum ur_program_info_t {
42864287
UR_PROGRAM_INFO_BINARY_SIZES = 5, ///< [size_t[]] Return program binary sizes for each device.
42874288
UR_PROGRAM_INFO_BINARIES = 6, ///< [unsigned char[]] Return program binaries for all devices for this
42884289
///< Program.
4289-
UR_PROGRAM_INFO_NUM_KERNELS = 7, ///< [size_t] Number of kernels in Program, return type size_t.
4290+
UR_PROGRAM_INFO_NUM_KERNELS = 7, ///< [size_t] Number of kernels in Program, return type size_t (optional).
42904291
UR_PROGRAM_INFO_KERNEL_NAMES = 8, ///< [char[]] Return a null-terminated, semi-colon separated list of kernel
4291-
///< names in Program.
4292+
///< names in Program (optional).
42924293
/// @cond
42934294
UR_PROGRAM_INFO_FORCE_UINT32 = 0x7fffffff
42944295
/// @endcond
@@ -4634,7 +4635,7 @@ typedef enum ur_kernel_info_t {
46344635
UR_KERNEL_INFO_PROGRAM = 4, ///< [::ur_program_handle_t] Return Program object associated with Kernel.
46354636
UR_KERNEL_INFO_ATTRIBUTES = 5, ///< [char[]] Return null-terminated kernel attributes string.
46364637
UR_KERNEL_INFO_NUM_REGS = 6, ///< [uint32_t] Return the number of registers used by the compiled kernel
4637-
///< (device specific).
4638+
///< (optional).
46384639
/// @cond
46394640
UR_KERNEL_INFO_FORCE_UINT32 = 0x7fffffff
46404641
/// @endcond
@@ -4644,7 +4645,7 @@ typedef enum ur_kernel_info_t {
46444645
///////////////////////////////////////////////////////////////////////////////
46454646
/// @brief Get Kernel Work Group information
46464647
typedef enum ur_kernel_group_info_t {
4647-
UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE = 0, ///< [size_t[3]] Return Work Group maximum global size
4648+
UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE = 0, ///< [size_t[3]] Return Work Group maximum global size (optional)
46484649
UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE = 1, ///< [size_t] Return maximum Work Group size
46494650
UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE = 2, ///< [size_t[3]] Return Work Group size required by the source code, such
46504651
///< as __attribute__((required_work_group_size(X,Y,Z))

scripts/core/PROG.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,24 @@ events, and programs are explicitly created against a context. A trivial work wi
182182
// Release the context handle
183183
${x}ContextRelease(hContext);
184184
185+
Object Queries
186+
==============
187+
188+
Queries to get information from API objects follow a common pattern. The entry
189+
points for this are generally of the form:
190+
191+
.. code-block::
192+
193+
ObjectGetInfo(ur_object_handle_t hObject, ur_object_info_t propName,
194+
size_t propSize, void *pPropValue, size_t *pPropSizeRet)
195+
196+
where ``propName`` selects the information to query out. The object info enum
197+
representing possible queries will generally be found in the enums section of
198+
the relevant object. Some info queries would be difficult or impossible to
199+
support for certain backends, these are denoted with "(optional)" in the enum
200+
description. Using any enum marked optional may result in
201+
${X}_RESULT_ERROR_UNSUPPORTED_ENUMERATION if the adapter doesn't support it.
202+
185203
Programs and Kernels
186204
====================
187205

scripts/core/device.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ etors:
209209
- name: MAX_CLOCK_FREQUENCY
210210
desc: "[uint32_t] max clock frequency in MHz"
211211
- name: MEMORY_CLOCK_RATE
212-
desc: "[uint32_t] memory clock frequency in MHz"
212+
desc: "[uint32_t] memory clock frequency in MHz (optional)"
213213
- name: ADDRESS_BITS
214214
desc: "[uint32_t] address bits"
215215
- name: MAX_MEM_ALLOC_SIZE
@@ -251,7 +251,7 @@ etors:
251251
- name: GLOBAL_MEM_SIZE
252252
desc: "[uint64_t] size of global memory in bytes"
253253
- name: GLOBAL_MEM_FREE
254-
desc: "[uint64_t] size of global memory which is free in bytes"
254+
desc: "[uint64_t] size of global memory which is free in bytes (optional)"
255255
- name: MAX_CONSTANT_BUFFER_SIZE
256256
desc: "[uint64_t] max constant buffer size in bytes"
257257
- name: MAX_CONSTANT_ARGS
@@ -338,23 +338,23 @@ etors:
338338
- name: USM_SYSTEM_SHARED_SUPPORT
339339
desc: "[$x_device_usm_access_capability_flags_t] support USM system wide shared memory access"
340340
- name: UUID
341-
desc: "[char[]] return device UUID"
341+
desc: "[char[]] return device UUID (optional)"
342342
- name: PCI_ADDRESS
343-
desc: "[char[]] return device PCI address"
343+
desc: "[char[]] return device PCI address (optional)"
344344
- name: GPU_EU_COUNT
345-
desc: "[uint32_t] return Intel GPU EU count"
345+
desc: "[uint32_t] return Intel GPU EU count (optional)"
346346
- name: GPU_EU_SIMD_WIDTH
347-
desc: "[uint32_t] return Intel GPU EU SIMD width"
347+
desc: "[uint32_t] return Intel GPU EU SIMD width (optional)"
348348
- name: GPU_EU_SLICES
349-
desc: "[uint32_t] return Intel GPU number of slices"
349+
desc: "[uint32_t] return Intel GPU number of slices (optional)"
350350
- name: GPU_EU_COUNT_PER_SUBSLICE
351-
desc: "[uint32_t] return Intel GPU EU count per subslice"
351+
desc: "[uint32_t] return Intel GPU EU count per subslice (optional)"
352352
- name: GPU_SUBSLICES_PER_SLICE
353-
desc: "[uint32_t] return Intel GPU number of subslices per slice"
353+
desc: "[uint32_t] return Intel GPU number of subslices per slice (optional)"
354354
- name: GPU_HW_THREADS_PER_EU
355-
desc: "[uint32_t] return Intel GPU number of threads per EU"
355+
desc: "[uint32_t] return Intel GPU number of threads per EU (optional)"
356356
- name: MAX_MEMORY_BANDWIDTH
357-
desc: "[uint32_t] return max memory bandwidth in Mb/s"
357+
desc: "[uint32_t] return max memory bandwidth in Mb/s (optional)"
358358
- name: IMAGE_SRGB
359359
desc: "[$x_bool_t] device supports sRGB images"
360360
- name: BUILD_ON_SUBDEVICE
@@ -379,7 +379,7 @@ etors:
379379
- name: KERNEL_SET_SPECIALIZATION_CONSTANTS
380380
desc: "[$x_bool_t] support the $xKernelSetSpecializationConstants entry point"
381381
- name: MEMORY_BUS_WIDTH
382-
desc: "[uint32_t] return the width in bits of the memory bus interface of the device."
382+
desc: "[uint32_t] return the width in bits of the memory bus interface of the device (optional)."
383383
- name: MAX_WORK_GROUPS_3D
384384
desc: "[size_t[3]] return max 3D work groups"
385385
- name: ASYNC_BARRIER
@@ -389,9 +389,9 @@ etors:
389389
- name: HOST_PIPE_READ_WRITE_SUPPORTED
390390
desc: "[$x_bool_t] Return true if the device supports enqueueing commands to read and write pipes from the host."
391391
- name: MAX_REGISTERS_PER_WORK_GROUP
392-
desc: "[uint32_t] The maximum number of registers available per block."
392+
desc: "[uint32_t] The maximum number of registers available per block. (optional)"
393393
- name: IP_VERSION
394-
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."
394+
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. (optional)"
395395
- name: VIRTUAL_MEMORY_SUPPORT
396396
desc: "[$x_bool_t] return true if the device supports virtual memory."
397397
- name: ESIMD_SUPPORT

scripts/core/kernel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ etors:
122122
- name: ATTRIBUTES
123123
desc: "[char[]] Return null-terminated kernel attributes string."
124124
- name: NUM_REGS
125-
desc: "[uint32_t] Return the number of registers used by the compiled kernel (device specific)."
125+
desc: "[uint32_t] Return the number of registers used by the compiled kernel (optional)."
126126
--- #--------------------------------------------------------------------------
127127
type: enum
128128
desc: "Get Kernel Work Group information"
@@ -131,7 +131,7 @@ name: $x_kernel_group_info_t
131131
typed_etors: True
132132
etors:
133133
- name: GLOBAL_WORK_SIZE
134-
desc: "[size_t[3]] Return Work Group maximum global size"
134+
desc: "[size_t[3]] Return Work Group maximum global size (optional)"
135135
- name: WORK_GROUP_SIZE
136136
desc: "[size_t] Return maximum Work Group size"
137137
- name: COMPILE_WORK_GROUP_SIZE

scripts/core/program.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ etors:
335335
- name: BINARIES
336336
desc: "[unsigned char[]] Return program binaries for all devices for this Program."
337337
- name: NUM_KERNELS
338-
desc: "[size_t] Number of kernels in Program, return type size_t."
338+
desc: "[size_t] Number of kernels in Program, return type size_t (optional)."
339339
- name: KERNEL_NAMES
340-
desc: "[char[]] Return a null-terminated, semi-colon separated list of kernel names in Program."
340+
desc: "[char[]] Return a null-terminated, semi-colon separated list of kernel names in Program (optional)."
341341
--- #--------------------------------------------------------------------------
342342
type: function
343343
desc: "Query information about a Program object"
Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,2 @@
11
{{OPT}}urDeviceGetGlobalTimestampTest.SuccessSynchronizedTime
2-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_IMAGE_SUPPORTED
32
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_GLOBAL_MEM_FREE
4-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT
5-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_HOST_UNIFIED_MEMORY
6-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ENDIAN_LITTLE
7-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_AVAILABLE
8-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_COMPILER_AVAILABLE
9-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_LINKER_AVAILABLE
10-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC
11-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS
12-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH
13-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_IMAGE_SRGB
14-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_BUILD_ON_SUBDEVICE
15-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ATOMIC_64
16-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ASYNC_BARRIER
17-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT
18-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED
19-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
urDeviceGetInfoTest.Success/UR_DEVICE_INFO_HALF_FP_CONFIG

0 commit comments

Comments
 (0)