-
Notifications
You must be signed in to change notification settings - Fork 113
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
add clSetContextDestructorCallback #346
add clSetContextDestructorCallback #346
Conversation
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 with one minor comment. This also begs the (separate) question: do we want to provide an alias to clSetProgramReleaseCallback
for consistency? I'm thinking of clSetProgramDestructorCallback
.
Since we don't support program scope constructors and destructors in OpenCL 3.0, I think a better thing to do is to deprecate |
We should clarify this in the spec BTW (Appendix H is pretty clear but the normative section just says "Missing before 2.2" which implies it's supported in 3.0). I've created #347.
Yes, I was thinking of the end state with the feature added back in, not specifically of 3.0 but I think it makes sense to deprecate in 3.0. I've created #348. |
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 (the change to man/toctail
made me notice other issues, filed that as #350 as nothing to do with this PR).
Since it is similar to some discussion we had in SYCL https://gitlab.khronos.org/sycl/Specification/-/issues/289 I wonder how this feature can be implemented safely. |
Interesting discussion, thanks for passing this along. FWIW, I don't think the SYCL proposal (link) is exactly the same as this feature because the proposed SYCL deleter gets called before the SYCL context is deleted, whereas this callback gets called after the OpenCL context is deleted, but there's definitely a fair amount of overlap.
I think the simplest answer is that this behavior won't be conformant. I'm hand-waving a little, but I imagine we would have a conformance test that ensures the context destructor callback is properly called, similar to this conformance test for https://github.com/KhronosGroup/OpenCL-CTS/blob/master/test_conformance/api/test_mem_objects.cpp Does that sound reasonable? |
Merging as discussed on the July 16th teleconference. |
Yes, there is a difference between when a |
Fixes #187.
This PR adds a new API to register a callback for a context that is called when the context is destroyed.