Skip to content

Commit 541a6e8

Browse files
committed
Improved lifetime handling and docs of loader
* The loader now checks that all handles have been released before dropping factories. * Some arguments of functions have been marked as [alloc]. When the loader generates a handle from them, they will have an initial reference count that requires a single release. * Handles that are assigned to non-alloc pointers must exist and their reference counts are not incremented.
1 parent f058cb2 commit 541a6e8

File tree

22 files changed

+965
-878
lines changed

22 files changed

+965
-878
lines changed

include/ur_api.h

Lines changed: 110 additions & 102 deletions
Large diffs are not rendered by default.

scripts/core/adapter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ params:
3434
- type: "$x_adapter_handle_t*"
3535
name: phAdapters
3636
desc: |
37-
[out][optional][range(0, NumEntries)] array of handle of adapters.
37+
[out][optional][range(0, NumEntries)][alloc] array of handle of adapters.
3838
If NumEntries is less than the number of adapters available, then $xAdapterGet shall only retrieve that number of adapters.
3939
- type: "uint32_t*"
4040
name: "pNumAdapters"

scripts/core/context.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ params:
5959
[in][optional] pointer to context creation properties.
6060
- type: $x_context_handle_t*
6161
name: phContext
62-
desc: "[out] pointer to handle of context object created"
62+
desc: "[out][alloc] pointer to handle of context object created"
6363
returns:
6464
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
6565
- $X_RESULT_ERROR_OUT_OF_DEVICE_MEMORY

scripts/core/device.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ params:
136136
- type: "$x_device_handle_t*"
137137
name: phDevices
138138
desc: |
139-
[out][optional][range(0, NumEntries)] array of handle of devices.
139+
[out][optional][range(0, NumEntries)][alloc] array of handle of devices.
140140
If NumEntries is less than the number of devices available, then platform shall only retrieve that number of devices.
141141
- type: "uint32_t*"
142142
name: pNumDevices
@@ -832,7 +832,7 @@ params:
832832
desc: "[in][optional] pointer to native device properties struct."
833833
- type: "$x_device_handle_t*"
834834
name: phDevice
835-
desc: "[out] pointer to the handle of the device object created."
835+
desc: "[out][alloc] pointer to the handle of the device object created."
836836
returns:
837837
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
838838
- "If the adapter has no underlying equivalent handle."

scripts/core/enqueue.yml

Lines changed: 27 additions & 27 deletions
Large diffs are not rendered by default.

scripts/core/event.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ params:
317317
- type: "$x_event_handle_t*"
318318
name: phEvent
319319
desc: |
320-
[out] pointer to the handle of the event object created.
320+
[out][alloc] pointer to the handle of the event object created.
321321
returns:
322322
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
323323
- "If the adapter has no underlying equivalent handle."

scripts/core/exp-bindless-images.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ params:
581581
- type: $x_event_handle_t*
582582
name: phEvent
583583
desc: |
584-
[out][optional] return an event object that identifies this particular command instance. If phEventWaitList and phEvent are not NULL, phEvent must not refer to an element of the phEventWaitList array.
584+
[out][optional][alloc] return an event object that identifies this particular command instance. If phEventWaitList and phEvent are not NULL, phEvent must not refer to an element of the phEventWaitList array.
585585
returns:
586586
- $X_RESULT_ERROR_INVALID_QUEUE
587587
- $X_RESULT_ERROR_INVALID_VALUE
@@ -870,7 +870,7 @@ params:
870870
- type: $x_event_handle_t*
871871
name: phEvent
872872
desc: |
873-
[out][optional] return an event object that identifies this particular command instance. If phEventWaitList and phEvent are not NULL, phEvent must not refer to an element of the phEventWaitList array.
873+
[out][optional][alloc] return an event object that identifies this particular command instance. If phEventWaitList and phEvent are not NULL, phEvent must not refer to an element of the phEventWaitList array.
874874
returns:
875875
- $X_RESULT_ERROR_INVALID_QUEUE
876876
- $X_RESULT_ERROR_INVALID_VALUE
@@ -909,7 +909,7 @@ params:
909909
- type: $x_event_handle_t*
910910
name: phEvent
911911
desc: |
912-
[out][optional] return an event object that identifies this particular command instance. If phEventWaitList and phEvent are not NULL, phEvent must not refer to an element of the phEventWaitList array.
912+
[out][optional][alloc] return an event object that identifies this particular command instance. If phEventWaitList and phEvent are not NULL, phEvent must not refer to an element of the phEventWaitList array.
913913
returns:
914914
- $X_RESULT_ERROR_INVALID_QUEUE
915915
- $X_RESULT_ERROR_INVALID_VALUE

scripts/core/kernel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ params:
545545
- type: "$x_kernel_handle_t*"
546546
name: phKernel
547547
desc: |
548-
[out] pointer to the handle of the kernel object created.
548+
[out][alloc] pointer to the handle of the kernel object created.
549549
returns:
550550
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
551551
- "If the adapter has no underlying equivalent handle."

scripts/core/loader.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ decl: static
3737
params:
3838
- type: $x_loader_config_handle_t*
3939
name: phLoaderConfig
40-
desc: "[out] Pointer to handle of loader config object created."
40+
desc: "[out][alloc] Pointer to handle of loader config object created."
4141
--- #--------------------------------------------------------------------------
4242
type: function
4343
desc: "Get a reference to the loader config object."

scripts/core/platform.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ params:
229229
desc: "[in][optional] pointer to native platform properties struct."
230230
- type: "$x_platform_handle_t*"
231231
name: phPlatform
232-
desc: "[out] pointer to the handle of the platform object created."
232+
desc: "[out][alloc] pointer to the handle of the platform object created."
233233
returns:
234234
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
235235
- "If the adapter has no underlying equivalent handle."

0 commit comments

Comments
 (0)