Skip to content

Commit 12fc5ab

Browse files
committed
Merge branch 'main' into error-code-consistency
2 parents c646372 + d05e2c3 commit 12fc5ab

7 files changed

Lines changed: 398 additions & 23 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
*~
33
out/
44
*.pyc
5+
gen/
56

67
# Files generated from cl.xml
7-
generated/api
8+
generated/
89

910
# Files generated by extraction from spec source
1011
man/*.txt

api/cl_khr_command_buffer_mutable_dispatch.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ void pointer using {cl_command_buffer_update_type_khr_TYPE}.
111111
** {CL_COMMAND_BUFFER_MUTABLE_DISPATCH_ASSERTS_KHR}
112112
* {cl_command_buffer_update_type_khr_TYPE}
113113
** {CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}
114+
* {cl_command_buffer_state_khr_TYPE}
115+
** {CL_COMMAND_BUFFER_STATE_FINALIZED_KHR}
114116
* New Error Codes
115117
** {CL_INVALID_MUTABLE_COMMAND_KHR}
116118

@@ -379,3 +381,6 @@ may be a introduced as a stand alone extension.
379381
** Move `CL_COMMAND_BUFFER_SIMULTANEOUS_USE_KHR` and
380382
`CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR` in this
381383
extension from the base extension (experimental).
384+
* Revision 0.9.5 2025-08-28
385+
** Permitting recording ND-range kernel commands without having set all of
386+
their arguments (experimental).

api/cl_khr_unified_svm.asciidoc

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// Copyright 2025 The Khronos Group Inc.
2+
// SPDX-License-Identifier: CC-BY-4.0
3+
4+
include::{generated}/meta/{refprefix}cl_khr_unified_svm.txt[]
5+
6+
=== Other Extension Metadata
7+
8+
*Last Modified Date*::
9+
2025-08-30
10+
*IP Status*::
11+
No known IP claims.
12+
*Contributors*::
13+
- Brice Videau, Argonne National Laboratory
14+
- Kévin Petit, Arm Ltd.
15+
- Ewan Crawford, Codeplay Software Ltd.
16+
- Paul Fradgley, Imagination Technologies
17+
- Ben Ashbaugh, Intel
18+
- Pekka Jääskeläinen, Intel
19+
- Nikhil Joshi, NVIDIA
20+
- Balaji Calidas, Qualcomm Technologies Inc.
21+
22+
=== Description
23+
24+
This extension adds additional types of Shared Virtual Memory (SVM) to OpenCL.
25+
26+
The extension is still under development.
27+
To learn more about the APIs proposed for this extension, or to provide feedback, please visit:
28+
29+
https://github.com/KhronosGroup/OpenCL-Docs/pull/1282
30+
31+
=== New Commands
32+
33+
* {clSVMAllocWithPropertiesKHR}[[clSVMAllocWithPropertiesKHR]]
34+
* {clSVMFreeWithPropertiesKHR}[[clSVMFreeWithPropertiesKHR]]
35+
* {clGetSVMPointerInfoKHR}[[clGetSVMPointerInfoKHR]]
36+
* {clGetSVMSuggestedTypeIndexKHR}[[clGetSVMSuggestedTypeIndexKHR]]
37+
38+
=== New Types
39+
40+
* {cl_svm_capabilities_khr_TYPE}
41+
* {cl_svm_alloc_properties_khr_TYPE}
42+
* {cl_svm_alloc_access_flags_khr_TYPE}
43+
* {cl_svm_free_properties_khr_TYPE}
44+
* {cl_svm_free_flags_khr_TYPE}
45+
* {cl_svm_pointer_info_khr_TYPE}
46+
47+
=== New Enums
48+
49+
* {cl_platform_info_TYPE}
50+
** {CL_PLATFORM_SVM_TYPE_CAPABILITIES_KHR_ANCHOR}
51+
* {cl_device_info_TYPE}
52+
** {CL_DEVICE_SVM_TYPE_CAPABILITIES_KHR_ANCHOR}
53+
* {cl_svm_capabilities_khr_TYPE}
54+
** {CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_KHR_ANCHOR}
55+
** {CL_SVM_CAPABILITY_SYSTEM_ALLOCATED_KHR_ANCHOR}
56+
** {CL_SVM_CAPABILITY_DEVICE_OWNED_KHR_ANCHOR}
57+
** {CL_SVM_CAPABILITY_DEVICE_UNASSOCIATED_KHR_ANCHOR}
58+
** {CL_SVM_CAPABILITY_CONTEXT_ACCESS_KHR_ANCHOR}
59+
** {CL_SVM_CAPABILITY_HOST_OWNED_KHR_ANCHOR}
60+
** {CL_SVM_CAPABILITY_HOST_READ_KHR_ANCHOR}
61+
** {CL_SVM_CAPABILITY_HOST_WRITE_KHR_ANCHOR}
62+
** {CL_SVM_CAPABILITY_HOST_MAP_KHR_ANCHOR}
63+
** {CL_SVM_CAPABILITY_DEVICE_READ_KHR_ANCHOR}
64+
** {CL_SVM_CAPABILITY_DEVICE_WRITE_KHR_ANCHOR}
65+
** {CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_KHR_ANCHOR}
66+
** {CL_SVM_CAPABILITY_CONCURRENT_ACCESS_KHR_ANCHOR}
67+
** {CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_KHR_ANCHOR}
68+
** {CL_SVM_CAPABILITY_INDIRECT_ACCESS_KHR_ANCHOR}
69+
* {cl_svm_alloc_properties_khr_TYPE}
70+
** {CL_SVM_ALLOC_ASSOCIATED_DEVICE_HANDLE_KHR_ANCHOR}
71+
** {CL_SVM_ALLOC_ACCESS_FLAGS_KHR_ANCHOR}
72+
** {CL_SVM_ALLOC_ALIGNMENT_KHR_ANCHOR}
73+
* {cl_svm_alloc_access_flags_khr_TYPE}
74+
** {CL_SVM_ALLOC_ACCESS_HOST_NOREAD_KHR_ANCHOR}
75+
** {CL_SVM_ALLOC_ACCESS_HOST_NOWRITE_KHR_ANCHOR}
76+
** {CL_SVM_ALLOC_ACCESS_DEVICE_NOREAD_KHR_ANCHOR}
77+
** {CL_SVM_ALLOC_ACCESS_DEVICE_NOWRITE_KHR_ANCHOR}
78+
* {cl_svm_pointer_info_khr_TYPE}
79+
** {CL_SVM_INFO_TYPE_INDEX_KHR_ANCHOR}
80+
** {CL_SVM_INFO_CAPABILITIES_KHR_ANCHOR}
81+
** {CL_SVM_INFO_PROPERTIES_KHR_ANCHOR}
82+
** {CL_SVM_INFO_ACCESS_FLAGS_KHR_ANCHOR}
83+
** {CL_SVM_INFO_BASE_PTR_KHR_ANCHOR}
84+
** {CL_SVM_INFO_SIZE_KHR_ANCHOR}
85+
** {CL_SVM_INFO_ASSOCIATED_DEVICE_HANDLE_KHR_ANCHOR}
86+
* {cl_kernel_exec_info_TYPE}
87+
** {CL_KERNEL_EXEC_INFO_SVM_INDIRECT_ACCESS_KHR_ANCHOR}
88+
89+
=== SVM Type Convenience Macros
90+
91+
* {CL_SVM_TYPE_MACRO_COARSE_GRAIN_BUFFER_KHR_ANCHOR}
92+
* {CL_SVM_TYPE_MACRO_FINE_GRAIN_BUFFER_KHR_ANCHOR}
93+
* {CL_SVM_TYPE_MACRO_DEVICE_KHR_ANCHOR}
94+
* {CL_SVM_TYPE_MACRO_HOST_KHR_ANCHOR}
95+
* {CL_SVM_TYPE_MACRO_SINGLE_DEVICE_SHARED_KHR_ANCHOR}
96+
* {CL_SVM_TYPE_MACRO_SYSTEM_KHR_ANCHOR}
97+
98+
=== Version History
99+
100+
* Revision 0.9.0, 2025-08-30
101+
** Initial revision incorporated into the main specification (experimental).

api/opencl_runtime_layer.asciidoc

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,8 +1247,8 @@ Otherwise, they return one of the following errors:
12471247
** if _buffer_origin_, _host_origin_, or _region_ is `NULL`
12481248
** if the region being read or written specified by _buffer_origin_, _region_, _buffer_row_pitch_, and _buffer_slice_pitch_ is out of bounds
12491249
** if any _region_ array element is zero
1250-
** if _buffer_row_pitch_ is not equal to zero and is less than _region_[0].
1251-
** if _buffer_slice_pitch_ is not equal to zero and is less than the_region_[1] times _buffer_row_pitch_
1250+
** if _buffer_row_pitch_ is not equal to zero and is less than _region_[0]
1251+
** if _buffer_slice_pitch_ is not equal to zero and is less than _region_[1] times _buffer_row_pitch_
12521252
** if _buffer_slice_pitch_ is not equal to zero and is not a multiple of _buffer_row_pitch_
12531253
** if _host_row_pitch_ is not equal to zero and is less than _region_[0]
12541254
** if _host_slice_pitch_ is not equal to zero and is less than _region_[1] times _host_row_pitch_
@@ -1415,7 +1415,7 @@ Otherwise, it returns one of the following errors:
14151415
** if _event_wait_list_ is not `NULL` and _num_events_in_wait_list_ is zero
14161416
** if event objects in _event_wait_list_ are not valid events
14171417
* {CL_MEM_COPY_OVERLAP}
1418-
** if _src_buffer_ and _dst_buffer_ are the same buffer or sub-buffer object and the source and destination regions overlap.
1418+
** if _src_buffer_ and _dst_buffer_ are the same buffer or sub-buffer object and the source and destination regions overlap
14191419
** if _src_buffer_ and _dst_buffer_ are different sub-buffers of the same associated buffer object and they overlap
14201420
** Refer to <<check-copy-overlap, Checking for Memory Copy Overlap>> for
14211421
details on how to determine if source and destination regions overlap.
@@ -1563,7 +1563,7 @@ Otherwise, it returns one of the following errors:
15631563
** if _event_wait_list_ is not `NULL` and _num_events_in_wait_list_ is zero
15641564
** if event objects in _event_wait_list_ are not valid events
15651565
* {CL_MEM_COPY_OVERLAP}
1566-
** if _src_buffer_ and _dst_buffer_ are the same buffer or sub-buffer object and the source and destination regions overlap.
1566+
** if _src_buffer_ and _dst_buffer_ are the same buffer or sub-buffer object and the source and destination regions overlap
15671567
** if _src_buffer_ and _dst_buffer_ are different sub-buffers of the same associated buffer object and they overlap
15681568
** Refer to <<check-copy-overlap, Checking for Memory Copy Overlap>> for
15691569
details on how to determine if source and destination regions overlap.
@@ -1657,7 +1657,7 @@ Otherwise, it returns one of the following errors:
16571657
* {CL_INVALID_MEM_OBJECT}
16581658
** if _buffer_ is not a valid buffer object
16591659
* {CL_INVALID_VALUE}
1660-
** if the region being read or written specified by _offset_ and _size_ is out of bounds
1660+
** if the region being filled specified by _offset_ and _size_ is out of bounds
16611661
** if _pattern_ is `NULL`
16621662
** if _pattern_size_ is zero
16631663
** if _pattern_size_ is not a power of two
@@ -9806,6 +9806,8 @@ successfully.
98069806
Otherwise, it returns one of the following errors:
98079807

98089808
* {CL_INVALID_PROGRAM} if _program_ is not a valid program object.
9809+
* {CL_INVALID_CONTEXT} if the context associated with _program_ and
9810+
programs in _input_headers_ are not the same.
98099811
* {CL_INVALID_VALUE} if _device_list_ is `NULL` and _num_devices_ is greater
98109812
than zero, or if _device_list_ is not `NULL` and _num_devices_ is zero.
98119813
* {CL_INVALID_VALUE} if _num_input_headers_ is zero and
@@ -9945,6 +9947,8 @@ check if the link was successful or not.
99459947
The list of errors that can be returned are:
99469948

99479949
* {CL_INVALID_CONTEXT} if _context_ is not a valid context.
9950+
* {CL_INVALID_CONTEXT} if the context associated with programs in
9951+
_input_programs_ is not the same as _context_.
99489952
* {CL_INVALID_VALUE} if _device_list_ is `NULL` and _num_devices_ is greater
99499953
than zero, or if _device_list_ is not `NULL` and _num_devices_ is zero.
99509954
* {CL_INVALID_VALUE} if _num_input_programs_ is zero and _input_programs_ is
@@ -14843,9 +14847,16 @@ the recording state.
1484314847
Recording:: Initial state of a command-buffer on creation, where commands can be
1484414848
recorded to the command-buffer.
1484514849

14850+
[[finalized]]
14851+
Finalized:: State after command recording has finished with
14852+
{clFinalizeCommandBufferKHR}, but there is at least one command for which not
14853+
all arguments or parameters have been set (this is a valid state only for
14854+
mutable command buffers).
14855+
1484614856
[[executable]]
1484714857
Executable:: State after command recording has finished with
14848-
{clFinalizeCommandBufferKHR} and the command-buffer may be enqueued.
14858+
{clFinalizeCommandBufferKHR} and all the arguments and parameters of all
14859+
commands have been set. In this state the command-buffer may be enqueued.
1484914860

1485014861
// Image generated from the following mermaid diagram description using https://mermaid.live
1485114862
// Ideally we'd use the asciidoctor-diagram extension to generate the rendered diagram, but
@@ -14855,7 +14866,9 @@ Executable:: State after command recording has finished with
1485514866
// ....
1485614867
// stateDiagram-v2
1485714868
// [*] --> Recording: Create
14858-
// Recording -->Executable: Finalize
14869+
// Recording -->Finalized: Finalize
14870+
// Finalized --> Executable: All commands arguments/parameters set
14871+
// Executable
1485914872
// ....
1486014873

1486114874
image::images/commandbuffer_lifecycle.png[align="center", title="Lifecycle of a command-buffer."]
@@ -15101,9 +15114,10 @@ include::{generated}/api/version-notes/clFinalizeCommandBufferKHR.asciidoc[]
1510115114

1510215115
[NOTE]
1510315116
====
15104-
{clFinalizeCommandBufferKHR} places the command-buffer in the
15105-
<<executable, Executable>> state where commands can no longer be recorded, at
15106-
this point the command-buffer is ready to be enqueued.
15117+
{clFinalizeCommandBufferKHR} places the command-buffer either in the
15118+
<<finalized, Finalized>> or <<executable, Executable>> states where commands can
15119+
no longer be recorded. If the new state is <<executable, Executable>>, the
15120+
command-buffer is ready to be enqueued.
1510715121
====
1510815122

1510915123
// refError
@@ -16110,7 +16124,14 @@ ifdef::cl_khr_command_buffer_mutable_dispatch[]
1611016124
in the <<ndrange-kernel-properties-table, List of supported properties
1611116125
by clCommandNDRangeKernelKHR>> table.
1611216126
endif::cl_khr_command_buffer_mutable_dispatch[]
16127+
ifndef::cl_khr_command_buffer_mutable_dispatch[]
1611316128
* _kernel_ is a valid kernel object which **must** have its arguments set.
16129+
endif::cl_khr_command_buffer_mutable_dispatch[]
16130+
ifdef::cl_khr_command_buffer_mutable_dispatch[]
16131+
* _kernel_ is a valid kernel object, which **must** have its arguments set
16132+
unless the command has the {CL_MUTABLE_DISPATCH_ARGUMENTS_KHR} property set
16133+
(see description of argument _mutable_handle_).
16134+
endif::cl_khr_command_buffer_mutable_dispatch[]
1611416135
Any changes to _kernel_ after calling {clCommandNDRangeKernelKHR}, such
1611516136
as with {clSetKernelArg} or {clSetKernelExecInfo}, have no effect on the
1611616137
recorded command.
@@ -16288,6 +16309,14 @@ The starting local ID is always (0, 0, ... 0).
1628816309
successfully.
1628916310
Otherwise, it returns the errors defined by {clEnqueueNDRangeKernel} except:
1629016311

16312+
ifdef::cl_khr_command_buffer_mutable_dispatch[]
16313+
{CL_INVALID_KERNEL_ARGS} is replaced with:
16314+
16315+
* {CL_INVALID_KERNEL_ARGS} if the kernel argument values have not been
16316+
specified and the {CL_MUTABLE_DISPATCH_ARGUMENTS_KHR} flag was not set in
16317+
the _properties_ parameter.
16318+
endif::cl_khr_command_buffer_mutable_dispatch[]
16319+
1629116320
{CL_INVALID_COMMAND_QUEUE} is replaced with:
1629216321

1629316322
* {CL_INVALID_COMMAND_QUEUE} if the
@@ -16728,6 +16757,13 @@ device occupancy high by avoiding blocking in host code.
1672816757

1672916758
[open,refpage='clUpdateMutableCommandsKHR',desc='Modify configuration of mutable-command handles to update behavior for future enqueues',type='protos']
1673016759
--
16760+
16761+
When recording an ND-range kernel command, the kernel's arguments do not have to
16762+
be set, and setting them may be postponed to after the command buffer's
16763+
finalization (in which case, the command buffer is in Finalized state).
16764+
All the arguments must be set before the command buffer can be enqueued
16765+
for execution (Executable state).
16766+
1673116767
To modify the configuration of mutable-command handles returned during
1673216768
_command_buffer_ recording, updating the behavior of those commands in
1673316769
future enqueues of _command_buffer_, call the function
@@ -16984,8 +17020,15 @@ include::{generated}/api/version-notes/CL_COMMAND_BUFFER_STATE_KHR.asciidoc[]
1698417020

1698517021
include::{generated}/api/version-notes/CL_COMMAND_BUFFER_STATE_RECORDING_KHR.asciidoc[]
1698617022

17023+
{CL_COMMAND_BUFFER_STATE_FINALIZED_KHR_anchor} is returned when an
17024+
instance of _command_buffer_ has been finalized, but there is at least
17025+
one command for which not all arguments or parameters have been set.
17026+
17027+
include::{generated}/api/version-notes/CL_COMMAND_BUFFER_STATE_FINALIZED_KHR.asciidoc[]
17028+
1698717029
{CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR_anchor} is returned when
16988-
_command_buffer_ has been finalized.
17030+
_command_buffer_ has been finalized, all the arguments and parameters of
17031+
all commands have been set.
1698917032

1699017033
include::{generated}/api/version-notes/CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR.asciidoc[]
1699117034

env/validation_rules.asciidoc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ For all *OpTypeImage* type-declaration instructions:
3232
* _Image Format_ must be *Unknown*, indicating that the image does not
3333
have a specified format.
3434
* The optional image _Access Qualifier_ must be present.
35-
36-
The image write instruction *OpImageWrite* must not include any optional
37-
_Image Operands_.
3835

39-
The image read instructions *OpImageRead* and *OpImageSampleExplicitLod*
40-
must not include the optional _Image Operand_ *ConstOffset*.
36+
For all image read and write instructions, if an optional _Image Operand_ is
37+
present, then it must not include *ConstOffset*.
4138

4239
For all *Atomic Instructions*:
4340

images/commandbuffer_lifecycle.png

18.4 KB
Loading

0 commit comments

Comments
 (0)