-
Notifications
You must be signed in to change notification settings - Fork 38
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
Minimum version macros #54
Conversation
This looks great. I think that this is a much simpler design. The only thing I would add is a finalizer hook to unregister the object pointer from the dict when it is gc'd. |
Hm, when I add a finalizer I get the following error:
|
The hook would included in the Platform, CmdQueue, etc object finalizers. The extra step would see if the object being finalized has an id in the dict and remove itself before returning. |
But if you have two objects that reference to the same device/platform you would remove an entry unnecessarily. There is only a limited number of devices and platforms on the system so those shouldn't be a problem. The only object that would need a finalizer call would be Context since CmdQueue uses the id of the associated Device |
If two objects reference the same context pointer then one will not retain the context. The context object would only remove itself from the dict if it owns the underlying pointer. |
@jakebolewski like so? |
@vchuravy exactly. The only other comment I have is that pointer should be defined so it may be cleaner to replace |
@jakebolewski I agree that is certainly cleaner. I will then squash this and merge it. Maybe we should also introduce and abstract type |
- Since Contexts and CmdQueues are created en masse we need to cleanup after them.
8cc4b8e
to
2d6381b
Compare
Cool, all OpenCL objects sharing a common abstract subtype makes sense. We On Fri, Sep 5, 2014 at 1:49 PM, Valentin Churavy [email protected]
|
This PR adds minimum version macros as discussed in #42, #49 and #40 based on a runtime check and caching of the result in a global dictionary.
They take the form of a ternary operator:
to see how this might be used take a look at the branch https://github.com/JuliaGPU/OpenCL.jl/tree/vc/refactor_version_dependent_code