Skip to content

Commit

Permalink
add missing anchors (#1120)
Browse files Browse the repository at this point in the history
* add missing anchors for external memory and semaphore commands

* add missing anchors for external memory handles
also a few missing anchors for various extensions

* fix a few more missing anchors and incorrect attributes
  • Loading branch information
bashbaug authored Mar 31, 2024
1 parent 2349f64 commit 298e828
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 36 deletions.
2 changes: 1 addition & 1 deletion OpenCL_C.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9735,7 +9735,7 @@ The *F* conversion specifier produces `INF`, `INFINITY`, or `NAN` instead of

**e,E** A `double`, `half__n__`, `float__n__` or `double__n__` argument
representing a floating-point number is converted in the style
__[__**-**__]d__**.**__ddd __**e{plusmn}}**_dd_, where there is one digit
__[__**-**__]d__**.**__ddd __**e{plusmn}**_dd_, where there is one digit
(which is nonzero if the argument is nonzero) before the decimal-point
character and the number of digits after it is equal to the precision; if
the precision is missing, it is taken as 6; if the precision is zero and the
Expand Down
6 changes: 3 additions & 3 deletions api/cl_khr_extended_versioning.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Versioning>> section.

=== New Macro Names

* {CL_VERSION_MAJOR_BITS_KHR_anchor}
* {CL_VERSION_MINOR_BITS_KHR_anchor}
* {CL_VERSION_PATCH_BITS_KHR_anchor}
* {CL_VERSION_MAJOR_BITS_KHR}
* {CL_VERSION_MINOR_BITS_KHR}
* {CL_VERSION_PATCH_BITS_KHR}
* `CL_VERSION_MAJOR_MASK_KHR`
* `CL_VERSION_MINOR_MASK_KHR`
* `CL_VERSION_PATCH_MASK_KHR`
Expand Down
2 changes: 1 addition & 1 deletion api/cl_khr_external_semaphore.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ while (true) {
* Revision 0.9.0, 2021-09-10
** Initial version (provisional).
* Revision 0.9.1, 2023-11-16
** Added {CL_SEMAPHORE_EXPORTABLE_KHR_anchor}.
** Added {CL_SEMAPHORE_EXPORTABLE_KHR}.
* Revision 0.9.2, 2023-11-21
** Added re-import function call to `<<cl_khr_external_semaphore_sync_fd>>`

2 changes: 1 addition & 1 deletion api/cl_khr_external_semaphore_sync_fd.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ external semaphore using the APIs introduced by
* Revision 0.9.0, 2021-09-10
** Initial version (provisional).
* Revision 0.9.1, 2023-11-16
** Added {CL_SEMAPHORE_EXPORTABLE_KHR_anchor}.
** Added {CL_SEMAPHORE_EXPORTABLE_KHR}.
* Revision 0.9.2, 2023-11-21
** Added re-import function call to `<<cl_khr_external_semaphore_sync_fd>>`
2 changes: 1 addition & 1 deletion api/cl_khr_gl_event.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ runtime.
. Where can events generated from GL syncs be usable?
+
--
*PROPOSED*: Only with clEnqueueAcquireGLObjects, and attempting to use such
*PROPOSED*: Only with {clEnqueueAcquireGLObjects}, and attempting to use such
an event elsewhere will generate an error.
There is no apparent use case for using such events elsewhere, and possibly
some cost to supporting it, balanced by the cost of checking the source of
Expand Down
2 changes: 1 addition & 1 deletion api/cl_khr_semaphore.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ In particular, this extension defines:
* {cl_device_info_TYPE}
** {CL_DEVICE_SEMAPHORE_TYPES_KHR}
* {cl_semaphore_type_khr_TYPE}
** {CL_SEMAPHORE_TYPE_BINARY_KHR} 1
** {CL_SEMAPHORE_TYPE_BINARY_KHR}
* {cl_semaphore_info_khr_TYPE}
** {CL_SEMAPHORE_CONTEXT_KHR}
** {CL_SEMAPHORE_REFERENCE_COUNT_KHR}
Expand Down
2 changes: 1 addition & 1 deletion api/cl_khr_spir.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ feature in OpenCL 2.1.
* {cl_device_info_TYPE}
** {CL_DEVICE_SPIR_VERSIONS}
* {cl_program_binary_type_TYPE}
** CL_PROGRAM_BINARY_TYPE_INTERMEDIATE}
** {CL_PROGRAM_BINARY_TYPE_INTERMEDIATE}

