Skip to content

Commit 5efafb0

Browse files
authored
publish cl_khr_spirv_queries (#1385)
* initial extension draft for cl_khr_spirv_queries * clarify that all returned strings are const and should not be modified move the meaning of the queries to the SPIR-V environment spec * update the XML file to record that the extension is ratified
1 parent 723f7d3 commit 5efafb0

4 files changed

Lines changed: 76 additions & 1 deletion

File tree

api/cl_khr_spirv_queries.asciidoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2025 The Khronos Group Inc.
2+
// SPDX-License-Identifier: CC-BY-4.0
3+
4+
include::{generated}/meta/{refprefix}cl_khr_spirv_queries.txt[]
5+
6+
=== Other Extension Metadata
7+
8+
*Last Modified Date*::
9+
2025-06-04
10+
*IP Status*::
11+
No known IP claims.
12+
13+
=== Description
14+
15+
{cl_khr_spirv_queries_EXT} adds queries to determine the SPIR-V extended
16+
instruction sets, SPIR-V extensions, and SPIR-V capabilities that are supported
17+
by an OpenCL device.
18+
19+
=== New Enums
20+
21+
* {cl_device_info_TYPE}
22+
** {CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS_KHR}
23+
** {CL_DEVICE_SPIRV_EXTENSIONS_KHR}
24+
** {CL_DEVICE_SPIRV_CAPABILITIES_KHR}
25+
26+
=== Version History
27+
28+
* Revision 1.0.0, 2025-06-04
29+
** Initial version.

api/opencl_platform_layer.asciidoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,30 @@ ifdef::cl_khr_extended_versioning[or {cl_name_version_khr_TYPE}[]]
738738
For an OpenCL 2.1 or 2.2 device, at least one version of SPIR-V must
739739
be reported.
740740

741+
ifdef::cl_khr_spirv_queries[]
742+
| {CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS_KHR_anchor}
743+
744+
include::{generated}/api/version-notes/CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS_KHR.asciidoc[]
745+
| const {char_TYPE}*[]
746+
| Returns an array of null-terminated strings, where each string describes
747+
a SPIR-V extended instruction set that is supported by the device.
748+
749+
| {CL_DEVICE_SPIRV_EXTENSIONS_KHR_anchor}
750+
751+
include::{generated}/api/version-notes/CL_DEVICE_SPIRV_EXTENSIONS_KHR.asciidoc[]
752+
| const {char_TYPE}*[]
753+
| Returns an array of null-terminated strings, where each string describes
754+
a SPIR-V extension that is supported by the device.
755+
756+
| {CL_DEVICE_SPIRV_CAPABILITIES_KHR_anchor}
757+
758+
include::{generated}/api/version-notes/CL_DEVICE_SPIRV_CAPABILITIES_KHR.asciidoc[]
759+
| {cl_uint_TYPE}[]
760+
| Returns an array of SPIR-V token values, where each value describes a
761+
SPIR-V capability that is supported by the device.
762+
763+
endif::cl_khr_spirv_queries[]
764+
741765
| {CL_DEVICE_IMAGE2D_MAX_WIDTH_anchor}
742766

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

env/extensions.asciidoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,15 @@ For the *OpReadClockKHR* instruction requiring this capability, supported values
403403

404404
For unsupported _Scope_ values, the behavior of *OpReadClockKHR* is undefined.
405405

406+
==== `cl_khr_spirv_queries`
407+
408+
If the OpenCL environment supports the extension `cl_khr_spirv_queries`, then:
409+
410+
* For each of the strings returned by the query `CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS_KHR`, it is valid to import the SPIR-V extended instruction set in a SPIR-V module using *OpExtInstImport*.
411+
* For each of the strings returned by the query `CL_DEVICE_SPIRV_EXTENSIONS_KHR`, it is valid to declare use of the SPIR-V extension in a SPIR-V module using *OpExtension*.
412+
* For each of the capabilities returned by the query `CL_DEVICE_SPIRV_CAPABILITIES_KHR`, it is valid to declare the SPIR-V capability in a SPIR-V module using *OpCapability*.
413+
Some capabilities may additionally require a specific SPIR-V version, or a SPIR-V extension to be declared via *OpExtension*.
414+
406415
=== Embedded Profile Extensions
407416

408417
==== `cles_khr_int64`

xml/cl.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1823,7 +1823,10 @@ server's OpenCL/api-docs repository.
18231823
<enum value="0x12B6" name="CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT"/>
18241824
<enum value="0x12B7" name="CL_COMMAND_BUFFER_MUTABLE_DISPATCH_ASSERTS_KHR"/>
18251825
<enum value="0x12B8" name="CL_MUTABLE_DISPATCH_ASSERTS_KHR"/>
1826-
<unused start="0x12B9" end="0x1FFF" comment="Reserved for core API tokens"/>
1826+
<enum value="0x12B9" name="CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS_KHR"/>
1827+
<enum value="0x12BA" name="CL_DEVICE_SPIRV_EXTENSIONS_KHR"/>
1828+
<enum value="0x12BB" name="CL_DEVICE_SPIRV_CAPABILITIES_KHR"/>
1829+
<unused start="0x12BC" end="0x1FFF" comment="Reserved for core API tokens"/>
18271830
</enums>
18281831

18291832
<enums start="0x2000" end="0x201F" name="enums.2000" vendor="Khronos" comment="Reserved for interop with other APIs">
@@ -7614,5 +7617,15 @@ server's OpenCL/api-docs repository.
76147617
<enum name="CL_UNORM_INT14X2_EXT"/>
76157618
</require>
76167619
</extension>
7620+
<extension name="cl_khr_spirv_queries" revision="1.0.0" supported="opencl" ratified="opencl">
7621+
<require>
7622+
<type name="CL/cl.h"/>
7623+
</require>
7624+
<require comment="cl_device_info">
7625+
<enum name="CL_DEVICE_SPIRV_EXTENDED_INSTRUCTION_SETS_KHR"/>
7626+
<enum name="CL_DEVICE_SPIRV_EXTENSIONS_KHR"/>
7627+
<enum name="CL_DEVICE_SPIRV_CAPABILITIES_KHR"/>
7628+
</require>
7629+
</extension>
76177630
</extensions>
76187631
</registry>

0 commit comments

Comments
 (0)