Skip to content

Commit c1dddb7

Browse files
committed
Added instance platform specification.
1 parent 1dfc9b4 commit c1dddb7

3 files changed

Lines changed: 101 additions & 2 deletions

File tree

api/cl_khr_icd.asciidoc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include::{generated}/meta/{refprefix}cl_khr_icd.txt[]
99
=== Other Extension Metadata
1010

1111
*Last Modified Date*::
12-
2025-12-15
12+
2026-02-09
1313
*IP Status*::
1414
No known IP claims.
1515

@@ -255,6 +255,21 @@ query dispatchable entry points using {clIcdGetFunctionAddressForPlatformKHR}
255255
and then set the platform dispatch data using
256256
{clIcdSetPlatformDispatchDataKHR}.
257257

258+
New in version 2.0.2, the ICD Loader will also query the following functions
259+
from the library: {clIcdCreateInstancePlatformKHR} and
260+
{clIcdDestroyInstancePlatformKHR}. If these two functions are present and the
261+
library's platforms are ICD 2 compatible, these platforms will be deemed
262+
*instance compatible*. In this case, rather than using the platform directly,
263+
the ICD Loader will first create an instance platform and then query
264+
dispatchable entry points for this instance platform using
265+
{clIcdGetFunctionAddressForPlatformKHR} and then set the platform dispatch data
266+
using {clIcdSetPlatformDispatchDataKHR}. Devices returned by {clGetDeviceIDs}
267+
used on an instance platform will be instance devices. This created instance
268+
platform will be destroyed during loader deinitialization unless legacy
269+
behavior is enabled. Each instance platform (and attached instance devices)
270+
must support having a different dispatch information set through
271+
{clIcdSetPlatformDispatchDataKHR}.
272+
258273
=== New Commands
259274

260275
* {clIcdGetPlatformIDsKHR}
@@ -264,6 +279,11 @@ New in version 2.0.0:
264279
* {clIcdGetFunctionAddressForPlatformKHR}
265280
* {clIcdSetPlatformDispatchDataKHR}
266281

282+
New in version 2.0.2:
283+
284+
* {clIcdCreateInstancePlatformKHR}
285+
* {clIcdDestroyInstancePlatformKHR}
286+
267287
=== New Enums
268288

269289
Accepted as _param_name_ to the function {clGetPlatformInfo}:
@@ -279,6 +299,11 @@ and {clUnloadCompiler} in the dispatch structure:
279299

280300
* `CL_ICD2_TAG_KHR`
281301

302+
New in version 2.0.2, accepted as terminator to the _properties_ list of
303+
{clIcdCreateInstancePlatformKHR}.
304+
305+
* {CL_INSTANCE_PLATFORM_PROPERTIES_LIST_END_KHR}
306+
282307
=== Issues
283308

284309
. Some OpenCL functions do not take an object argument from which their
@@ -365,3 +390,5 @@ for propagating this information to new objects.
365390
** Loader managed dispatch.
366391
* Revision 2.0.1, 2025-12-15
367392
** Loader deinitialization.
393+
* Revision 2.0.2, 2026-02-09
394+
** Instance platform support.

api/opencl_platform_layer.asciidoc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ include::{generated}/api/protos/clIcdGetFunctionAddressForPlatformKHR.txt[]
102102
include::{generated}/api/version-notes/clIcdGetFunctionAddressForPlatformKHR.asciidoc[]
103103

104104
* _platform_ refers to the platform ID returned by {clIcdGetPlatformIDsKHR}
105+
or by {clIcdCreateInstancePlatformKHR}
105106
* _func_name_ name of an API entry point
106107

107108
{clIcdGetFunctionAddressForPlatformKHR} returns the address of the API entry
@@ -137,6 +138,57 @@ Otherwise, it returns one of the following errors:
137138
implementation on the host
138139
--
139140

141+
[open,refpage='clIcdCreateInstancePlatformKHR',desc='Create an instance of a platform',type='protos']
142+
--
143+
An instance platform can be created by the ICD Loader by using the following
144+
function:
145+
146+
include::{generated}/api/protos/clIcdCreateInstancePlatformKHR.txt[]
147+
include::{generated}/api/version-notes/clIcdCreateInstancePlatformKHR.asciidoc[]
148+
149+
* _platform_ refers to the platform ID returned by {clIcdGetPlatformIDsKHR}
150+
151+
* _properties_ specifies a list of instance platform property names and their
152+
corresponding values. Each property name is immediately followed by the
153+
corresponding desired value. The list is terminated with
154+
{CL_INSTANCE_PLATFORM_PROPERTIES_LIST_END_KHR_anchor}. No properties are
155+
supported currently. _properties_ can be NULL, in which case all properties
156+
take on their default values.
157+
158+
* _errcode_ret_ will return an appropriate error code as described below.
159+
If _errcode_ret_ is `NULL`, no error code is returned.
160+
161+
{clIcdCreateInstancePlatformKHR} returns a valid non-zero OpenCL platform object
162+
and _errcode_ret_ is set to {CL_SUCCESS} if the instance platform object is
163+
created successfully.
164+
Otherwise, it returns a `NULL` value with one of the following error values
165+
returned in _errcode_ret_:
166+
167+
* {CL_INVALID_PLATFORM} if _platform_ is not a valid platform.
168+
* {CL_INVALID_PROPERTY} if an instance platform property name in
169+
_properties_ is not a supported property name, if the value specified for
170+
a supported property name is not valid, or if the same property name is
171+
specified more than once.
172+
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources
173+
required by the OpenCL implementation on the host.
174+
--
175+
176+
[open,refpage='clIcdDestroyInstancePlatformKHR',desc='Destroy an instance of a platform',type='protos']
177+
--
178+
An instance platform can be destroyed by the ICD Loader by using the following
179+
function:
180+
181+
include::{generated}/api/protos/clIcdDestroyInstancePlatformKHR.txt[]
182+
include::{generated}/api/version-notes/clIcdDestroyInstancePlatformKHR.asciidoc[]
183+
184+
* _platform_ refers to the instance platform object returned by
185+
{clIcdCreateInstancePlatformKHR}
186+
187+
{clIcdDestroyInstancePlatformKHR} returns {CL_SUCCESS} if the function is
188+
executed successfully.
189+
It returns {CL_INVALID_PLATFORM} if _platform_ is not a valid instance platform.
190+
--
191+
140192
endif::cl_khr_icd[]
141193

