Skip to content

Commit 8cf694a

Browse files
authored
minor semaphore external sharing fixes (#712)
* use common wording for enqueue commands fix a few missing asciidoctor attributes * add a footnote clarifying usage of the semaphore reference count * add the semaphore and external sharing extensions to the quick reference table * fix italics in the error conditions for clGetSemaphoreInfoKHR * fix the API suffix macros for all semaphore APIs * re-alphabetize footnotes * try to clarify when semaphore waits and signals are complete * remove duplicated word
1 parent cf034f1 commit 8cf694a

7 files changed

Lines changed: 78 additions & 21 deletions

OpenCL_Ext.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,17 @@ include::config/opencl.asciidoc[]
2929
// Formatting and links for API functions and enums.
3030
include::ext/dictionary.asciidoc[]
3131

32+
// External Footnotes
33+
// The extension spec will have access to all API and C footnotes.
34+
include::api/footnotes.asciidoc[]
35+
include::c/footnotes.asciidoc[]
36+
37+
<<<<
38+
3239
include::copyrights.txt[]
3340

41+
<<<
42+
3443
include::ext/introduction.asciidoc[]
3544

3645
include::ext/cl_khr_icd.asciidoc[]

api/footnotes.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ It is unsuitable for general use in applications. \
138138
This feature is provided for identifying memory leaks. \
139139
]
140140

141+
:fn-setkernelarg-prefer-unset-on-error: pass:n[ \
142+
Implementations are encouraged to favor this option as it makes it more likely that errors will be managed by applications. \
143+
]
144+
141145
:fn-srgb-image-requirements: pass:n[ \
142146
Support for reading from the {CL_sRGBA} image channel order is optional for 1D image buffers. \
143147
Support for writing to the {CL_sRGBA} image channel order is optional for all image types. \
@@ -162,7 +166,3 @@ Only once the ID has been allotted may it be exposed to OpenCL by proposing a me
162166
The merge must define a new enumerant by adding an `<enum>` tag to the {cl_khronos_vendor_id_TYPE} `<enums>` tag, with the `<value>` attribute set as the acquired Khronos vendor ID. \
163167
The `<name>` attribute must identify the vendor/adopter, and be of the form `CL_KHRONOS_VENDOR_ID_<vendor>`. \
164168
]
165-
166-
:fn-setkernelarg-prefer-unset-on-error: pass:n[ \
167-
Implementations are encouraged to favor this option as it makes it more likely that errors will be managed by applications. \
168-
]

ext/cl_khr_external_memory.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ The following new APIs are added as part of this spec. The details of each are d
249249

250250
==== Acquiring and Releasing External Memory Objects
251251

252-
To acquire OpenCL memory objects created from external memory handles, call the function
252+
To enqueue a command to acquire OpenCL memory objects created from external memory handles, call the function
253253

254254
include::{generated}/api/protos/clEnqueueAcquireExternalMemObjectsKHR.txt[]
255255

