-
Notifications
You must be signed in to change notification settings - Fork 164
OpenCL ICD Loader Deinitialization Support #250
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
base: main
Are you sure you want to change the base?
Conversation
cbf101d to
a57a3c2
Compare
|
Will rebase. |
a57a3c2 to
7244a73
Compare
bashbaug
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for continuing to work on this!
A few other high-level comments:
- We'll eventually need to update the XML file with these changes, especially the new
CL_PLATFORM_UNLOADABLE_KHRenum. Organizationally, would we consider this an update tocl_khr_icd? - We should rev the loader version as part of these changes, see:
OPENCL_ICD_LOADER_VERSION_REV.
Thanks for reviewing this! |
b0e6661 to
c920622
Compare
bashbaug
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think this looks really great! I'll pull this into my source tree and give it a test drive to see if there are any issues.
There are only two remaining TODOs I'd like to see before merging:
- Document the new environment variable in the README.
- Bump the project version.
If we bump the project version in (2), can layers use this to figure out whether they can safely return version 200? I was considering updating my layers to version 200, but if I do this unconditionally it means that older ICD loaders will refuse to load them.
That is one of the things I wanted to brainstorm about. There are ways we could keep all layers version 100 of the API, use a new property that would advertise if the layer can be unloaded. We could then use a new initialization function (InitWithProperties maybe to address future problem like this one). If the layer is initialized with the old function, it would need to do cleanup (if required) in an at_exit callback, otherwise, the loader supports de-initialization of the layer, and will call the appropriate function if found. That is quite different from the current proposal, but could be a better, more future proof approach. |
c920622 to
b37c49f
Compare
Change corresponds to KhronosGroup/OpenCL-ICD-Loader#250 Related-To: GSD-11701 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
15dc682 to
570c597
Compare
|
Brief discussion summary:
|
570c597 to
a13e990
Compare
|
I have implemented the above plan. A couple of notes:
The new environment variables ( |
bashbaug
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder: Still need to bump the project version and document the new environment variables.
loader/icd.c
Outdated
|
|
||
| static void khrIcdInitializeLegacyTermination(void) | ||
| { | ||
| char *forceLegacyTermination = khrIcd_getenv("OCL_ICD_FORCE_LEGACY_TERMINATION"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case it helps other revewers, or to prompt other naming suggestions, I believe this option:
- Initializes layers using the older
clInitLayerinstead of the newerclInitLayerWithProperties. This means that older layers are supported that do not exportclInitLayerWithProperties. - Skips all forms of layer and ICD de-initialization. This includes:
- Calling
clDeinitLayer. Layers will receive no notification from the ICD loader during deinitialization. - Closing layer library handles. Layer library handles will never be closed and will therefore "leak".
- Freeing ICD loader memory for layers. This memory will also "leak". We might want to clean this up regardless, but for the full legacy termination experience, we should leak this memory also.
- Closing ICD library handles. ICD library handles will also never be closed and will therefore "leak".
- Freeing ICD loader memory for ICDs, so this memory will also "leak".
- Calling
We could try squeezing in something about legacy layers for (1), but the name is already pretty long, so I don't think it's necessary.
22e8624 to
c494c1d
Compare
|
Added documentation or the environment variables, as well as bumped the version number. |
6858c9a to
a2b62c5
Compare
|
OK, I am done tweaking it or now. I think it is ready for a broader review. |
bashbaug
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I left a few wording suggestions for the descriptions of the new environment variables, but feel free to ignore the suggestions or to apply further rewording if you prefer.
Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
0942164 to
1fbecb1
Compare
ba1efbf to
41a93d5
Compare
|
Implemented the suggestion from the working group. |
This is the follow up of #238 and the implementation of KhronosGroup/OpenCL-Docs#1003.
It depends on KhronosGroup/OpenCL-Docs#1350 and KhronosGroup/OpenCL-Headers#278.
It implements OpenCL ICD Loader de-initialization.