Skip to content

Commit c1ee9f3

Browse files
committed
[ur] Allow native handles to be unsupported
Some adapters do not map directly to Unified Runtime's set of API objects and as such are unable to support getting the underlying native handle or creating objects from native handles. This patch adds the `UR_RESULT_ERROR_UNSUPPORTED_FEATURE` to all native handle entry-points and updates the conformance tests to match.
1 parent 36329b7 commit c1ee9f3

30 files changed

+230
-20
lines changed

include/ur_api.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,8 @@ urPlatformGetApiVersion(
10711071
/// + `NULL == hPlatform`
10721072
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
10731073
/// + `NULL == phNativePlatform`
1074+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
1075+
/// + If the adapter has no underlying equivalent handle.
10741076
UR_APIEXPORT ur_result_t UR_APICALL
10751077
urPlatformGetNativeHandle(
10761078
ur_platform_handle_t hPlatform, ///< [in] handle of the platform.
@@ -1105,6 +1107,8 @@ typedef struct ur_platform_native_properties_t {
11051107
/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC
11061108
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
11071109
/// + `NULL == phPlatform`
1110+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
1111+
/// + If the adapter has no underlying equivalent handle.
11081112
UR_APIEXPORT ur_result_t UR_APICALL
11091113
urPlatformCreateWithNativeHandle(
11101114
ur_native_handle_t hNativePlatform, ///< [in][nocheck] the native handle of the platform.
@@ -1822,6 +1826,8 @@ typedef enum ur_device_exec_capability_flag_t {
18221826
/// + `NULL == hDevice`
18231827
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
18241828
/// + `NULL == phNativeDevice`
1829+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
1830+
/// + If the adapter has no underlying equivalent handle.
18251831
UR_APIEXPORT ur_result_t UR_APICALL
18261832
urDeviceGetNativeHandle(
18271833
ur_device_handle_t hDevice, ///< [in] handle of the device.
@@ -1858,6 +1864,8 @@ typedef struct ur_device_native_properties_t {
18581864
/// + `NULL == hPlatform`
18591865
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
18601866
/// + `NULL == phDevice`
1867+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
1868+
/// + If the adapter has no underlying equivalent handle.
18611869
UR_APIEXPORT ur_result_t UR_APICALL
18621870
urDeviceCreateWithNativeHandle(
18631871
ur_native_handle_t hNativeDevice, ///< [in][nocheck] the native handle of the device.
@@ -2157,6 +2165,8 @@ urContextGetInfo(
21572165
/// + `NULL == hContext`
21582166
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
21592167
/// + `NULL == phNativeContext`
2168+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
2169+
/// + If the adapter has no underlying equivalent handle.
21602170
UR_APIEXPORT ur_result_t UR_APICALL
21612171
urContextGetNativeHandle(
21622172
ur_context_handle_t hContext, ///< [in] handle of the context.
@@ -2192,6 +2202,8 @@ typedef struct ur_context_native_properties_t {
21922202
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
21932203
/// + `NULL == phDevices`
21942204
/// + `NULL == phContext`
2205+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
2206+
/// + If the adapter has no underlying equivalent handle.
21952207
UR_APIEXPORT ur_result_t UR_APICALL
21962208
urContextCreateWithNativeHandle(
21972209
ur_native_handle_t hNativeContext, ///< [in][nocheck] the native handle of the context.
@@ -2633,6 +2645,8 @@ urMemBufferPartition(
26332645
/// + `NULL == hMem`
26342646
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
26352647
/// + `NULL == phNativeMem`
2648+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
2649+
/// + If the adapter has no underlying equivalent handle.
26362650
UR_APIEXPORT ur_result_t UR_APICALL
26372651
urMemGetNativeHandle(
26382652
ur_mem_handle_t hMem, ///< [in] handle of the mem.
@@ -2668,6 +2682,8 @@ typedef struct ur_mem_native_properties_t {
26682682
/// + `NULL == hContext`
26692683
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
26702684
/// + `NULL == phMem`
2685+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
2686+
/// + If the adapter has no underlying equivalent handle.
26712687
UR_APIEXPORT ur_result_t UR_APICALL
26722688
urMemBufferCreateWithNativeHandle(
26732689
ur_native_handle_t hNativeMem, ///< [in][nocheck] the native handle to the memory.
@@ -2695,6 +2711,8 @@ urMemBufferCreateWithNativeHandle(
26952711
/// + `NULL == pImageFormat`
26962712
/// + `NULL == pImageDesc`
26972713
/// + `NULL == phMem`
2714+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
2715+
/// + If the adapter has no underlying equivalent handle.
26982716
UR_APIEXPORT ur_result_t UR_APICALL
26992717
urMemImageCreateWithNativeHandle(
27002718
ur_native_handle_t hNativeMem, ///< [in][nocheck] the native handle to the memory.
@@ -2993,6 +3011,8 @@ urSamplerGetInfo(
29933011
/// + `NULL == hSampler`
29943012
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
29953013
/// + `NULL == phNativeSampler`
3014+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
3015+
/// + If the adapter has no underlying equivalent handle.
29963016
UR_APIEXPORT ur_result_t UR_APICALL
29973017
urSamplerGetNativeHandle(
29983018
ur_sampler_handle_t hSampler, ///< [in] handle of the sampler.
@@ -3029,6 +3049,8 @@ typedef struct ur_sampler_native_properties_t {
30293049
/// + `NULL == hContext`
30303050
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
30313051
/// + `NULL == phSampler`
3052+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
3053+
/// + If the adapter has no underlying equivalent handle.
30323054
UR_APIEXPORT ur_result_t UR_APICALL
30333055
urSamplerCreateWithNativeHandle(
30343056
ur_native_handle_t hNativeSampler, ///< [in][nocheck] the native handle of the sampler.
@@ -4325,6 +4347,8 @@ urProgramSetSpecializationConstants(
43254347
/// + `NULL == hProgram`
43264348
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
43274349
/// + `NULL == phNativeProgram`
4350+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
4351+
/// + If the adapter has no underlying equivalent handle.
43284352
UR_APIEXPORT ur_result_t UR_APICALL
43294353
urProgramGetNativeHandle(
43304354
ur_program_handle_t hProgram, ///< [in] handle of the program.
@@ -4361,6 +4385,8 @@ typedef struct ur_program_native_properties_t {
43614385
/// + `NULL == hContext`
43624386
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
43634387
/// + `NULL == phProgram`
4388+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
4389+
/// + If the adapter has no underlying equivalent handle.
43644390
UR_APIEXPORT ur_result_t UR_APICALL
43654391
urProgramCreateWithNativeHandle(
43664392
ur_native_handle_t hNativeProgram, ///< [in][nocheck] the native handle of the program.
@@ -4904,6 +4930,8 @@ urKernelSetSpecializationConstants(
49044930
/// + `NULL == hKernel`
49054931
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
49064932
/// + `NULL == phNativeKernel`
4933+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
4934+
/// + If the adapter has no underlying equivalent handle.
49074935
UR_APIEXPORT ur_result_t UR_APICALL
49084936
urKernelGetNativeHandle(
49094937
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel.
@@ -4941,6 +4969,8 @@ typedef struct ur_kernel_native_properties_t {
49414969
/// + `NULL == hProgram`
49424970
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
49434971
/// + `NULL == phKernel`
4972+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
4973+
/// + If the adapter has no underlying equivalent handle.
49444974
UR_APIEXPORT ur_result_t UR_APICALL
49454975
urKernelCreateWithNativeHandle(
49464976
ur_native_handle_t hNativeKernel, ///< [in][nocheck] the native handle of the kernel.
@@ -5195,6 +5225,8 @@ typedef struct ur_queue_native_desc_t {
51955225
/// + `NULL == hQueue`
51965226
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
51975227
/// + `NULL == phNativeQueue`
5228+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
5229+
/// + If the adapter has no underlying equivalent handle.
51985230
UR_APIEXPORT ur_result_t UR_APICALL
51995231
urQueueGetNativeHandle(
52005232
ur_queue_handle_t hQueue, ///< [in] handle of the queue.
@@ -5233,6 +5265,8 @@ typedef struct ur_queue_native_properties_t {
52335265
/// + `NULL == hDevice`
52345266
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
52355267
/// + `NULL == phQueue`
5268+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
5269+
/// + If the adapter has no underlying equivalent handle.
52365270
UR_APIEXPORT ur_result_t UR_APICALL
52375271
urQueueCreateWithNativeHandle(
52385272
ur_native_handle_t hNativeQueue, ///< [in][nocheck] the native handle of the queue.
@@ -5557,6 +5591,8 @@ urEventRelease(
55575591
/// + `NULL == hEvent`
55585592
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
55595593
/// + `NULL == phNativeEvent`
5594+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
5595+
/// + If the adapter has no underlying equivalent handle.
55605596
UR_APIEXPORT ur_result_t UR_APICALL
55615597
urEventGetNativeHandle(
55625598
ur_event_handle_t hEvent, ///< [in] handle of the event.
@@ -5593,6 +5629,8 @@ typedef struct ur_event_native_properties_t {
55935629
/// + `NULL == hContext`
55945630
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
55955631
/// + `NULL == phEvent`
5632+
/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE
5633+
/// + If the adapter has no underlying equivalent handle.
55965634
UR_APIEXPORT ur_result_t UR_APICALL
55975635
urEventCreateWithNativeHandle(
55985636
ur_native_handle_t hNativeEvent, ///< [in][nocheck] the native handle of the event.

scripts/core/context.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ params:
196196
name: phNativeContext
197197
desc: |
198198
[out] a pointer to the native handle of the context.
199+
returns:
200+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
201+
- "If the adapter has no underlying equivalent handle."
199202
--- #--------------------------------------------------------------------------
200203
type: struct
201204
desc: "Properties for for $xContextCreateWithNativeHandle."
@@ -238,6 +241,9 @@ params:
238241
name: phContext
239242
desc: |
240243
[out] pointer to the handle of the context object created.
244+
returns:
245+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
246+
- "If the adapter has no underlying equivalent handle."
241247
--- #--------------------------------------------------------------------------
242248
type: fptr_typedef
243249
desc: "Context's extended deleter callback function with user data."

scripts/core/device.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,9 @@ params:
731731
name: phNativeDevice
732732
desc: |
733733
[out] a pointer to the native handle of the device.
734+
returns:
735+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
736+
- "If the adapter has no underlying equivalent handle."
734737
--- #--------------------------------------------------------------------------
735738
type: struct
736739
desc: "Native device creation properties"
@@ -768,6 +771,9 @@ params:
768771
- type: "$x_device_handle_t*"
769772
name: phDevice
770773
desc: "[out] pointer to the handle of the device object created."
774+
returns:
775+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
776+
- "If the adapter has no underlying equivalent handle."
771777
--- #--------------------------------------------------------------------------
772778
type: function
773779
desc: "Returns synchronized Host and Device global timestamps."

scripts/core/event.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ params:
266266
name: phNativeEvent
267267
desc: |
268268
[out] a pointer to the native handle of the event.
269+
returns:
270+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
271+
- "If the adapter has no underlying equivalent handle."
269272
--- #--------------------------------------------------------------------------
270273
type: struct
271274
desc: "Properties for for $xEventCreateWithNativeHandle."
@@ -305,6 +308,9 @@ params:
305308
name: phEvent
306309
desc: |
307310
[out] pointer to the handle of the event object created.
311+
returns:
312+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
313+
- "If the adapter has no underlying equivalent handle."
308314
--- #--------------------------------------------------------------------------
309315
type: enum
310316
desc: "Event states for all events."

scripts/core/kernel.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,9 @@ params:
487487
name: phNativeKernel
488488
desc: |
489489
[out] a pointer to the native handle of the kernel.
490+
returns:
491+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
492+
- "If the adapter has no underlying equivalent handle."
490493
--- #--------------------------------------------------------------------------
491494
type: struct
492495
desc: "Properties for for $xKernelCreateWithNativeHandle."
@@ -529,3 +532,6 @@ params:
529532
name: phKernel
530533
desc: |
531534
[out] pointer to the handle of the kernel object created.
535+
returns:
536+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
537+
- "If the adapter has no underlying equivalent handle."

scripts/core/memory.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ params:
436436
name: phNativeMem
437437
desc: |
438438
[out] a pointer to the native handle of the mem.
439+
returns:
440+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
441+
- "If the adapter has no underlying equivalent handle."
439442
--- #--------------------------------------------------------------------------
440443
type: struct
441444
desc: "Native memory object creation properties"
@@ -473,6 +476,9 @@ params:
473476
- type: $x_mem_handle_t*
474477
name: phMem
475478
desc: "[out] pointer to handle of buffer memory object created."
479+
returns:
480+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
481+
- "If the adapter has no underlying equivalent handle."
476482
--- #--------------------------------------------------------------------------
477483
type: function
478484
desc: "Create runtime image memory object from native memory handle."
@@ -503,6 +509,9 @@ params:
503509
- type: $x_mem_handle_t*
504510
name: phMem
505511
desc: "[out] pointer to handle of image memory object created."
512+
returns:
513+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
514+
- "If the adapter has no underlying equivalent handle."
506515
--- #--------------------------------------------------------------------------
507516
type: function
508517
desc: "Retrieve information about a memory object."

scripts/core/platform.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ params:
167167
name: phNativePlatform
168168
desc: |
169169
[out] a pointer to the native handle of the platform.
170+
returns:
171+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
172+
- "If the adapter has no underlying equivalent handle."
170173
--- #--------------------------------------------------------------------------
171174
type: struct
172175
desc: "Native platform creation properties"
@@ -201,6 +204,9 @@ params:
201204
- type: "$x_platform_handle_t*"
202205
name: phPlatform
203206
desc: "[out] pointer to the handle of the platform object created."
207+
returns:
208+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
209+
- "If the adapter has no underlying equivalent handle."
204210
--- #--------------------------------------------------------------------------
205211
type: function
206212
desc: "Get the platform specific compiler backend option from a generic frontend option."

scripts/core/program.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,9 @@ params:
514514
name: phNativeProgram
515515
desc: |
516516
[out] a pointer to the native handle of the program.
517+
returns:
518+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
519+
- "If the adapter has no underlying equivalent handle."
517520
--- #--------------------------------------------------------------------------
518521
type: struct
519522
desc: "Native program creation properties"
@@ -551,3 +554,6 @@ params:
551554
- type: "$x_program_handle_t*"
552555
name: phProgram
553556
desc: "[out] pointer to the handle of the program object created."
557+
returns:
558+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
559+
- "If the adapter has no underlying equivalent handle."

scripts/core/queue.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ params:
244244
name: phNativeQueue
245245
desc: |
246246
[out] a pointer to the native handle of the queue.
247+
returns:
248+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
249+
- "If the adapter has no underlying equivalent handle."
247250
--- #--------------------------------------------------------------------------
248251
type: struct
249252
desc: "Properties for for $xQueueCreateWithNativeHandle."
@@ -286,6 +289,9 @@ params:
286289
name: phQueue
287290
desc: |
288291
[out] pointer to the handle of the queue object created.
292+
returns:
293+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
294+
- "If the adapter has no underlying equivalent handle."
289295
--- #--------------------------------------------------------------------------
290296
type: function
291297
desc: "Blocks until all previously issued commands to the command queue are finished."

scripts/core/sampler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ params:
194194
name: phNativeSampler
195195
desc: |
196196
[out] a pointer to the native handle of the sampler.
197+
returns:
198+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
199+
- "If the adapter has no underlying equivalent handle."
197200
--- #--------------------------------------------------------------------------
198201
type: struct
199202
desc: "Native sampler creation properties"
@@ -231,3 +234,6 @@ params:
231234
- type: "$x_sampler_handle_t*"
232235
name: phSampler
233236
desc: "[out] pointer to the handle of the sampler object created."
237+
returns:
238+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
239+
- "If the adapter has no underlying equivalent handle."

0 commit comments

Comments
 (0)