Skip to content
Merged
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
5 changes: 4 additions & 1 deletion cllayerinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void unmute(void) {
void print_layer_info(const struct layer_icd *layer)
{
cl_layer_api_version api_version = 0;
clGetLayerInfo_fn layer_info_fn_ptr = (clGetLayerInfo_fn)layer->layer_info_fn_ptr;
clGetLayerInfo_fn layer_info_fn_ptr = layer->layer_info_fn_ptr;
cl_int error = CL_SUCCESS;
size_t sz;

Expand Down Expand Up @@ -87,5 +87,8 @@ int main (int argc, char *argv[])
print_layer_info(layer);
layer = layer->next_layer;
}
mute();
_deinitClIcd_no_inline();
unmute();
return 0;
}
9 changes: 9 additions & 0 deletions doc/libOpenCL.7.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ Number of the platform to choose as default platform. Note that using this
environment variable without ensuring the use of a sort algorithm for platforms
is not really useful.

*OCL_ICD_FORCE_LEGACY_TERMINATION*::
Prevent the new deinitializaiton scheme to take place. Allows loading legacy
layers that do not export clInitLayerWithProperties. Accepts *True*,
*true*, *T*, or *1*.

*OCL_ICD_DISABLE_DYNAMIC_LIBRARY_UNLOADING*::
Prevent dynamic libraries from being unloaded once sucessfully loaded. For
debuging purposes. Accepts *True*, *true*, *T*, or *1*.

*OCL_ICD_DEBUG*::
+
--
Expand Down
40 changes: 40 additions & 0 deletions icd_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,30 @@ def self.generate_icd_layer_source
return CL_SUCCESS;
}

CL_API_ENTRY cl_int CL_API_CALL
clInitLayerWithProperties(
cl_uint num_entries,
const struct _cl_icd_dispatch *target_dispatch,
cl_uint *num_entries_out,
const struct _cl_icd_dispatch **layer_dispatch,
cl_properties *properties) {
(void)properties;
if (!target_dispatch || !layer_dispatch ||!num_entries_out || num_entries < sizeof(dispatch)/sizeof(dispatch.clGetPlatformIDs))
return -1;

_init_dispatch();

tdispatch = target_dispatch;
*layer_dispatch = &dispatch;
*num_entries_out = sizeof(dispatch)/sizeof(dispatch.clGetPlatformIDs);
return CL_SUCCESS;
}

CL_API_ENTRY cl_int CL_API_CALL
clDeinitLayer(void) {
tdispatch = NULL;
return CL_SUCCESS;
}
EOF

$api_entries.each { |func_name, entry|
Expand Down Expand Up @@ -543,6 +567,7 @@ def self.generate_ocl_icd_loader_header
};

extern struct _cl_icd_dispatch master_dispatch;
extern struct _cl_icd_dispatch deinit_dispatch;
EOF
$cl_objects.each { |o|
ocl_icd_header += <<EOF
Expand Down Expand Up @@ -881,6 +906,21 @@ def self.generate_ocl_icd_loader_gen_source
end
ocl_icd_loader_gen_source << "};\n"

ocl_icd_loader_gen_source << "struct _cl_icd_dispatch deinit_dispatch = {\n"
($api_entries.length+$buff-1).times { |i|
if( $known_entries[i] ) then
ocl_icd_loader_gen_source << " #{$known_entries[i]}_unsupp,\n"
else
ocl_icd_loader_gen_source << " (void *) NULL,\n"
end
}
if( $known_entries[$api_entries.length+$buff-1] ) then
ocl_icd_loader_gen_source << " #{$known_entries[$api_entries.length+$buff-1]}\n"
else
ocl_icd_loader_gen_source << " (void *) NULL\n"
end
ocl_icd_loader_gen_source << "};\n"

ocl_icd_loader_gen_source << <<EOF

#ifdef DEBUG_OCL_ICD
Expand Down
7 changes: 6 additions & 1 deletion libdummy_icd.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ CL_API_ENTRY cl_int CL_API_CALL INTclGetPlatformInfo(
#ifdef ICD_WITHOUT_EXTENSION
"private_ext"
#else
"cl_khr_icd"
"cl_khr_icd cl_khr_icd_unloadable"
#endif
;
char cl_platform_icd_suffix_khr[] = "LIG";
cl_bool cl_platform_unloadable = CL_TRUE;
size_t size_string;
char * string_p;
if( platform != NULL ) {
Expand Down Expand Up @@ -212,6 +213,10 @@ CL_API_ENTRY cl_int CL_API_CALL INTclGetPlatformInfo(
string_p = cl_platform_icd_suffix_khr;
size_string = sizeof(cl_platform_icd_suffix_khr);
break;
case CL_PLATFORM_UNLOADABLE_KHR:
string_p = (char *)&cl_platform_unloadable;
size_string = sizeof(cl_platform_unloadable);
break;
default:
return CL_INVALID_VALUE;
break;
Expand Down
3 changes: 3 additions & 0 deletions libdummy_icd.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <CL/opencl.h>

#if !defined(CL_PLATFORM_UNLOADABLE_KHR)
#define CL_PLATFORM_UNLOADABLE_KHR 0x0921
#endif

Loading
Loading