-
Notifications
You must be signed in to change notification settings - Fork 165
Added an OpenCL deinitialization test and plugin infrastructure. #268
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
480a9ec
Added an OpenCL plugin test.
Kerilk 4aa09a8
Update loader/windows/icd_windows_formats.h
Kerilk 5e5d3d9
Update loader/linux/icd_linux_library.c
Kerilk 93421d3
Move plugin test program to test directory.
Kerilk 2ab3b32
Add missing copyright headers.
Kerilk 85769b2
Add missing include guards.
Kerilk 2dd4bf6
Add comment to plugin test explaining workflow and code structure.
Kerilk 3a7e20f
Remove extraneous blank lines.
Kerilk a465b8d
Move cl_plugin_loader_test to test directory by using relative path.
Kerilk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Copyright (c) 2026 The Khronos Group Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * OpenCL is a trademark of Apple Inc. used under license by Khronos. | ||
| */ | ||
|
|
||
| #ifndef _ICD_LIBRARY_H_ | ||
| #define _ICD_LIBRARY_H_ | ||
|
|
||
| // dynamically load a library. returns NULL on failure | ||
| // n.b, this call is OS-specific | ||
| void *khrIcdOsLibraryLoad(const char *libraryName); | ||
|
|
||
| // get a function pointer from a loaded library. returns NULL on failure. | ||
| // n.b, this call is OS-specific | ||
| void *khrIcdOsLibraryGetFunctionAddress(void *library, const char *functionName); | ||
|
|
||
| // unload a library. | ||
| // n.b, this call is OS-specific | ||
| void khrIcdOsLibraryUnload(void *library); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /* | ||
| * Copyright (c) 2026 The Khronos Group Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * OpenCL is a trademark of Apple Inc. used under license by Khronos. | ||
| */ | ||
| #include "icd_trace.h" | ||
|
|
||
| int khrEnableTrace = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright (c) 2026 The Khronos Group Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * OpenCL is a trademark of Apple Inc. used under license by Khronos. | ||
| */ | ||
|
|
||
| #ifndef _ICD_TRACE_H_ | ||
| #define _ICD_TRACE_H_ | ||
|
|
||
| #include <stdio.h> | ||
|
|
||
| extern int khrEnableTrace; | ||
|
|
||
| // internal tracing macros | ||
| #define KHR_ICD_TRACE(...) \ | ||
| do \ | ||
| { \ | ||
| if (khrEnableTrace) \ | ||
| { \ | ||
| fprintf(stderr, "KHR ICD trace at %s:%d: ", __FILE__, __LINE__); \ | ||
| fprintf(stderr, __VA_ARGS__); \ | ||
| } \ | ||
| } while (0) | ||
|
|
||
| #ifdef _WIN32 | ||
| #define KHR_ICD_WIDE_TRACE(...) \ | ||
| do \ | ||
| { \ | ||
| if (khrEnableTrace) \ | ||
| { \ | ||
| fwprintf(stderr, L"KHR ICD trace at %hs:%d: ", __FILE__, __LINE__); \ | ||
| fwprintf(stderr, __VA_ARGS__); \ | ||
| } \ | ||
| } while (0) | ||
|
|
||
| #else | ||
| #define KHR_ICD_WIDE_TRACE(...) | ||
| #endif | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright (c) 2026 The Khronos Group Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * OpenCL is a trademark of Apple Inc. used under license by Khronos. | ||
| */ | ||
|
|
||
| #include "icd_trace.h" | ||
| #include "icd_library.h" | ||
| #include <dlfcn.h> | ||
| #include <stddef.h> | ||
|
|
||
| /* | ||
| * | ||
| * Dynamic library loading functions | ||
| * | ||
| */ | ||
|
|
||
| // dynamically load a library. returns NULL on failure | ||
| void *khrIcdOsLibraryLoad(const char *libraryName) | ||
| { | ||
| void* ret = dlopen(libraryName, RTLD_NOW); | ||
| if (NULL == ret) | ||
| { | ||
| KHR_ICD_TRACE("Failed to load driver because %s.\n", dlerror()); | ||
| } | ||
| return ret; | ||
| } | ||
|
|
||
| // get a function pointer from a loaded library. returns NULL on failure. | ||
| void *khrIcdOsLibraryGetFunctionAddress(void *library, const char *functionName) | ||
| { | ||
| return dlsym(library, functionName); | ||
| } | ||
|
|
||
| // unload a library | ||
| void khrIcdOsLibraryUnload(void *library) | ||
| { | ||
| dlclose(library); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.