Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new version of layer API for deinitialization. #962

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions ext/cl_loader_layers.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interception layers (Layer ICDs) for OpenCL.
[cols="1,1,3",options="header",]
|====
| *Date* | *Version* | *Description*
| 2023-08-23 | 1.1.0 | Deinitialization
| 2020-11-04 | 1.0.0 | First assigned version.
|====

Expand All @@ -30,9 +31,10 @@ Brice Videau, Argonne National Laboratory
[[cl_loader_layers-new-procedures-and-functions]]
=== New Procedures and Functions

A layer needs to implement and expose those two new entry points in
a shared library. If one or both of those are missing, the loader will
discard the layer.
A layer needs to implement and expose *clGetLayerInfo* and *clInitLayer*
in a shared library. If one or both of those are missing, the loader will
discard the layer. From version 1.1.0 of the API the layer must also implement
and expose *clDeinitLayer*.

[source,opencl]
----
Expand All @@ -45,6 +47,8 @@ cl_int clInitLayer(cl_uint num_entries,
const cl_icd_dispatch *target_dispatch,
cl_uint *num_entries_ret,
const cl_icd_dispatch **layer_dispatch_ret);

cl_int clDeinitLayer(void);
----

[[cl_loader_layers-new-api-types]]
Expand Down Expand Up @@ -72,12 +76,13 @@ Accepted as _param_name_ to the function *clGetLayerInfo*:
=== New API Tokens

Returned by *clGetLayerInfo* when supplied *CL_LAYER_API_VERSION*
and the corresponding layer implements version 1.0.0 of the layer
API:
and the corresponding layer implements version 1.0.0 or 1.1.0 of
the layer API respectively:

[source,opencl]
----
#define CL_LAYER_API_VERSION_100 100
#define CL_LAYER_API_VERSION_110 110
----

[[cl_loader_layers-new-environment-variables]]
Expand Down Expand Up @@ -173,6 +178,24 @@ Otherwise, it returns one of the following errors.
_target_dispatch_ is a `NULL` value, or _num_entries_ret_ is a `NULL`
value, or _layer_dispatch_ret_ is a `NULL` value.

==== Layer Deinitialization

[open,refpage='clDenitLayer',desc='Deinitialize an OpenCL layer',type='protos']
Deinitialization of a Layer, which should allow subsequent reinitialization
through *clInitLayer*, can be achieved with the function:
[source,opencl]

----
cl_int clDeinitLayer(void);
----

[NOTE]
====
*clDeinitLayer* is new in API version 1.1.0
====

*clDeinitLayer* returns *CL_SUCCESS* if the function is executed successfully.

[[cl_loader_layers-source-code]]
=== Source Code

Expand Down
6 changes: 6 additions & 0 deletions xml/cl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ server's OpenCL/api-docs repository.

<enums name="Constants.cl_loader_layers" vendor="Khronos" comment="Defined Layer API version, in cl_layer.h">
<enum value="100" name="CL_LAYER_API_VERSION_100"/>
<enum value="110" name="CL_LAYER_API_VERSION_110"/>
</enums>

<enums start="0" end="-999" name="ErrorCodes.0" vendor="Khronos" comment="Error codes start at 0 and decrease">
Expand Down Expand Up @@ -4171,6 +4172,9 @@ server's OpenCL/api-docs repository.
<param><type>cl_uint</type>* <name>num_entries_ret</name></param>
<param>const <type>cl_icd_dispatch</type>** <name>layer_dispatch_ret</name></param>
</command>
<command>
<proto><type>cl_int</type> <name>clDeinitLayer</name></proto>
</command>
<command>
<proto><type>cl_int</type> <name>clGetICDLoaderInfoOCLICD</name></proto>
<param><type>cl_icdl_info</type> <name>param_name</name></param>
Expand Down Expand Up @@ -5558,10 +5562,12 @@ server's OpenCL/api-docs repository.
</require>
<require comment="Misc API enums">
<enum name="CL_LAYER_API_VERSION_100"/>
<enum name="CL_LAYER_API_VERSION_110"/>
</require>
<require>
<command name="clGetLayerInfo"/>
<command name="clInitLayer"/>
<command name="clDeinitLayer"/>
</require>
</extension>
<extension name="cl_loader_info" supported="opencl">
Expand Down