Skip to content

Commit abef890

Browse files
EwanCjansol
andauthored
Expand on command-buffer interactions (#803)
* Expand on command-buffer interactions Clarifications to the cl_khr_command_buffer extension specification to address feedback from [Issue 799](#799). Does not contain changes to the API or implementation behaviour. * Elaborates on the role of the extension as a base which other layered extensions are intended to build upon to expand functionality. Removing outdated references to particular extension names. When a new layered extensions is released, then it can be linked back in here. * The interaction of kernel commands with `clSetKernelArg` is documented as part of the *kernel* parameter description. * Remove "mutable" from `cl_ndrange_kernel_command_properties_khr` type description, as other properties could end up being added here in layered extensions, not just those related to mutability. * Update ext/cl_khr_command_buffer.asciidoc Co-authored-by: jansol <jhs@psonet.com> Co-authored-by: jansol <jhs@psonet.com>
1 parent 3502274 commit abef890

1 file changed

Lines changed: 59 additions & 13 deletions

File tree

ext/cl_khr_command_buffer.asciidoc

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,59 @@ the capability is optional to enable optimizations on command-buffer recording.
131131

132132
=== Interactions with Other Extensions
133133

134-
All command recording entry-points return a mutable-command handle for
135-
modifying the command between enqueues of the command-buffer. However,
136-
functionality for mutating commands is not supported by this
137-
extension. These are provided for other extensions layered on top to use,
138-
such as `cl_khr_mutable_dispatch`.
139-
140-
Only a single command-queue specified on creation of a command-buffer can
141-
be used for recording commands to in this `cl_khr_command_buffer` extension.
142-
The `cl_khr_heterogeneous_replay` extension allows commands to be recorded across
143-
multiple queues in the same command-buffer, providing replay of heterogeneous
144-
task graphs.
134+
The introduction of the command-buffer abstraction enables functionality
135+
beyond what the `cl_khr_command_buffer` extension currently provides, i.e.
136+
the recording of immutable commands to a single queue which can then be
137+
executed without commands synchronizing outside the command-buffer. It is
138+
intended that extra functionality expanding on this will be provided as layered
139+
extensions on top of `cl_khr_command_buffer`.
140+
141+
Having `cl_khr_command_buffer` as a minimal base specification means that the
142+
API defines mechanisms for functionality that is not enabled by this extension,
143+
these are described in the following sub-sections. `cl_khr_command_buffer` will
144+
retain its provisional extension status until other layered extensions are
145+
released, as these may reveal modifications needed to the base specification to
146+
support their intended use cases.
147+
148+
==== NDRange Kernel Command Properties
149+
150+
The `clCommandNDRangeKernelKHR` entry-point defines a `properties` parameter of
151+
new type `cl_ndrange_kernel_command_properties_khr`. No properties are defined
152+
in `cl_khr_command_buffer`, but the parameter is intended to enable future
153+
functionality that would change the characteristics of the kernel command.
154+
155+
==== Command Handles
156+
157+
All command recording entry-points define a `cl_mutable_command_khr` output
158+
parameter which provides a handle to the specific command being recorded. Use of
159+
these output handles is not enabled by the `cl_khr_command_buffer` extension,
160+
but the handles will allow individual commands in a command-buffer to be
161+
referenced by the user. In particular, the capability for an application to use
162+
these handles to modify commands between enqueues of a command-buffer is
163+
envisaged.
164+
165+
==== List of Queues
166+
167+
Only a single command-queue can be associated with a command-buffer in the
168+
`cl_khr_command_buffer` extension, but the API is designed with the intention
169+
that a future extension will allow commands to be recorded across multiple
170+
queues in the same command-buffer, providing replay of heterogeneous task
171+
graphs.
172+
173+
Using multiple queue functionality will result in an error without any layered
174+
extensions to relax usage of the following API features:
175+
176+
* When a command-buffer is created the API enables passing a list of queues
177+
that the command-buffer will record commands to. Only a single queue is
178+
permitted in `cl_khr_command_buffer`.
179+
180+
* Individual command recording entry-points define a `cl_command_queue`
181+
parameter for which of the queues set on command-buffer creation that command
182+
should be record to. This must be passed as NULL in `cl_khr_command_buffer`.
183+
184+
* `clEnqueueCommandBufferKHR` takes a list of queues for command-buffer execution,
185+
correspond to those set on creation. Only a single queue is permitted in
186+
`cl_khr_command_buffer`.
145187

146188
=== New Types
147189

@@ -169,7 +211,7 @@ typedef cl_uint cl_sync_point_khr;
169211
// Handle returned on command recording
170212
typedef struct _cl_mutable_command_khr* cl_mutable_command_khr;
171213
172-
// Mutable properties of a clCommandNDRangeKernelKHR command
214+
// Properties of a clCommandNDRangeKernelKHR command
173215
typedef cl_properties cl_ndrange_kernel_command_properties_khr;
174216
175217
// Properties for command-buffer creation
@@ -1530,7 +1572,11 @@ corresponding desired value. The list is terminated with 0. If no properties are
15301572
required, _properties_ may be `NULL`. This extension does not define any
15311573
properties.
15321574

1533-
_kernel_ A valid kernel object.
1575+
_kernel_ A valid kernel object which **must** have its arguments set. Any
1576+
changes to _kernel_ after calling *clCommandNDRangeKernelKHR*, such as with
1577+
*clSetKernelArg* or *clSetKernelExecInfo*, have no effect on the recorded
1578+
command. If _kernel_ is recorded to a following *clCommandNDRangeKernelKHR*
1579+
command however, then that command will capture the updated state of _kernel_.
15341580

15351581
_work_dim_, _global_work_offset_, _global_work_size_, _local_work_size_ Refer
15361582
to *clEnqueueNDRangeKernel*.

0 commit comments

Comments
 (0)