=== Version History

Expand Down
2 changes: 1 addition & 1 deletion api/opencl_architecture.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@ working with version numbers easier.
{cl_version_TYPE}.
* `CL_VERSION_PATCH` extracts the _patch_ version from a packed
{cl_version_TYPE}.
* `CL_MAKE_VERSION` returns a packed `cl_version_TYPE} from a
* `CL_MAKE_VERSION` returns a packed {cl_version_TYPE} from a
_major_, _minor_ and _patch_ version.
* {CL_VERSION_MAJOR_BITS_anchor}, {CL_VERSION_MINOR_BITS_anchor}, and
{CL_VERSION_PATCH_BITS_anchor} are the number of bits in the
Expand Down
12 changes: 9 additions & 3 deletions api/opencl_platform_layer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ endif::cl_khr_image2d_from_buffer[]
include::{generated}/api/version-notes/CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT.asciidoc[]

ifdef::cl_khr_image2d_from_buffer[]
The equivalent {CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_anchor} may be used
The equivalent {CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR_anchor} may be used
if the `<<cl_khr_image2d_from_buffer>>` extension is supported.
endif::cl_khr_image2d_from_buffer[]
| {cl_uint_TYPE}
Expand Down Expand Up @@ -1813,13 +1813,17 @@ include::{generated}/api/version-notes/CL_DEVICE_UUID_KHR.asciidoc[]

Device UUIDs must be immutable for a given device across processes,
driver APIs, driver versions, and system reboots.

{CL_UUID_SIZE_KHR_anchor} is the size of the UUID, in bytes.
| {CL_DRIVER_UUID_KHR_anchor}

include::{generated}/api/version-notes/CL_DRIVER_UUID_KHR.asciidoc[]

| {cl_uchar_TYPE}[{CL_UUID_SIZE_KHR}]
| Returns a universally unique identifier (UUID) for the software driver
for the device.

{CL_UUID_SIZE_KHR} is the size of the UUID, in bytes.
| {CL_DEVICE_LUID_VALID_KHR_anchor}

include::{generated}/api/version-notes/CL_DEVICE_LUID_VALID_KHR.asciidoc[]
Expand All @@ -1843,6 +1847,8 @@ include::{generated}/api/version-notes/CL_DEVICE_LUID_KHR.asciidoc[]
value can be cast to an `LUID` object and must be equal to the locally
unique identifier of an `IDXGIAdapter1` object that corresponds to the
OpenCL device.

{CL_LUID_SIZE_KHR_anchor} is the size of the LUID, in bytes.
| {CL_DEVICE_NODE_MASK_KHR_anchor}

include::{generated}/api/version-notes/CL_DEVICE_NODE_MASK_KHR.asciidoc[]
Expand Down Expand Up @@ -1936,14 +1942,14 @@ include::{generated}/api/version-notes/CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIE
| Returns the integer dot product capabilities supported by the
device.

{CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR} is always
{CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR_anchor} is always
set, indicating that all implementations that support
`<<cl_khr_integer_dot_product>>` must support dot product built-in
functions and, when SPIR-V is supported, SPIR-V instructions that
take four-component vectors of 8-bit integers packed into 32-bit
integers as input.

{CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR} is set when dot
{CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR_anchor} is set when dot
product built-in functions and, when SPIR-V is supported, SPIR-V
instructions that take four-component of 8-bit elements as input are
supported.
Expand Down
69 changes: 49 additions & 20 deletions api/opencl_runtime_layer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5568,7 +5568,7 @@ The `<<cl_khr_external_memory_opaque_fd>>` extension extends
of handles, and adds as a property that may be specified when creating a
buffer or an image memory object from an external handle:

* {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR} specifies a POSIX file
* {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR_anchor} specifies a POSIX file
descriptor handle that has only limited valid usage outside of OpenCL
and other compatible APIs.
It must be compatible with the POSIX system calls `dup`, `dup2`,
Expand All @@ -5585,7 +5585,7 @@ The `<<cl_khr_external_memory_dma_buf>>` extension extends
handles, and adds as a property that may be specified when creating a buffer
or an image memory object from an external handle:

* {CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR} is a file descriptor for a Linux
* {CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR_anchor} is a file descriptor for a Linux
dma_buf.
It owns a reference to the underlying memory resource represented by its
memory object.
Expand All @@ -5607,21 +5607,21 @@ The `<<cl_khr_external_memory_dx>>` extension extends
of handles, and adds as a property that may be specified when creating a
buffer or an image memory object from an external handle:

* {CL_EXTERNAL_MEMORY_HANDLE_D3D11_TEXTURE_KHR} specifies an NT handle
* {CL_EXTERNAL_MEMORY_HANDLE_D3D11_TEXTURE_KHR_anchor} specifies an NT handle
returned by `IDXGIResource1::CreateSharedHandle` referring to a Direct3D
10 or 11 texture resource.
It owns a reference to the memory used by the Direct3D resource.
* {CL_EXTERNAL_MEMORY_HANDLE_D3D11_TEXTURE_KMT_KHR} specifies a global
* {CL_EXTERNAL_MEMORY_HANDLE_D3D11_TEXTURE_KMT_KHR_anchor} specifies a global
share handle returned by `IDXGIResource::GetSharedHandle` referring to a
Direct3D 10 or 11 texture resource.
It does not own a reference to the underlying Direct3D resource, and
will therefore become invalid when all memory objects and Direct3D
resources associated with it are destroyed.
* {CL_EXTERNAL_MEMORY_HANDLE_D3D12_HEAP_KHR} specifies an NT handle
* {CL_EXTERNAL_MEMORY_HANDLE_D3D12_HEAP_KHR_anchor} specifies an NT handle
returned by `ID3D12Device::CreateSharedHandle` referring to a Direct3D
12 heap resource.
It owns a reference to the resources used by the Direct3D heap.
* {CL_EXTERNAL_MEMORY_HANDLE_D3D12_RESOURCE_KHR} specifies an NT handle
* {CL_EXTERNAL_MEMORY_HANDLE_D3D12_RESOURCE_KHR_anchor} specifies an NT handle
returned by `ID3D12Device::CreateSharedHandle` referring to a Direct3D
12 committed resource.
It owns a reference to the memory used by the Direct3D resource.
Expand All @@ -5633,15 +5633,15 @@ The `<<cl_khr_external_memory_win32>>` extension extends
of handles, and adds as a property that may be specified when creating a
buffer or an image memory object from an external handle:

* {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR} specifies an NT handle that
* {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR_anchor} specifies an NT handle that
has only limited valid usage outside of OpenCL and other compatible
APIs.
It must be compatible with the functions `DuplicateHandle`,
`CloseHandle`, `CompareObjectHandles`, `GetHandleInformation`, and
`SetHandleInformation`.
It owns a reference to the underlying memory resource represented by its
memory object.
* {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR} specifies a global
* {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR_anchor} specifies a global
share handle that has only limited valid usage outside of OpenCL and
other compatible APIs.
It is not compatible with any native APIs.
Expand Down Expand Up @@ -6213,10 +6213,10 @@ include::{generated}/api/version-notes/clGetGLObjectInfo.asciidoc[]

* _memobj_ is the memory object to query.
* _gl_object_type_ returns the type of OpenGL object attached to _memobj_
and can be {CL_GL_OBJECT_BUFFER}, {CL_GL_OBJECT_TEXTURE2D},
{CL_GL_OBJECT_TEXTURE3D}, {CL_GL_OBJECT_TEXTURE2D_ARRAY},
{CL_GL_OBJECT_TEXTURE1D}, {CL_GL_OBJECT_TEXTURE1D_ARRAY},
{CL_GL_OBJECT_TEXTURE_BUFFER}, or {CL_GL_OBJECT_RENDERBUFFER}.
and can be {CL_GL_OBJECT_BUFFER_anchor}, {CL_GL_OBJECT_TEXTURE2D_anchor},
{CL_GL_OBJECT_TEXTURE3D_anchor}, {CL_GL_OBJECT_TEXTURE2D_ARRAY_anchor},
{CL_GL_OBJECT_TEXTURE1D_anchor}, {CL_GL_OBJECT_TEXTURE1D_ARRAY_anchor},
{CL_GL_OBJECT_TEXTURE_BUFFER_anchor}, or {CL_GL_OBJECT_RENDERBUFFER_anchor}.
If _gl_object_type_ is `NULL`, it is ignored
* _gl_object_name_ returns the OpenGL object name used to create _memobj_.
If _gl_object_name_ is `NULL`, it is ignored.
Expand Down Expand Up @@ -10875,7 +10875,10 @@ Also see `<<cl_khr_subgroups>>`.

include::{generated}/api/version-notes/CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE.asciidoc[]

Also see `<<cl_khr_subgroups>>`.
ifdef::cl_khr_subgroups[]
The equivalent {CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR_anchor} may be used if
the `<<cl_khr_subgroups>>` extension is supported.
endif::cl_khr_subgroups[]
| {size_t_TYPE}*
| {size_t_TYPE}
| Returns the maximum sub-group size for this kernel.
Expand All @@ -10892,7 +10895,10 @@ Also see `<<cl_khr_subgroups>>`.

include::{generated}/api/version-notes/CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE.asciidoc[]

Also see `<<cl_khr_subgroups>>`.
ifdef::cl_khr_subgroups[]
The equivalent {CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR_anchor} may be used if
the `<<cl_khr_subgroups>>` extension is supported.
endif::cl_khr_subgroups[]
| {size_t_TYPE}*
| {size_t_TYPE}
| Returns the number of sub-groups that will be present in each
Expand Down Expand Up @@ -12112,6 +12118,17 @@ ifdef::cl_khr_egl_event[]
include::{generated}/api/version-notes/CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR.asciidoc[]
endif::cl_khr_egl_event[]

ifdef::cl_khr_external_memory[]
| {clEnqueueAcquireExternalMemObjectsKHR}
| {CL_COMMAND_ACQUIRE_EXTERNAL_MEM_OBJECTS_KHR_anchor}

include::{generated}/api/version-notes/CL_COMMAND_ACQUIRE_EXTERNAL_MEM_OBJECTS_KHR.asciidoc[]
| {clEnqueueReleaseExternalMemObjectsKHR}
| {CL_COMMAND_RELEASE_EXTERNAL_MEM_OBJECTS_KHR_anchor}

include::{generated}/api/version-notes/CL_COMMAND_RELEASE_EXTERNAL_MEM_OBJECTS_KHR.asciidoc[]
endif::cl_khr_external_memory[]

ifdef::cl_khr_gl_sharing[]
| {clEnqueueAcquireGLObjects}
| {CL_COMMAND_ACQUIRE_GL_OBJECTS_anchor}
Expand All @@ -12130,6 +12147,17 @@ ifdef::cl_khr_gl_event[]
include::{generated}/api/version-notes/CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR.asciidoc[]
endif::cl_khr_gl_event[]

ifdef::cl_khr_semaphore[]
| {clEnqueueSignalSemaphoresKHR}
| {CL_COMMAND_SEMAPHORE_SIGNAL_KHR_anchor}

include::{generated}/api/version-notes/CL_COMMAND_SEMAPHORE_SIGNAL_KHR.asciidoc[]
| {clEnqueueWaitSemaphoresKHR}
| {CL_COMMAND_SEMAPHORE_WAIT_KHR_anchor}

include::{generated}/api/version-notes/CL_COMMAND_SEMAPHORE_WAIT_KHR.asciidoc[]
endif::cl_khr_semaphore[]

|====

Using {clGetEventInfo} to determine if a command identified by _event_ has
Expand Down Expand Up @@ -12747,14 +12775,15 @@ This section describes the semaphore types and functions defined by the

* {cl_semaphore_type_khr_TYPE} represent the different types of
semaphores.
** It is mandatory to support {CL_SEMAPHORE_TYPE_BINARY_KHR}.
// TODO: This isn't a very good anchor for {CL_SEMAPHORE_TYPE_BINARY_KHR}...
** It is mandatory to support {CL_SEMAPHORE_TYPE_BINARY_KHR_anchor}.
* {cl_semaphore_properties_khr_TYPE} represents properties associated with
semaphores.
** {CL_SEMAPHORE_TYPE_KHR} must be supported.
* {cl_semaphore_info_khr_TYPE} represents queries for additional
information about semaphores.
** All enums described in the "`New API Enums`" section of the
`<<cl_khr_semaphore>>` extension for cl_semaphore_info_khr_TYPE} must
`<<cl_khr_semaphore>>` extension for {cl_semaphore_info_khr_TYPE} must
be supported.
* {cl_semaphore_payload_khr_TYPE} represents payload values of semaphores.
* {cl_semaphore_khr_TYPE} represent semaphore objects.
Expand Down Expand Up @@ -12791,7 +12820,7 @@ properties by {cl_semaphore_properties_khr_TYPE} that can be passed to
| {CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR_anchor}
| {cl_device_id_TYPE}[]
| Specifies the list of OpenCL devices (terminated with
{CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR}) to associate with the
{CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR_anchor}) to associate with the
semaphore.
Only a single device is permitted in the list.

Expand All @@ -12801,7 +12830,7 @@ ifdef::cl_khr_external_semaphore[]
include::{generated}/api/version-notes/CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR.asciidoc[]
| {cl_external_semaphore_handle_type_khr_TYPE}[]
| Specifies the list of semaphore handle type properties (terminated
with {CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR}) that can be
with {CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR_anchor}) that can be
used to export the semaphore being created.
endif::cl_khr_external_semaphore[]
|====
Expand Down Expand Up @@ -15803,7 +15832,7 @@ description here and is defined as:
include::{generated}/api/structs/cl_mutable_base_config_khr.txt[]

* _type_ is the type of this structure, and must be
{CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR}
{CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR_anchor}
* _next_ is `NULL` or a pointer to an extending structure.
* _num_mutable_dispatch_ is the number of mutable-dispatch objects to
configure in this enqueue of the command-buffer.
Expand All @@ -15823,7 +15852,7 @@ The {cl_mutable_dispatch_arg_khr_TYPE} structure is passed to
include::{generated}/api/structs/cl_mutable_dispatch_config_khr.txt[]

* _type_ is the type of this structure, and must be
{CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}.
{CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR_anchor}.
* _next_ is `NULL` or a pointer to an extending structure.
* _command_ is a mutable-command object returned by
{clCommandNDRangeKernelKHR} representing a kernel execution as part of a
Expand Down
6 changes: 3 additions & 3 deletions scripts/checklinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
sourcefile.close()

# We're not going to check API links.
#filelinks = re.findall(r"{((cl\w+)|(CL\w+))}", sourcetext)
filelinks = re.findall(r"{((CL\w+))}", sourcetext)
fileanchors = re.findall(r"{((cl\w+)|(CL\w+))_anchor}", sourcetext)
#filelinks = re.findall(r"{((cl\w+)|(CL_\w+))}", sourcetext)
filelinks = re.findall(r"{((CL_\w+))}", sourcetext)
fileanchors = re.findall(r"{((cl\w+)|(CL_\w+))_anchor}", sourcetext)

filelinks = [re.sub(r"_anchor\b", "", link[0]) for link in filelinks]
fileanchors = [anchor[0] for anchor in fileanchors]
Expand Down

0 comments on commit 298e828

Please sign in to comment.