Skip to content

Commit 532b6ea

Browse files
author
Ewan Crawford
authored
Command-buffer query for supported queue properties (#850)
This change introduces a new device query related to the command-buffer extension - `CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR`. This is different from `CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR`, as we want to convey to the user that an implementation supports using a queue property with a command-buffer, but is not *required* to use the property. This supersedes reporting queue related values from the `CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR` query. The flaw with `CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR` is that it contains bits explicitly added by the command-buffer extension for reporting support for queue properties. This is a brittle design, as any new queue property added in future would need to have a new bit added here in the command-buffer extension to report support when used with command-buffers. Instead a better design is to have a new query reporting queue properties supported, `CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR`, and keeping `CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR` for capabilities unrelated to the command-queue properties. The `CL_COMMAND_BUFFER_CAPABILITY_OUT_OF_ORDER_KHR` use-case can now be covered by returning `CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE` from `CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR`, so it is removed.
1 parent 20b89ef commit 532b6ea

4 files changed

Lines changed: 25 additions & 18 deletions

File tree

api/cl_khr_command_buffer.asciidoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
include::{generated}/meta/{refprefix}cl_khr_command_buffer.txt[]
55

66
// *Revision*::
7-
// 0.9.5
7+
// 0.9.6
88
// *Extension and Version Dependencies*::
99
// This extension requires OpenCL 1.2 or later.
1010
// Buffering of SVM commands requires OpenCL 2.0 or later.
1111

1212
=== Other Extension Metadata
1313

1414
*Last Modified Date*::
15-
2024-07-24
15+
2024-10-02
1616
*IP Status*::
1717
No known IP claims.
1818
*Contributors*::
@@ -237,11 +237,11 @@ features:
237237
* {cl_device_info_TYPE}
238238
** {CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR}
239239
** {CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR}
240+
** {CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR}
240241
* {cl_device_command_buffer_capabilities_khr_TYPE}
241242
** {CL_COMMAND_BUFFER_CAPABILITY_KERNEL_PRINTF_KHR}
242243
** {CL_COMMAND_BUFFER_CAPABILITY_DEVICE_SIDE_ENQUEUE_KHR}
243244
** {CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR}
244-
** {CL_COMMAND_BUFFER_CAPABILITY_OUT_OF_ORDER_KHR}
245245
* {cl_command_buffer_properties_khr_TYPE}
246246
** {CL_COMMAND_BUFFER_FLAGS_KHR}
247247
* {cl_command_buffer_flags_khr_TYPE}
@@ -464,4 +464,5 @@ features:
464464
* 0.9.5, 2024-07-24
465465
** Add a properties parameter to all command recording entry-points
466466
(provisional).
467-
467+
* 0.9.6, 2024-10-02
468+
** Add device query for supported queue properties (provisional).

api/opencl_platform_layer.asciidoc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,12 +1742,6 @@ include::{generated}/api/version-notes/CL_COMMAND_BUFFER_CAPABILITY_DEVICE_SIDE_
17421742

17431743
include::{generated}/api/version-notes/CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR.asciidoc[]
17441744

1745-
{CL_COMMAND_BUFFER_CAPABILITY_OUT_OF_ORDER_KHR_anchor} Device
1746-
supports the ability to record command-buffers to out-of-order
1747-
command-queues.
1748-
1749-
include::{generated}/api/version-notes/CL_COMMAND_BUFFER_CAPABILITY_OUT_OF_ORDER_KHR.asciidoc[]
1750-
17511745
ifdef::cl_khr_command_buffer_multi_device[]
17521746
{CL_COMMAND_BUFFER_CAPABILITY_MULTIPLE_QUEUE_KHR_anchor} Device
17531747
supports the ability to record commands to more than one
@@ -1766,6 +1760,18 @@ include::{generated}/api/version-notes/CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_P
17661760
It is valid for a command-queue to be created with extra properties
17671761
in addition to this base requirement and still be compatible with
17681762
command-buffer execution.
1763+
1764+
| {CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR_anchor}
1765+
1766+
include::{generated}/api/version-notes/CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR.asciidoc[]
1767+
1768+
| {cl_command_queue_properties_TYPE}
1769+
| Bitmask of the supported properties with which a command-queue may be
1770+
created to allow a command-buffer to be executed on it. It is invalid
1771+
for a command-queue to be created with a property not reported and
1772+
still be compatible with command-buffer execution.
1773+
1774+
The mandated minimum capability is: {CL_QUEUE_PROFILING_ENABLE}.
17691775
endif::cl_khr_command_buffer[]
17701776

17711777
ifdef::cl_khr_command_buffer_multi_device[]

api/opencl_runtime_layer.asciidoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14378,10 +14378,9 @@ returned in _errcode_ret_:
1437814378

1437914379
* {CL_INVALID_COMMAND_QUEUE} if any command-queue in _queues_ is not a
1438014380
valid command-queue.
14381-
* {CL_INCOMPATIBLE_COMMAND_QUEUE_KHR} if any command-queue in _queues_ is
14382-
an out-of-order command-queue and the device associated with the
14383-
command-queue does not support the
14384-
{CL_COMMAND_BUFFER_CAPABILITY_OUT_OF_ORDER_KHR} capability.
14381+
* {CL_INCOMPATIBLE_COMMAND_QUEUE_KHR} if the properties of any command-queue
14382+
in _queues_ contains a property not specified by
14383+
{CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR}.
1438514384
* {CL_INCOMPATIBLE_COMMAND_QUEUE_KHR} if the properties of any
1438614385
command-queue in _queues_ does not contain the minimum properties
1438714386
specified by {CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR}.

xml/cl.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ server's OpenCL/api-docs repository.
13301330
<enum bitpos="0" name="CL_COMMAND_BUFFER_CAPABILITY_KERNEL_PRINTF_KHR"/>
13311331
<enum bitpos="1" name="CL_COMMAND_BUFFER_CAPABILITY_DEVICE_SIDE_ENQUEUE_KHR"/>
13321332
<enum bitpos="2" name="CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR"/>
1333-
<enum bitpos="3" name="CL_COMMAND_BUFFER_CAPABILITY_OUT_OF_ORDER_KHR"/>
1333+
<unused start="3" end="3" comment="Available for future use"/>
13341334
<enum bitpos="4" name="CL_COMMAND_BUFFER_CAPABILITY_MULTIPLE_QUEUE_KHR"/>
13351335
<unused start="5" end="6" comment="Used by future command-buffer extensions"/>
13361336
<unused start="6" end="31"/>
@@ -1780,7 +1780,8 @@ server's OpenCL/api-docs repository.
17801780
<enum value="0x1297" name="CL_COMMAND_BUFFER_STATE_KHR"/>
17811781
<enum value="0x1298" name="CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR"/>
17821782
<enum value="0x1299" name="CL_COMMAND_BUFFER_CONTEXT_KHR"/>
1783-
<unused start="0x129A" end="0x129F" comment="Available to use"/>
1783+
<enum value="0x129A" name="CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR"/>
1784+
<unused start="0x129B" end="0x129F" comment="Available to use"/>
17841785
<enum value="0x12A0" name="CL_MUTABLE_COMMAND_COMMAND_QUEUE_KHR"/>
17851786
<enum value="0x12A1" name="CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR"/>
17861787
<enum value="0x12A2" name="CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR"/>
@@ -7190,7 +7191,7 @@ server's OpenCL/api-docs repository.
71907191
<command name="clSetContentSizeBufferPoCL"/>
71917192
</require>
71927193
</extension>
7193-
<extension name="cl_khr_command_buffer" revision="0.9.5" supported="opencl" depends="CL_VERSION_1_2" ratified="opencl" provisional="true">
7194+
<extension name="cl_khr_command_buffer" revision="0.9.6" supported="opencl" depends="CL_VERSION_1_2" ratified="opencl" provisional="true">
71947195
<require>
71957196
<type name="CL/cl.h"/>
71967197
</require>
@@ -7207,13 +7208,13 @@ server's OpenCL/api-docs repository.
72077208
</require>
72087209
<require comment="cl_device_info">
72097210
<enum name="CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR"/>
7211+
<enum name="CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR"/>
72107212
<enum name="CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR"/>
72117213
</require>
72127214
<require comment="cl_device_command_buffer_capabilities_khr - bitfield">
72137215
<enum name="CL_COMMAND_BUFFER_CAPABILITY_KERNEL_PRINTF_KHR"/>
72147216
<enum name="CL_COMMAND_BUFFER_CAPABILITY_DEVICE_SIDE_ENQUEUE_KHR"/>
72157217
<enum name="CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR"/>
7216-
<enum name="CL_COMMAND_BUFFER_CAPABILITY_OUT_OF_ORDER_KHR"/>
72177218
</require>
72187219
<require comment="cl_command_buffer_properties_khr">
72197220
<enum name="CL_COMMAND_BUFFER_FLAGS_KHR"/>

0 commit comments

Comments
 (0)