142194
[open,refpage='clGetPlatformInfo',desc='Query information about an OpenCL platform',type='protos']

xml/cl.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ server's OpenCL/api-docs repository.
228228
<type category="define">typedef <type>cl_properties</type> <name>cl_layer_properties</name>;</type>
229229
<type category="define">typedef <type>cl_uint</type> <name>cl_icdl_info</name>;</type>
230230
<type category="define">typedef struct _cl_icd_dispatch <name>cl_icd_dispatch</name>;</type>
231+
<type category="define">typedef <type>cl_properties</type> <name>cl_instance_platform_properties_khr</name>;</type>
231232
<type category="define">typedef <type>cl_bitfield</type> <name>cl_device_scheduling_controls_capabilities_img</name>;</type>
232233
<type category="define">typedef <type>cl_bitfield</type> <name>cl_device_scheduling_controls_capabilities_arm</name>;</type>
233234
<type category="define">typedef <type>cl_bitfield</type> <name>cl_device_controlled_termination_capabilities_arm</name>;</type>
@@ -815,6 +816,7 @@ server's OpenCL/api-docs repository.
815816
<enum value="0" name="CL_MEM_DEVICE_HANDLE_LIST_END_KHR"/>
816817
<enum value="0" name="CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR"/>
817818
<enum value="0" name="CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR"/>
819+
<enum value="0" name="CL_INSTANCE_PLATFORM_PROPERTIES_LIST_END_KHR"/>
818820
</enums>
819821

820822
<enums name="cl_affinity_domain_ext" vendor="IBM" comment="Property names for CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT. This is not a bitfield.">
@@ -2778,6 +2780,16 @@ server's OpenCL/api-docs repository.
27782780
<param><type>cl_platform_id</type> <name>platform</name></param>
27792781
<param><type>void</type>* <name>dispatch_data</name></param>
27802782
</command>
2783+
<command>
2784+
<proto><type>cl_platform_id</type> <name>clIcdCreateInstancePlatformKHR</name></proto>
2785+
<param><type>cl_platform_id</type> <name>platform</name></param>
2786+
<param>const <type>cl_instance_platform_properties_khr</type>* <name>properties</name></param>
2787+
<param><type>cl_int</type>* <name>errcode_ret</name></param>
2788+
</command>
2789+
<command>
2790+
<proto><type>cl_int</type> <name>clIcdDestroyInstancePlatformKHR</name></proto>
2791+
<param><type>cl_platform_id</type> <name>platform</name></param>
2792+
</command>
27812793
<command suffix="CL_API_SUFFIX__VERSION_1_2">
27822794
<proto><type>cl_program</type> <name>clCreateProgramWithILKHR</name></proto>
27832795
<param><type>cl_context</type> <name>context</name></param>
@@ -5925,13 +5937,19 @@ server's OpenCL/api-docs repository.
59255937
<command name="clLogMessagesToStderrAPPLE"/>
59265938
</require>
59275939
</extension>
5928-
<extension name="cl_khr_icd" revision="2.0.1" supported="opencl" ratified="opencl">
5940+
<extension name="cl_khr_icd" revision="2.0.2" supported="opencl" ratified="opencl">
59295941
<require>
59305942
<type name="CL/cl.h"/>
59315943
</require>
5944+
<require>
5945+
<type name="cl_instance_platform_properties_khr"/>
5946+
</require>
59325947
<require comment="cl_platform_info">
59335948
<enum name="CL_PLATFORM_ICD_SUFFIX_KHR"/>
59345949
</require>
5950+
<require comment="cl_instance_platform_properties_khr">
5951+
<enum name="CL_INSTANCE_PLATFORM_PROPERTIES_LIST_END_KHR"/>
5952+
</require>
59355953
<require comment="Error codes">
59365954
<enum name="CL_PLATFORM_NOT_FOUND_KHR"/>
59375955
</require>
@@ -5942,6 +5960,8 @@ server's OpenCL/api-docs repository.
59425960
<command name="clIcdGetPlatformIDsKHR"/>
59435961
<command name="clIcdGetFunctionAddressForPlatformKHR"/>
59445962
<command name="clIcdSetPlatformDispatchDataKHR"/>
5963+
<command name="clIcdCreateInstancePlatformKHR"/>
5964+
<command name="clIcdDestroyInstancePlatformKHR"/>
59455965
</require>
59465966
</extension>
59475967
<extension name="cl_khr_icd_unloadable" revision="1.0.0" supported="opencl">

0 commit comments

Comments
 (0)