From 13fd7046c5a4c32c6b548aca0ef8823325f1a5b1 Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Wed, 23 Aug 2023 13:32:02 -0500 Subject: [PATCH 1/2] Add new version of layer API for deinitialization. --- ext/cl_loader_layers.asciidoc | 33 ++++++++++++++++++++++++++++----- xml/cl.xml | 6 ++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/ext/cl_loader_layers.asciidoc b/ext/cl_loader_layers.asciidoc index 405cde40..9597dcbb 100644 --- a/ext/cl_loader_layers.asciidoc +++ b/ext/cl_loader_layers.asciidoc @@ -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. |==== @@ -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 *clGetLayerInfo* +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] ---- @@ -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]] @@ -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]] @@ -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 diff --git a/xml/cl.xml b/xml/cl.xml index ad77aaaa..c3a0a771 100644 --- a/xml/cl.xml +++ b/xml/cl.xml @@ -504,6 +504,7 @@ server's OpenCL/api-docs repository. + @@ -4171,6 +4172,9 @@ server's OpenCL/api-docs repository. cl_uint* num_entries_ret const cl_icd_dispatch** layer_dispatch_ret + + cl_int clDeinitLayer + cl_int clGetICDLoaderInfoOCLICD cl_icdl_info param_name @@ -5558,10 +5562,12 @@ server's OpenCL/api-docs repository. + + From b0b2157d967fdbb449b58b6e7ea6cfc3bb3effb7 Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Wed, 23 Aug 2023 13:57:12 -0500 Subject: [PATCH 2/2] Update ext/cl_loader_layers.asciidoc Co-authored-by: Sun Serega --- ext/cl_loader_layers.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/cl_loader_layers.asciidoc b/ext/cl_loader_layers.asciidoc index 9597dcbb..36921667 100644 --- a/ext/cl_loader_layers.asciidoc +++ b/ext/cl_loader_layers.asciidoc @@ -31,7 +31,7 @@ Brice Videau, Argonne National Laboratory [[cl_loader_layers-new-procedures-and-functions]] === New Procedures and Functions -A layer needs to implement and expose *clGetLayerInfo* and *clGetLayerInfo* +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*.