diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e8b8e34..8e2329d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,13 +5,13 @@ project (OPENCL_ICD_LOADER) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set (OPENCL_ICD_LOADER_SOURCES icd.c icd_dispatch.c) +set (OPENCL_ICD_LOADER_SOURCES icd.c icd_dispatch.c icd_envvar.c) if (WIN32) - list (APPEND OPENCL_ICD_LOADER_SOURCES icd_windows.c icd_windows_hkr.c OpenCL.def OpenCL.rc) + list (APPEND OPENCL_ICD_LOADER_SOURCES icd_windows.c icd_windows_hkr.c icd_windows_envvar.c OpenCL.def OpenCL.rc) include_directories ($ENV{DXSDK_DIR}/Include) else () - list (APPEND OPENCL_ICD_LOADER_SOURCES icd_linux.c icd_exports.map) + list (APPEND OPENCL_ICD_LOADER_SOURCES icd_linux.c icd_linux_envvar.c icd_exports.map) endif () # Change this to point to a directory containing OpenCL header directory "CL" diff --git a/icd.c b/icd.c index fdeff798..01c90751 100644 --- a/icd.c +++ b/icd.c @@ -45,6 +45,7 @@ KHRicdVendor *khrIcdVendors = NULL; // entrypoint to initialize the ICD and add all vendors void khrIcdInitialize(void) { + khrIcdOsGetOpenCLVisibleDevicesOnce(); // enumerate vendors present on the system khrIcdOsVendorsEnumerateOnce(); } @@ -134,6 +135,10 @@ void khrIcdVendorAdd(const char *libraryName) { continue; } + if (!khrIcdCheckPlatformVisible(libraryName, i)) + { + continue; + } result = platforms[i]->dispatch->clGetPlatformInfo( platforms[i], CL_PLATFORM_ICD_SUFFIX_KHR, @@ -191,6 +196,8 @@ void khrIcdVendorAdd(const char *libraryName) *prevNextPointer = vendor; } + khrIcdVisibilitySetPlatform(libraryName, i, platforms[i]); + KHR_ICD_TRACE("successfully added vendor %s with suffix %s\n", libraryName, suffix); } diff --git a/icd_dispatch.c b/icd_dispatch.c index 5c0c699b..05a568e8 100644 --- a/icd_dispatch.c +++ b/icd_dispatch.c @@ -37,6 +37,7 @@ #include "icd_dispatch.h" #include "icd.h" +#include "icd_envvar.h" #include #include @@ -116,15 +117,83 @@ clGetDeviceIDs(cl_platform_id platform, cl_device_id * devices, cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0 { + cl_uint num_all_devices = 0; + cl_device_id *all_devices = NULL; + cl_uint i; + cl_int result; + // initialize the platforms (in case they have not been already) khrIcdInitialize(); KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); - return platform->dispatch->clGetDeviceIDs( + + if (!num_entries && devices) + { + return CL_INVALID_VALUE; + } + if (!devices && !num_devices) + { + return CL_INVALID_VALUE; + } + + if (num_devices) + { + *num_devices = 0; + } + for (i = 0; i < num_entries && devices; ++i) + { + devices[i] = NULL; + } + + result = platform->dispatch->clGetDeviceIDs( platform, - device_type, - num_entries, - devices, - num_devices); + device_type, + 0, + NULL, + &num_all_devices); + if (CL_SUCCESS != result) + { + return result; + } + if (!num_all_devices) + { + return CL_DEVICE_NOT_FOUND; + } + all_devices = (cl_device_id*)malloc(sizeof(cl_device_id) * num_all_devices); + if (!all_devices) + { + return CL_OUT_OF_HOST_MEMORY; + } + result = platform->dispatch->clGetDeviceIDs( + platform, + device_type, + num_all_devices, + all_devices, + NULL); + if (CL_SUCCESS != result) + { + free(all_devices); + return result; + } + + result = CL_DEVICE_NOT_FOUND; + for (i = 0; i < num_all_devices; ++i) + { + if (khrIcdCheckDeviceVisible(platform, all_devices[i])) + { + result = CL_SUCCESS; + if (num_entries && devices) + { + *(devices++) = all_devices[i]; + --num_entries; + } + if (num_devices) + { + ++(*num_devices); + } + } + } + free(all_devices); + return result; } CL_API_ENTRY cl_int CL_API_CALL @@ -211,6 +280,10 @@ clCreateContextFromType(const cl_context_properties * properties, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_platform_id platform = NULL; + cl_uint num_devices = 0; + cl_device_id *devices = NULL; + cl_context context = NULL; + cl_int result; // initialize the platforms (in case they have not been already) khrIcdInitialize(); @@ -220,12 +293,53 @@ clCreateContextFromType(const cl_context_properties * properties, // validate the platform handle and dispatch KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(platform, CL_INVALID_PLATFORM); - return platform->dispatch->clCreateContextFromType( + + result = clGetDeviceIDs(platform, device_type, 0, NULL, &num_devices); + if (CL_SUCCESS != result) + { + if (*errcode_ret) + { + *errcode_ret = result; + } + return NULL; + } + if (!num_devices) + { + if (*errcode_ret) + { + *errcode_ret = CL_DEVICE_NOT_FOUND; + } + return NULL; + } + devices = (cl_device_id*)malloc(sizeof(cl_device_id) * num_devices); + if (!devices) + { + if (*errcode_ret) + { + *errcode_ret = CL_OUT_OF_HOST_MEMORY; + } + return NULL; + } + result = clGetDeviceIDs(platform, device_type, num_devices, devices, NULL); + if (CL_SUCCESS != result) + { + free(devices); + if (*errcode_ret) + { + *errcode_ret = result; + } + return NULL; + } + + context = platform->dispatch->clCreateContext( properties, - device_type, + num_devices, + devices, pfn_notify, user_data, errcode_ret); + free(devices); + return context; } CL_API_ENTRY cl_int CL_API_CALL diff --git a/icd_envvar.c b/icd_envvar.c new file mode 100644 index 00000000..7135b0b2 --- /dev/null +++ b/icd_envvar.c @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2018 ManyCoreSoft Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software source and associated documentation files (the "Materials"), + * to deal in the Materials without restriction, including without limitation + * the rights to use, copy, modify, compile, merge, publish, distribute, + * sublicense, and/or sell copies of the Materials, and to permit persons to + * whom the Materials are furnished to do so, subject the following terms and + * conditions: + * + * All modifications to the Materials used to create a binary that is + * distributed to third parties shall be provided to Khronos with an + * unrestricted license to use for the purposes of implementing bug fixes and + * enhancements to the Materials; + * + * If the binary is used as part of an OpenCL(TM) implementation, whether binary + * is distributed together with or separately to that implementation, then + * recipient must become an OpenCL Adopter and follow the published OpenCL + * conformance process for that implementation, details at: + * http://www.khronos.org/conformance/; + * + * The above copyright notice, the OpenCL trademark license, and this permission + * notice shall be included in all copies or substantial portions of the + * Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN + * THE MATERIALS. + * + * OpenCL is a trademark of Apple Inc. used under license by Khronos. + */ + +#include "icd.h" +#include "icd_envvar.h" +#include "icd_dispatch.h" +#include +#include +#include + +static KHRVisibility *khrVisibilities = NULL; + +void khrIcdVisibilityAdd(char *library, unsigned platformIndex, cl_device_type deviceType, unsigned numVisibleDevices, unsigned *deviceIndices) +{ + KHRVisibility *visibility = NULL; + + visibility = (KHRVisibility*)malloc(sizeof(*visibility)); + if (!visibility) + { + KHR_ICD_TRACE("Failed to allocate memory\n"); + return; + } + memset(visibility, 0, sizeof(*visibility)); + + visibility->library = library; + visibility->platformIndex = platformIndex; + visibility->deviceType = deviceType; + visibility->numVisibleDevices = numVisibleDevices; + visibility->deviceIndices = deviceIndices; + + if (numVisibleDevices > 0) + { + visibility->deviceIDs = (cl_device_id*)malloc(sizeof(cl_device_id) * numVisibleDevices); + if (!visibility->deviceIDs) + { + KHR_ICD_TRACE("Failed to allocate memory\n"); + free(visibility); + return; + } + memset(visibility->deviceIDs, 0, sizeof(cl_device_id) * numVisibleDevices); + } + + // add this entry at the tail of the list + { + KHRVisibility **prevNextPointer = NULL; + for (prevNextPointer = &khrVisibilities; *prevNextPointer; prevNextPointer = &((*prevNextPointer)->next)); + *prevNextPointer = visibility; + } +} + +void khrIcdVisibilityReplaceLibraryName(const char *oldName, const char *newName) +{ + KHRVisibility *iterator; + for (iterator = khrVisibilities; iterator; iterator = iterator->next) + { + if (strcmp(iterator->library, oldName) == 0) + { + char *oldBuffer = iterator->library; + char *buffer = (char*)malloc(strlen(newName) + 1); + if (!buffer) + { + KHR_ICD_TRACE("Failed to allocate memory\n"); + continue; + } + strcpy(buffer, newName); + + iterator->library = buffer; + free(oldBuffer); + } + } +} + +void khrIcdVisibilitySetPlatform(char *libraryFile, unsigned index, cl_platform_id platform) +{ + KHRVisibility *iterator; + for (iterator = khrVisibilities; iterator; iterator = iterator->next) + { + if (khrIcdOsLibraryFileMatch(iterator->library, libraryFile) && + iterator->platformIndex == index && + iterator->platformID == NULL) + { + cl_uint numDevices = 0; + cl_device_id *devices = NULL; + cl_int result; + unsigned i; + + iterator->platformID = platform; + if (iterator->numVisibleDevices == 0) + { + continue; + } + + result = platform->dispatch->clGetDeviceIDs(platform, iterator->deviceType, 0, NULL, &numDevices); + if (CL_SUCCESS != result) + { + continue; + } + + devices = (cl_device_id*)malloc(sizeof(cl_device_id) * numDevices); + if (!devices) + { + continue; + } + result = platform->dispatch->clGetDeviceIDs(platform, iterator->deviceType, numDevices, devices, NULL); + if (CL_SUCCESS != result) + { + free(devices); + continue; + } + + for (i = 0; i < iterator->numVisibleDevices; ++i) + { + if (iterator->deviceIndices[i] < numDevices) + { + iterator->deviceIDs[i] = devices[iterator->deviceIndices[i]]; + } + else + { + iterator->deviceIDs[i] = NULL; + } + } + } + } +} + +int khrIcdCheckLibraryVisible(const char *libraryFile) +{ + KHRVisibility *iterator; + if (!khrVisibilities) return 1; + for (iterator = khrVisibilities; iterator; iterator = iterator->next) + { + if (khrIcdOsLibraryFileMatch(iterator->library, libraryFile)) + { + return 1; + } + } + return 0; +} + +int khrIcdCheckPlatformVisible(const char *libraryFile, unsigned index) +{ + KHRVisibility *iterator; + if (!khrVisibilities) return 1; + for (iterator = khrVisibilities; iterator; iterator = iterator->next) + { + if (khrIcdOsLibraryFileMatch(iterator->library, libraryFile) && + iterator->platformIndex == index) + { + return 1; + } + } + return 0; +} + +int khrIcdCheckDeviceVisible(cl_platform_id platform, cl_device_id device) +{ + KHRVisibility *iterator; + unsigned i; + if (!khrVisibilities) return 1; + for (iterator = khrVisibilities; iterator; iterator = iterator->next) + { + if (iterator->platformID == platform) + { + if (iterator->numVisibleDevices == 0) + { + return 1; + } + for (i = 0; i < iterator->numVisibleDevices; ++i) + { + if (iterator->deviceIDs[i] == device) + { + return 1; + } + } + } + } + return 0; +} + diff --git a/icd_envvar.h b/icd_envvar.h new file mode 100644 index 00000000..dc425638 --- /dev/null +++ b/icd_envvar.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2018 ManyCoreSoft Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software source and associated documentation files (the "Materials"), + * to deal in the Materials without restriction, including without limitation + * the rights to use, copy, modify, compile, merge, publish, distribute, + * sublicense, and/or sell copies of the Materials, and to permit persons to + * whom the Materials are furnished to do so, subject the following terms and + * conditions: + * + * All modifications to the Materials used to create a binary that is + * distributed to third parties shall be provided to Khronos with an + * unrestricted license to use for the purposes of implementing bug fixes and + * enhancements to the Materials; + * + * If the binary is used as part of an OpenCL(TM) implementation, whether binary + * is distributed together with or separately to that implementation, then + * recipient must become an OpenCL Adopter and follow the published OpenCL + * conformance process for that implementation, details at: + * http://www.khronos.org/conformance/; + * + * The above copyright notice, the OpenCL trademark license, and this permission + * notice shall be included in all copies or substantial portions of the + * Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN + * THE MATERIALS. + * + * OpenCL is a trademark of Apple Inc. used under license by Khronos. + */ + +#ifndef _ICD_ENVVAR_H_ +#define _ICD_ENVVAR_H_ + +#include + +typedef struct KHRVisibilityRec KHRVisibility; + +struct KHRVisibilityRec +{ + char *library; + unsigned platformIndex; + cl_device_type deviceType; + unsigned numVisibleDevices; + unsigned *deviceIndices; + + cl_platform_id platformID; + cl_device_id *deviceIDs; + + KHRVisibility *next; +}; + +void khrIcdOsGetOpenCLVisibleDevicesOnce(void); +int khrIcdOsLibraryFileMatch(const char *name, const char *fileName); + +void khrIcdVisibilityAdd(char *library, unsigned platformIndex, cl_device_type deviceType, unsigned numVisibleDevices, unsigned *deviceIndices); +void khrIcdVisibilityReplaceLibraryName(const char *oldName, const char *newName); +void khrIcdVisibilitySetPlatform(char *libraryFile, unsigned index, cl_platform_id platform); + +int khrIcdCheckLibraryVisible(const char *libraryFile); +int khrIcdCheckPlatformVisible(const char *libraryFile, unsigned index); +int khrIcdCheckDeviceVisible(cl_platform_id platform, cl_device_id device); + +#endif + diff --git a/icd_linux.c b/icd_linux.c index ddf5bfe0..2713342f 100644 --- a/icd_linux.c +++ b/icd_linux.c @@ -36,6 +36,7 @@ */ #include "icd.h" +#include "icd_envvar.h" #include #include #include @@ -134,8 +135,14 @@ void khrIcdOsVendorsEnumerate(void) // ignore a newline at the end of the file if (buffer[bufferSize-1] == '\n') buffer[bufferSize-1] = '\0'; + khrIcdVisibilityReplaceLibraryName(dirEntry->d_name, buffer); + khrIcdVisibilityReplaceLibraryName(fileName, buffer); + // load the string read from the file - khrIcdVendorAdd(buffer); + if (khrIcdCheckLibraryVisible(buffer)) + { + khrIcdVendorAdd(buffer); + } free(fileName); free(buffer); diff --git a/icd_linux_envvar.c b/icd_linux_envvar.c new file mode 100644 index 00000000..53ae85df --- /dev/null +++ b/icd_linux_envvar.c @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2018 ManyCoreSoft Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software source and associated documentation files (the "Materials"), + * to deal in the Materials without restriction, including without limitation + * the rights to use, copy, modify, compile, merge, publish, distribute, + * sublicense, and/or sell copies of the Materials, and to permit persons to + * whom the Materials are furnished to do so, subject the following terms and + * conditions: + * + * All modifications to the Materials used to create a binary that is + * distributed to third parties shall be provided to Khronos with an + * unrestricted license to use for the purposes of implementing bug fixes and + * enhancements to the Materials; + * + * If the binary is used as part of an OpenCL(TM) implementation, whether binary + * is distributed together with or separately to that implementation, then + * recipient must become an OpenCL Adopter and follow the published OpenCL + * conformance process for that implementation, details at: + * http://www.khronos.org/conformance/; + * + * The above copyright notice, the OpenCL trademark license, and this permission + * notice shall be included in all copies or substantial portions of the + * Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN + * THE MATERIALS. + * + * OpenCL is a trademark of Apple Inc. used under license by Khronos. + */ + +#include "icd.h" +#include "icd_envvar.h" +#include +#include +#include + +static pthread_once_t initialized = PTHREAD_ONCE_INIT; + +static const char *ParseIntegerList(const char *str, unsigned *numValuesRet, unsigned *valuesRet) +{ + unsigned numValues = 0; + unsigned value; + const char *p = str; + + numValues = 0; + p = str; + while ((*p >= '0' && *p <= '9') || *p == ',') + { + if (*p >= '0' && *p <= '9') + { + value = 0; + for ( ; *p >= '0' && *p <= '9'; ++p) + { + value = value * 10 + (*p - '0'); + } + if (valuesRet) valuesRet[numValues] = value; + numValues++; + } + else + { + ++p; + } + } + if (numValuesRet) + { + *numValuesRet = numValues; + } + return p; +} + +static const char *ParseVisibilityEntry(const char *str) +{ + // e.g., foo.so:0:gpu:0,2 + // foo.so:1:cpu:0 + // foo.so:0:any:4,5 + // foo.so:0:gpu (use all gpu devices in the platform) + // foo.so:0 (use all devices in the platform) + size_t libraryLength = 0; + char *library = NULL; + unsigned platformIndex = 0; + cl_device_type deviceType = CL_DEVICE_TYPE_ALL; + unsigned numVisibleDevices = 0; + unsigned *deviceIndices = NULL; + const char *p = str; + + if (str == NULL || *str == '\0') + { + return NULL; + } + + while (*p != '\0' && *p != ':') ++p; + libraryLength = p - str; + library = (char*)malloc(libraryLength + 1); + if (!library) + { + KHR_ICD_TRACE("Failed to allocate memory\n"); + goto Cleanup; + } + strncpy(library, str, libraryLength); + library[libraryLength] = '\0'; + + if (*p != ':') + { + KHR_ICD_TRACE("Failed to parse OPENCL_VISIBLE_DEVICES\n"); + goto Cleanup; + } + ++p; + + do + { + if (*p >= '0' && *p <= '9') + { + platformIndex = platformIndex * 10 + (*p - '0'); + } + else + { + KHR_ICD_TRACE("Failed to parse OPENCL_VISIBLE_DEVICES\n"); + goto Cleanup; + } + ++p; + } + while (*p != '\0' && *p != ':'); + + if (*p != ':' || *(p + 1) == ':') goto Done; + ++p; + + if (strncmp(p, "gpu", 3) == 0) + { + deviceType = CL_DEVICE_TYPE_GPU; + p += 3; + } + else if (strncmp(p, "cpu", 3) == 0) + { + deviceType = CL_DEVICE_TYPE_CPU; + p += 3; + } + else if (strncmp(p, "accelerator", 11) == 0) + { + deviceType = CL_DEVICE_TYPE_ACCELERATOR; + p += 11; + } + else if (strncmp(p, "custom", 6) == 0) + { + deviceType = CL_DEVICE_TYPE_CUSTOM; + p += 6; + } + else if (strncmp(p, "any", 3) == 0) + { + deviceType = CL_DEVICE_TYPE_ALL; + p += 3; + } + else + { + KHR_ICD_TRACE("Failed to parse OPENCL_VISIBLE_DEVICES\n"); + goto Cleanup; + } + + if (*p != ':' || *(p + 1) == ':') goto Done; + ++p; + + ParseIntegerList(p, &numVisibleDevices, NULL); + if (numVisibleDevices > 0) + { + deviceIndices = (unsigned*)malloc(sizeof(unsigned) * numVisibleDevices); + if (!deviceIndices) + { + KHR_ICD_TRACE("Failed to allocate memory\n"); + goto Cleanup; + } + } + p = ParseIntegerList(p, NULL, deviceIndices); + +Done: + khrIcdVisibilityAdd(library, platformIndex, deviceType, numVisibleDevices, deviceIndices); + return p; + +Cleanup: + if (library) free(library); + if (deviceIndices) free(deviceIndices); + return NULL; +} + +static void khrIcdOsGetOpenCLVisibleDevices(void) +{ + const char *env = getenv("OPENCL_VISIBLE_DEVICES"); + if (env == NULL || *env == '\0') + { + return; + } + + while (*env != '\0') + { + if (*env == ':' && *(env + 1) == ':') + { + env += 2; + continue; + } + + env = ParseVisibilityEntry(env); + if (!env) break; + + if (*env == '\0' || (*env == ':' && *(env + 1) == ':')) + { + // Do nothing + } + else + { + KHR_ICD_TRACE("Failed to parse OPENCL_VISIBLE_DEVICES\n"); + break; + } + } +} + +void khrIcdOsGetOpenCLVisibleDevicesOnce(void) +{ + pthread_once(&initialized, khrIcdOsGetOpenCLVisibleDevices); +} + +int khrIcdOsLibraryFileMatch(const char *name, const char *fileName) +{ + size_t nameLength = 0; + size_t fileNameLength = 0; + + if (!name || !fileName) return 0; + + nameLength = strlen(name); + fileNameLength = strlen(fileName); + + if (nameLength == fileNameLength) + { + return strcmp(name, fileName) == 0; + } + else if (nameLength < fileNameLength) + { + return fileName[fileNameLength - nameLength - 1] == '/' && + strcmp(name, fileName + (fileNameLength - nameLength)) == 0; + } + return 0; +} + diff --git a/icd_windows_envvar.c b/icd_windows_envvar.c new file mode 100644 index 00000000..6fc63045 --- /dev/null +++ b/icd_windows_envvar.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2018 ManyCoreSoft Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software source and associated documentation files (the "Materials"), + * to deal in the Materials without restriction, including without limitation + * the rights to use, copy, modify, compile, merge, publish, distribute, + * sublicense, and/or sell copies of the Materials, and to permit persons to + * whom the Materials are furnished to do so, subject the following terms and + * conditions: + * + * All modifications to the Materials used to create a binary that is + * distributed to third parties shall be provided to Khronos with an + * unrestricted license to use for the purposes of implementing bug fixes and + * enhancements to the Materials; + * + * If the binary is used as part of an OpenCL(TM) implementation, whether binary + * is distributed together with or separately to that implementation, then + * recipient must become an OpenCL Adopter and follow the published OpenCL + * conformance process for that implementation, details at: + * http://www.khronos.org/conformance/; + * + * The above copyright notice, the OpenCL trademark license, and this permission + * notice shall be included in all copies or substantial portions of the + * Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN + * THE MATERIALS. + * + * OpenCL is a trademark of Apple Inc. used under license by Khronos. + */ + +#include "icd.h" +#include "icd_envvar.h" + +// not implemented yet + +void khrIcdOsGetOpenCLVisibleDevicesOnce(void) +{ +} + +int khrIcdOsLibraryFileMatch(const char *name, const char *fileName) +{ + return 1; +} +