Skip to content

Commit 4030080

Browse files
authored
Merge pull request #1720 from aarongreig/aaron/addReleaseTags
Add [release] tag to parameters where appropriate.
2 parents 25157af + c246813 commit 4030080

23 files changed

+220
-174
lines changed

include/ur_api.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ urLoaderConfigRetain(
622622
/// + `NULL == hLoaderConfig`
623623
UR_APIEXPORT ur_result_t UR_APICALL
624624
urLoaderConfigRelease(
625-
ur_loader_config_handle_t hLoaderConfig ///< [in] config handle to release
625+
ur_loader_config_handle_t hLoaderConfig ///< [in][release] config handle to release
626626
);
627627

628628
///////////////////////////////////////////////////////////////////////////////
@@ -845,7 +845,7 @@ urAdapterGet(
845845
/// + `NULL == hAdapter`
846846
UR_APIEXPORT ur_result_t UR_APICALL
847847
urAdapterRelease(
848-
ur_adapter_handle_t hAdapter ///< [in] Adapter handle to release
848+
ur_adapter_handle_t hAdapter ///< [in][release] Adapter handle to release
849849
);
850850

851851
///////////////////////////////////////////////////////////////////////////////
@@ -1764,7 +1764,7 @@ urDeviceRetain(
17641764
/// + `NULL == hDevice`
17651765
UR_APIEXPORT ur_result_t UR_APICALL
17661766
urDeviceRelease(
1767-
ur_device_handle_t hDevice ///< [in] handle of the device to release.
1767+
ur_device_handle_t hDevice ///< [in][release] handle of the device to release.
17681768
);
17691769

17701770
///////////////////////////////////////////////////////////////////////////////
@@ -2271,7 +2271,7 @@ typedef enum ur_context_info_t {
22712271
/// + `NULL == hContext`
22722272
UR_APIEXPORT ur_result_t UR_APICALL
22732273
urContextRelease(
2274-
ur_context_handle_t hContext ///< [in] handle of the context to release.
2274+
ur_context_handle_t hContext ///< [in][release] handle of the context to release.
22752275
);
22762276

22772277
///////////////////////////////////////////////////////////////////////////////
@@ -2761,7 +2761,7 @@ urMemRetain(
27612761
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
27622762
UR_APIEXPORT ur_result_t UR_APICALL
27632763
urMemRelease(
2764-
ur_mem_handle_t hMem ///< [in] handle of the memory object to release
2764+
ur_mem_handle_t hMem ///< [in][release] handle of the memory object to release
27652765
);
27662766

27672767
///////////////////////////////////////////////////////////////////////////////
@@ -3153,7 +3153,7 @@ urSamplerRetain(
31533153
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
31543154
UR_APIEXPORT ur_result_t UR_APICALL
31553155
urSamplerRelease(
3156-
ur_sampler_handle_t hSampler ///< [in] handle of the sampler object to release
3156+
ur_sampler_handle_t hSampler ///< [in][release] handle of the sampler object to release
31573157
);
31583158

31593159
///////////////////////////////////////////////////////////////////////////////
@@ -3712,7 +3712,7 @@ urUSMPoolRetain(
37123712
/// + `NULL == pPool`
37133713
UR_APIEXPORT ur_result_t UR_APICALL
37143714
urUSMPoolRelease(
3715-
ur_usm_pool_handle_t pPool ///< [in] pointer to USM memory pool
3715+
ur_usm_pool_handle_t pPool ///< [in][release] pointer to USM memory pool
37163716
);
37173717

37183718
///////////////////////////////////////////////////////////////////////////////
@@ -4061,7 +4061,7 @@ urPhysicalMemRetain(
40614061
/// + `NULL == hPhysicalMem`
40624062
UR_APIEXPORT ur_result_t UR_APICALL
40634063
urPhysicalMemRelease(
4064-
ur_physical_mem_handle_t hPhysicalMem ///< [in] handle of the physical memory object to release.
4064+
ur_physical_mem_handle_t hPhysicalMem ///< [in][release] handle of the physical memory object to release.
40654065
);
40664066

40674067
#if !defined(__GNUC__)
@@ -4354,7 +4354,7 @@ urProgramRetain(
43544354
/// + `NULL == hProgram`
43554355
UR_APIEXPORT ur_result_t UR_APICALL
43564356
urProgramRelease(
4357-
ur_program_handle_t hProgram ///< [in] handle for the Program to release
4357+
ur_program_handle_t hProgram ///< [in][release] handle for the Program to release
43584358
);
43594359

43604360
///////////////////////////////////////////////////////////////////////////////
@@ -5005,7 +5005,7 @@ urKernelRetain(
50055005
/// + `NULL == hKernel`
50065006
UR_APIEXPORT ur_result_t UR_APICALL
50075007
urKernelRelease(
5008-
ur_kernel_handle_t hKernel ///< [in] handle for the Kernel to release
5008+
ur_kernel_handle_t hKernel ///< [in][release] handle for the Kernel to release
50095009
);
50105010

50115011
///////////////////////////////////////////////////////////////////////////////
@@ -5516,7 +5516,7 @@ urQueueRetain(
55165516
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
55175517
UR_APIEXPORT ur_result_t UR_APICALL
55185518
urQueueRelease(
5519-
ur_queue_handle_t hQueue ///< [in] handle of the queue object to release
5519+
ur_queue_handle_t hQueue ///< [in][release] handle of the queue object to release
55205520
);
55215521

55225522
///////////////////////////////////////////////////////////////////////////////
@@ -5905,7 +5905,7 @@ urEventRetain(
59055905
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
59065906
UR_APIEXPORT ur_result_t UR_APICALL
59075907
urEventRelease(
5908-
ur_event_handle_t hEvent ///< [in] handle of the event object
5908+
ur_event_handle_t hEvent ///< [in][release] handle of the event object
59095909
);
59105910

59115911
///////////////////////////////////////////////////////////////////////////////
@@ -7551,7 +7551,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
75517551
urBindlessImagesUnsampledImageHandleDestroyExp(
75527552
ur_context_handle_t hContext, ///< [in] handle of the context object
75537553
ur_device_handle_t hDevice, ///< [in] handle of the device object
7554-
ur_exp_image_handle_t hImage ///< [in] pointer to handle of image object to destroy
7554+
ur_exp_image_handle_t hImage ///< [in][release] pointer to handle of image object to destroy
75557555
);
75567556

75577557
///////////////////////////////////////////////////////////////////////////////
@@ -7576,7 +7576,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
75767576
urBindlessImagesSampledImageHandleDestroyExp(
75777577
ur_context_handle_t hContext, ///< [in] handle of the context object
75787578
ur_device_handle_t hDevice, ///< [in] handle of the device object
7579-
ur_exp_image_handle_t hImage ///< [in] pointer to handle of image object to destroy
7579+
ur_exp_image_handle_t hImage ///< [in][release] pointer to handle of image object to destroy
75807580
);
75817581

75827582
///////////////////////////////////////////////////////////////////////////////
@@ -7636,7 +7636,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
76367636
urBindlessImagesImageFreeExp(
76377637
ur_context_handle_t hContext, ///< [in] handle of the context object
76387638
ur_device_handle_t hDevice, ///< [in] handle of the device object
7639-
ur_exp_image_mem_handle_t hImageMem ///< [in] handle of image memory to be freed
7639+
ur_exp_image_mem_handle_t hImageMem ///< [in][release] handle of image memory to be freed
76407640
);
76417641

76427642
///////////////////////////////////////////////////////////////////////////////
@@ -7850,7 +7850,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
78507850
urBindlessImagesMipmapFreeExp(
78517851
ur_context_handle_t hContext, ///< [in] handle of the context object
78527852
ur_device_handle_t hDevice, ///< [in] handle of the device object
7853-
ur_exp_image_mem_handle_t hMem ///< [in] handle of image memory to be freed
7853+
ur_exp_image_mem_handle_t hMem ///< [in][release] handle of image memory to be freed
78547854
);
78557855

78567856
///////////////////////////////////////////////////////////////////////////////
@@ -7941,7 +7941,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
79417941
urBindlessImagesReleaseInteropExp(
79427942
ur_context_handle_t hContext, ///< [in] handle of the context object
79437943
ur_device_handle_t hDevice, ///< [in] handle of the device object
7944-
ur_exp_interop_mem_handle_t hInteropMem ///< [in] handle of interop memory to be freed
7944+
ur_exp_interop_mem_handle_t hInteropMem ///< [in][release] handle of interop memory to be freed
79457945
);
79467946

79477947
///////////////////////////////////////////////////////////////////////////////
@@ -7997,7 +7997,7 @@ UR_APIEXPORT ur_result_t UR_APICALL
79977997
urBindlessImagesDestroyExternalSemaphoreExp(
79987998
ur_context_handle_t hContext, ///< [in] handle of the context object
79997999
ur_device_handle_t hDevice, ///< [in] handle of the device object
8000-
ur_exp_interop_semaphore_handle_t hInteropSemaphore ///< [in] handle of interop semaphore to be destroyed
8000+
ur_exp_interop_semaphore_handle_t hInteropSemaphore ///< [in][release] handle of interop semaphore to be destroyed
80018001
);
80028002

80038003
///////////////////////////////////////////////////////////////////////////////
@@ -8271,7 +8271,7 @@ urCommandBufferRetainExp(
82718271
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
82728272
UR_APIEXPORT ur_result_t UR_APICALL
82738273
urCommandBufferReleaseExp(
8274-
ur_exp_command_buffer_handle_t hCommandBuffer ///< [in] Handle of the command-buffer object.
8274+
ur_exp_command_buffer_handle_t hCommandBuffer ///< [in][release] Handle of the command-buffer object.
82758275
);
82768276

82778277
///////////////////////////////////////////////////////////////////////////////
@@ -8819,7 +8819,7 @@ urCommandBufferRetainCommandExp(
88198819
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
88208820
UR_APIEXPORT ur_result_t UR_APICALL
88218821
urCommandBufferReleaseCommandExp(
8822-
ur_exp_command_buffer_command_handle_t hCommand ///< [in] Handle of the command-buffer command.
8822+
ur_exp_command_buffer_command_handle_t hCommand ///< [in][release] Handle of the command-buffer command.
88238823
);
88248824

88258825
///////////////////////////////////////////////////////////////////////////////

scripts/YaML.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ class ur_name_t(Structure):
625625
- `range` is used for params that are array pointers to specify the valid range that the is valid to read
626626
+ `start` and `end` must be an ISO-C standard identifier or literal
627627
+ `start` is inclusive and `end` is exclusive
628-
- `release` is used for params that are handles or pointers to handles where the function will destroy any backing memory associated with the handle(s)
628+
- `release` is used for params that are handles or pointers to handles where the function will decrement the handle's reference count, potentially leaving it in an invalid state if the reference count reaches zero.
629629
- `typename` is used to denote the type enum for params that are opaque pointers to values of tagged data types.
630630
- `bounds` is used for params that are memory objects or USM allocations. It specifies the range within the memory allocation represented by the param that will be accessed by the operation.
631631
+ `offset` and `size` must be an ISO-C standard identifier or literal

scripts/core/adapter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ params:
5656
- type: "$x_adapter_handle_t"
5757
name: hAdapter
5858
desc: |
59-
[in] Adapter handle to release
59+
[in][release] Adapter handle to release
6060
--- #--------------------------------------------------------------------------
6161
type: function
6262
desc: "Get a reference to the adapter handle."

scripts/core/context.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ params:
129129
- type: "$x_context_handle_t"
130130
name: hContext
131131
desc: |
132-
[in] handle of the context to release.
132+
[in][release] handle of the context to release.
133133
--- #--------------------------------------------------------------------------
134134
type: function
135135
desc: "Retrieves various information about context"

scripts/core/device.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ params:
524524
- type: "$x_device_handle_t"
525525
name: hDevice
526526
desc: |
527-
[in] handle of the device to release.
527+
[in][release] handle of the device to release.
528528
--- #--------------------------------------------------------------------------
529529
type: enum
530530
desc: "Device affinity domain"

scripts/core/event.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ analogue:
246246
params:
247247
- type: $x_event_handle_t
248248
name: hEvent
249-
desc: "[in] handle of the event object"
249+
desc: "[in][release] handle of the event object"
250250
returns:
251251
- $X_RESULT_ERROR_INVALID_EVENT
252252
- $X_RESULT_ERROR_OUT_OF_RESOURCES

scripts/core/exp-bindless-images.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ params:
357357
desc: "[in] handle of the device object"
358358
- type: $x_exp_image_handle_t
359359
name: hImage
360-
desc: "[in] pointer to handle of image object to destroy"
360+
desc: "[in][release] pointer to handle of image object to destroy"
361361
returns:
362362
- $X_RESULT_ERROR_INVALID_CONTEXT
363363
- $X_RESULT_ERROR_INVALID_VALUE
@@ -378,7 +378,7 @@ params:
378378
desc: "[in] handle of the device object"
379379
- type: $x_exp_image_handle_t
380380
name: hImage
381-
desc: "[in] pointer to handle of image object to destroy"
381+
desc: "[in][release] pointer to handle of image object to destroy"
382382
returns:
383383
- $X_RESULT_ERROR_INVALID_CONTEXT
384384
- $X_RESULT_ERROR_INVALID_VALUE
@@ -431,7 +431,7 @@ params:
431431
desc: "[in] handle of the device object"
432432
- type: $x_exp_image_mem_handle_t
433433
name: hImageMem
434-
desc: "[in] handle of image memory to be freed"
434+
desc: "[in][release] handle of image memory to be freed"
435435
returns:
436436
- $X_RESULT_ERROR_INVALID_CONTEXT
437437
- $X_RESULT_ERROR_INVALID_VALUE
@@ -642,7 +642,7 @@ params:
642642
desc: "[in] handle of the device object"
643643
- type: $x_exp_image_mem_handle_t
644644
name: hMem
645-
desc: "[in] handle of image memory to be freed"
645+
desc: "[in][release] handle of image memory to be freed"
646646
returns:
647647
- $X_RESULT_ERROR_INVALID_CONTEXT
648648
- $X_RESULT_ERROR_INVALID_VALUE
@@ -727,7 +727,7 @@ params:
727727
desc: "[in] handle of the device object"
728728
- type: $x_exp_interop_mem_handle_t
729729
name: hInteropMem
730-
desc: "[in] handle of interop memory to be freed"
730+
desc: "[in][release] handle of interop memory to be freed"
731731
returns:
732732
- $X_RESULT_ERROR_INVALID_CONTEXT
733733
- $X_RESULT_ERROR_INVALID_VALUE
@@ -775,7 +775,7 @@ params:
775775
desc: "[in] handle of the device object"
776776
- type: $x_exp_interop_semaphore_handle_t
777777
name: hInteropSemaphore
778-
desc: "[in] handle of interop semaphore to be destroyed"
778+
desc: "[in][release] handle of interop semaphore to be destroyed"
779779
returns:
780780
- $X_RESULT_ERROR_INVALID_CONTEXT
781781
- $X_RESULT_ERROR_INVALID_VALUE

scripts/core/exp-command-buffer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ name: ReleaseExp
265265
params:
266266
- type: $x_exp_command_buffer_handle_t
267267
name: hCommandBuffer
268-
desc: "[in] Handle of the command-buffer object."
268+
desc: "[in][release] Handle of the command-buffer object."
269269
returns:
270270
- $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP
271271
- $X_RESULT_ERROR_OUT_OF_RESOURCES
@@ -893,7 +893,7 @@ name: ReleaseCommandExp
893893
params:
894894
- type: $x_exp_command_buffer_command_handle_t
895895
name: hCommand
896-
desc: "[in] Handle of the command-buffer command."
896+
desc: "[in][release] Handle of the command-buffer command."
897897
returns:
898898
- $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP
899899
- $X_RESULT_ERROR_OUT_OF_RESOURCES

scripts/core/kernel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ details:
309309
params:
310310
- type: $x_kernel_handle_t
311311
name: hKernel
312-
desc: "[in] handle for the Kernel to release"
312+
desc: "[in][release] handle for the Kernel to release"
313313
--- #--------------------------------------------------------------------------
314314
type: struct
315315
desc: "Properties for for $xKernelSetArgPointer."

scripts/core/loader.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ details:
6767
params:
6868
- type: $x_loader_config_handle_t
6969
name: hLoaderConfig
70-
desc: "[in] config handle to release"
70+
desc: "[in][release] config handle to release"
7171
--- #--------------------------------------------------------------------------
7272
type: enum
7373
desc: "Supported loader info"

scripts/core/memory.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ analogue:
368368
params:
369369
- type: $x_mem_handle_t
370370
name: hMem
371-
desc: "[in] handle of the memory object to release"
371+
desc: "[in][release] handle of the memory object to release"
372372
returns:
373373
- $X_RESULT_ERROR_INVALID_MEM_OBJECT
374374
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY

scripts/core/program.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ details:
279279
params:
280280
- type: $x_program_handle_t
281281
name: hProgram
282-
desc: "[in] handle for the Program to release"
282+
desc: "[in][release] handle for the Program to release"
283283
--- #--------------------------------------------------------------------------
284284
type: function
285285
desc: "Retrieves a device function pointer to a user-defined function."

scripts/core/queue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ details:
204204
params:
205205
- type: $x_queue_handle_t
206206
name: hQueue
207-
desc: "[in] handle of the queue object to release"
207+
desc: "[in][release] handle of the queue object to release"
208208
returns:
209209
- $X_RESULT_ERROR_INVALID_QUEUE
210210
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY

scripts/core/sampler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ analogue:
132132
params:
133133
- type: $x_sampler_handle_t
134134
name: hSampler
135-
desc: "[in] handle of the sampler object to release"
135+
desc: "[in][release] handle of the sampler object to release"
136136
returns:
137137
- $X_RESULT_ERROR_INVALID_SAMPLER
138138
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY

scripts/core/usm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ details:
449449
params:
450450
- type: $x_usm_pool_handle_t
451451
name: pPool
452-
desc: "[in] pointer to USM memory pool"
452+
desc: "[in][release] pointer to USM memory pool"
453453
returns:
454454
- $X_RESULT_ERROR_INVALID_NULL_HANDLE
455455
--- #--------------------------------------------------------------------------

scripts/core/virtual_memory.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,4 @@ name: Release
302302
params:
303303
- type: $x_physical_mem_handle_t
304304
name: hPhysicalMem
305-
desc: "[in] handle of the physical memory object to release."
305+
desc: "[in][release] handle of the physical memory object to release."

scripts/templates/ldrddi.cpp.mako

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,17 @@ namespace ur_loader
271271
del add_local
272272
%>
273273
%for i, item in enumerate(epilogue):
274-
%if 0 == i:
274+
%if 0 == i and not item['release']:
275275
if( ${X}_RESULT_SUCCESS != result )
276276
return result;
277277
278278
%endif
279-
%if item['release']:
280-
// release loader handle
281-
${item['factory']}.release( ${item['name']} );
282-
%elif not '_native_object_' in item['obj']:
279+
## Before we can re-enable the releases we will need ref-counted object_t.
280+
## See unified-runtime github issue #1784
281+
##%if item['release']:
282+
##// release loader handle
283+
##${item['factory']}.release( ${item['name']} );
284+
%if not item['release'] and not '_native_object_' in item['obj'] or th.make_func_name(n, tags, obj) == 'urPlatformCreateWithNativeHandle':
283285
try
284286
{
285287
%if 'typename' in item:

0 commit comments

Comments
 (0)