@@ -296,7 +296,7 @@ Otherwise, it returns one of the following errors:
296296
* {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources required by the OpenCL implementation on the device.
297297
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources required by the OpenCL implementation on the host.
298298

299-
To release OpenCL memory objects created from external memory handles, call the function
299+
To enqueue a command to release OpenCL memory objects created from external memory handles, call the function
300300

301301
include::{generated}/api/protos/clEnqueueReleaseExternalMemObjectsKHR.txt[]
302302

ext/cl_khr_external_semaphore.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ The `cl_khr_external_semaphore_dx_fence` extension extends {cl_external_semaphor
420420
When waiting on semaphores using {clEnqueueWaitSemaphoresKHR} or signaling semaphores using {clEnqueueSignalSemaphoresKHR}, the semaphore payload must be provided for semaphores created from {CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR}.
421421

422422

423-
* If _sema_objects_ list has a mix of cl_semaphore obtained from *CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR* and other handle types,
423+
* If _sema_objects_ list has a mix of cl_semaphore obtained from {CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR} and other handle types,
424424
then the _sema_payload_list_ should point to a list of _num_sema_objects_ payload values for each cl_semaphore in _sema_objects_.
425-
However, the payload values corresponding to semaphores with type CL_SEMAPHORE_TYPE_BINARY_KHR can be set to 0 or will be ignored.
425+
However, the payload values corresponding to semaphores with type {CL_SEMAPHORE_TYPE_BINARY_KHR} can be set to 0 or will be ignored.
426426

427-
*clEnqueueWaitSemaphoresKHR* and *clEnqueueSignalSemaphoresKHR* may return *CL_INVALID_VALUE* if _sema_objects_ list has one or more cl_semaphore obtained from *CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR* and _sema_payload_list_ is NULL.
427+
{clEnqueueWaitSemaphoresKHR} and {clEnqueueSignalSemaphoresKHR} may return {CL_INVALID_VALUE} if _sema_objects_ list has one or more cl_semaphore obtained from {CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR} and _sema_payload_list_ is NULL.
428428

429429

430430

ext/cl_khr_semaphore.asciidoc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Otherwise, it returns a `NULL` value with one of the following error values retu
281281

282282
==== Waiting on and signaling semaphores
283283

284-
To wait on a set of semaphores, call the function
284+
To enqueue a command to wait on a set of semaphores, call the function
285285

286286
include::{generated}/api/protos/clEnqueueWaitSemaphoresKHR.txt[]
287287

@@ -307,6 +307,8 @@ The context associated with events in _event_wait_list_ and that associated with
307307
_event_ returns an event object that identifies this particular command and can be used to query or queue a wait for this particular command to complete.
308308
_event_ can be `NULL` in which case it will not be possible for the application to query the status of this command or queue a wait for this command to complete.
309309

310+
The semaphore wait command waits for a list of events to complete and a list of semaphore objects to become signaled.
311+
The semaphore wait command returns an _event_ which can be waited on to ensure that all events in the _event_wait_list_ have completed and all semaphores in _sema_objects_ have been signaled.
310312
The successful completion of the event generated by {clEnqueueWaitSemaphoresKHR} called on one or more semaphore objects of type {CL_SEMAPHORE_TYPE_BINARY_KHR} leads to un-signaling the corresponding semaphore objects and the state of these semaphore objects will be reset. Any subsequent {clEnqueueWaitSemaphoresKHR} operation on these semaphores without a pending {clEnqueueSignalSemaphoresKHR} may lead to implementation-defined behavior.
311313

312314
{clEnqueueWaitSemaphoresKHR} returns {CL_SUCCESS} if the function is executed successfully.
@@ -329,7 +331,7 @@ Otherwise, it returns one of the following errors:
329331
* {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources required by the OpenCL implementation on the device.
330332
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources required by the OpenCL implementation on the host.
331333

332-
To signal a set of semaphores, call the function
334+
To enqueue a command to signal a set of semaphores, call the function
333335

334336
include::{generated}/api/protos/clEnqueueSignalSemaphoresKHR.txt[]
335337

@@ -357,7 +359,9 @@ _event_ returns an event object that identifies this particular command and can
357359
_event_ can be `NULL` in which case it will not be possible for the application to query the status of this command
358360
or queue a wait for this command to complete.
359361

360-
The successful completion of event generated by {clEnqueueSignalSemaphoresKHR} called on one or more semaphore objects of type {CL_SEMAPHORE_TYPE_BINARY_KHR} changes the state of the corresponding semaphore objects to signaled. Any subsequent {clEnqueueSignalSemaphoresKHR} operation on these semaphores without a pending {clEnqueueWaitSemaphoresKHR} may lead to implementation-defined behavior.
362+
The semaphore signal command waits for a list of events to complete and then signals a list of semaphore objects.
363+
The semaphore signal command returns an _event_ which can be waited on to ensure that all events in the _event_wait_list_ have completed and all semaphores in _sema_objects_ have been signaled.
364+
The successful completion of the event generated by {clEnqueueSignalSemaphoresKHR} called on one or more semaphore objects of type {CL_SEMAPHORE_TYPE_BINARY_KHR} changes the state of the corresponding semaphore objects to signaled. Any subsequent {clEnqueueSignalSemaphoresKHR} operation on these semaphores without a pending {clEnqueueWaitSemaphoresKHR} may lead to implementation-defined behavior.
361365

362366
{clEnqueueSignalSemaphoresKHR} returns {CL_SUCCESS} if the function is executed successfully.
363367
Otherwise, it returns one of the following errors:
@@ -405,7 +409,7 @@ being queried by _param_value_. If _param_value_size_ret_ is `NULL`, it is ignor
405409
| {cl_context_TYPE}
406410
| Returns the context specified when the semaphore is created.
407411

408-
| {CL_SEMAPHORE_REFERENCE_COUNT_KHR}
412+
| {CL_SEMAPHORE_REFERENCE_COUNT_KHR} footnote:[{fn-reference-count-usage}]
409413
| {cl_uint_TYPE}
410414
| Returns the semaphore reference count.
411415

@@ -440,7 +444,7 @@ Otherwise, it returns one of the following errors:
440444
** if _sema_object_ is not a valid semaphore
441445
* {CL_INVALID_VALUE}
442446
** if _param_name_ is not one of the attribute defined in table <<cl_khr_semaphore_info-table>> or
443-
** if _param_value_size is less than the size of Return Type of the corresponding _param_name_ attribute as defined in table <<cl_khr_semaphore_info-table>>.
447+
** if _param_value_size_ is less than the size of Return Type of the corresponding _param_name_ attribute as defined in table <<cl_khr_semaphore_info-table>>.
444448
* {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources required by the OpenCL implementation on the device.
445449
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources required by the OpenCL implementation on the host.
446450

ext/quick_reference.asciidoc

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,46 @@
7373
| Extend versioning of platform, devices, extensions, etc.
7474
| Extension
7575

76+
| <<cl_khr_external_memory,cl_khr_external_memory>>
77+
| Common Functionality for External Memory Sharing
78+
| Provisional Extension
79+
80+
| <<cl_khr_external_memory,cl_khr_external_memory_dma_buf>>
81+
| dma_buf External Memory Handles
82+
| Provisional Extension
83+
84+
| <<cl_khr_external_memory,cl_khr_external_memory_dx>>
85+
| Direct3D 11 and 12 External Memory Handles
86+
| Provisional Extension
87+
88+
| <<cl_khr_external_memory,cl_khr_external_memory_opaque_fd>>
89+
| Opaque File Descriptor External Memory Handles
90+
| Provisional Extension
91+
92+
| <<cl_khr_external_memory,cl_khr_external_memory_win32>>
93+
| NT Handle External Memory Handles
94+
| Provisional Extension
95+
96+
| <<cl_khr_external_semaphore,cl_khr_external_semaphore>>
97+
| Common Functionality for External Semaphore Sharing
98+
| Provisional Extension
99+
100+
| <<cl_khr_external_semaphore,cl_khr_external_semaphore_dx_fence>>
101+
| Direct3D 12 External Semaphore Handles
102+
| Provisional Extension
103+
104+
| <<cl_khr_external_semaphore,cl_khr_external_semaphore_opaque_fd>>
105+
| Opaque File Descriptor External Semaphore Handles
106+
| Provisional Extension
107+
108+
| <<cl_khr_external_semaphore,cl_khr_external_semaphore_sync_fd>>
109+
| Sync FD External Semaphore Handles
110+
| Provisional Extension
111+
112+
| <<cl_khr_external_semaphore,cl_khr_external_memory_win32>>
113+
| NT Handle External Semaphore Handles
114+
| Provisional Extension
115+
76116
| <<cl_khr_fp16,cl_khr_fp16>>
77117
| Operations on 16-bit Floating-Point Values
78118
| Extension
@@ -161,6 +201,10 @@
161201
| Set the Current Kernel Rounding Mode
162202
| DEPRECATED
163203

204+
| <<cl_khr_semaphore,cl_khr_semaphore>>
205+
| Semaphore Synchronization Primitives
206+
| Provisional Extension
207+
164208
| <<cl_khr_spir,cl_khr_spir>>
165209
| Standard Portable Intermediate Representation Programs
166210
| Extension, Superseded by IL Programs / SPIR-V

xml/cl.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,13 +2439,13 @@ server's OpenCL/api-docs repository.
24392439
<param>const <type>size_t</type>* <name>global_work_size</name></param>
24402440
<param><type>size_t</type>* <name>suggested_local_work_size</name></param>
24412441
</command>
2442-
<command suffix="CL_API_SUFFIX__VERSION_3_0">
2442+
<command suffix="CL_API_SUFFIX__VERSION_1_2">
24432443
<proto><type>cl_semaphore_khr</type> <name>clCreateSemaphoreWithPropertiesKHR</name></proto>
24442444
<param><type>cl_context</type> <name>context</name></param>
24452445
<param>const <type>cl_semaphore_properties_khr</type>* <name>sema_props</name></param>
24462446
<param><type>cl_int</type>* <name>errcode_ret</name></param>
24472447
</command>
2448-
<command suffix="CL_API_SUFFIX__VERSION_3_0">
2448+
<command suffix="CL_API_SUFFIX__VERSION_1_2">
24492449
<proto><type>cl_int</type> <name>clEnqueueWaitSemaphoresKHR</name></proto>
24502450
<param><type>cl_command_queue</type> <name>command_queue</name></param>
24512451
<param><type>cl_uint</type> <name>num_sema_objects</name></param>
@@ -2455,7 +2455,7 @@ server's OpenCL/api-docs repository.
24552455
<param>const <type>cl_event</type>* <name>event_wait_list</name></param>
24562456
<param><type>cl_event</type>* <name>event</name></param>
24572457
</command>
2458-
<command suffix="CL_API_SUFFIX__VERSION_3_0">
2458+
<command suffix="CL_API_SUFFIX__VERSION_1_2">
24592459
<proto><type>cl_int</type> <name>clEnqueueSignalSemaphoresKHR</name></proto>
24602460
<param><type>cl_command_queue</type> <name>command_queue</name></param>
24612461
<param><type>cl_uint</type> <name>num_sema_objects</name></param>
@@ -2465,23 +2465,23 @@ server's OpenCL/api-docs repository.
24652465
<param>const <type>cl_event</type>* <name>event_wait_list</name></param>
24662466
<param><type>cl_event</type>* <name>event</name></param>
24672467
</command>
2468-
<command suffix="CL_API_SUFFIX__VERSION_3_0">
2468+
<command suffix="CL_API_SUFFIX__VERSION_1_2">
24692469
<proto><type>cl_int</type> <name>clGetSemaphoreInfoKHR</name></proto>
24702470
<param><type>cl_semaphore_khr</type> <name>sema_object</name></param>
24712471
<param><type>cl_semaphore_info_khr</type> <name>param_name</name></param>
24722472
<param><type>size_t</type> <name>param_value_size</name></param>
24732473
<param><type>void</type>* <name>param_value</name></param>
24742474
<param><type>size_t</type>* <name>param_value_size_ret</name></param>
24752475
</command>
2476-
<command suffix="CL_API_SUFFIX__VERSION_3_0">
2476+
<command suffix="CL_API_SUFFIX__VERSION_1_2">
24772477
<proto><type>cl_int</type> <name>clReleaseSemaphoreKHR</name></proto>
24782478
<param><type>cl_semaphore_khr</type> <name>sema_object</name></param>
24792479
</command>
2480-
<command suffix="CL_API_SUFFIX__VERSION_3_0">
2480+
<command suffix="CL_API_SUFFIX__VERSION_1_2">
24812481
<proto><type>cl_int</type> <name>clRetainSemaphoreKHR</name></proto>
24822482
<param><type>cl_semaphore_khr</type> <name>sema_object</name></param>
24832483
</command>
2484-
<command suffix="CL_API_SUFFIX__VERSION_3_0">
2484+
<command suffix="CL_API_SUFFIX__VERSION_1_2">
24852485
<proto><type>cl_int</type> <name>clGetSemaphoreHandleForTypeKHR</name></proto>
24862486
<param><type>cl_semaphore_khr</type> <name>sema_object</name></param>
24872487
<param><type>cl_device_id</type> <name>device</name></param>

0 commit comments

Comments
 (0)