Skip to content
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

Versioned API #42

Closed
wants to merge 13 commits into from
Closed

Versioned API #42

wants to merge 13 commits into from

Conversation

vchuravy
Copy link
Member

This PR implements parts of #40. The code for OpenCL versions 1.1 and 1.2 is conditionally loaded if a platform is found that supports them.

Changes:

  • splitting up api.jl into api.jl, opencl_10.jl, opencl_11.jl and opencl_12.jl
  • adds a functional @ocl_func_deprecated
  • removes @ocl_func_1X and changes @ocl_func to evaluate the expr in the api module
  • adds OpenCL.api.OPENCL_VERSION
  • adds @has_ocl12? macros

@vchuravy vchuravy mentioned this pull request Aug 12, 2014
@vchuravy
Copy link
Member Author

The Travis breakage looks unrelated.

Also @deprecate currently doesn't work the way it is supposed to.

@vchuravy
Copy link
Member Author

I added three macros for my most common use case.

using OpenCL; const cl = OpenCL

platform, device, ...

const image = cl.@min_v12? device begin
   cl.api.clCreateFromGLTexture(...)
end : begin
     cl.api.clCreateFromGLTexture2D(...)
end

@vchuravy vchuravy mentioned this pull request Aug 19, 2014
@vchuravy
Copy link
Member Author

the @deprecate macro is doing the wrong thing for this use case. Instead of just warning that you are using a deprecated function it actually reroutes the call to the new function. So I will have to add a deprecation macro that mimics Base.@deprecate, but doesn't reroute the call.

@vchuravy
Copy link
Member Author

An interesting approach is what OpenCL.jl took.

using OpenGL
@OpenGL.version "1.0"
@OpenGL.load

We could then check if the version specified is supported by at least on available platform and then load the api.

https://github.com/rennis250/OpenGL.jl/blob/master/src/OpenGL.jl

@jakebolewski What do you think about the whole approach outlined in this PR? Worth pursuing?

@vchuravy
Copy link
Member Author

So I am happy with the functionality gain vs complexity added. The only thing I am unhappy about is that this needs eval inside a macro to put the code in the right context, but if we want something like this I don't see any way around this.

@jakebolewski Final call is yours :)

@jakebolewski
Copy link
Member

@vchuravy I finally got a new computer so I can actually work on this again! I had a closer look at your pull request and pushed a couple of changes to jcb/versioned_api.

Just a note. eval inside a macro is bad, in this case you wanted everything to be included in toplevel module scope which is why eval was necessary.

This looks pretty good, but I still have reservations. The main is that we now have to execute code at Module load time which you generally want to avoid. It takes a bit longer to load (~10%) which is not terrible but I feel that static compilation might be coming in the next release and this will complicate things if we want to take advantage of that. I don't know if it would be worth waiting until conditional modules arrive, it seems like a better solution than what we can do now.

@vchuravy
Copy link
Member Author

I like your changes :)

Yes I was wondering how this might play with static compilation. But my intuition would be to fix this when and if conditional modules and static compilation is available.

@jakebolewski
Copy link
Member

Ok fair enough. I guess this doesn't really break any valid use of the low
level API. We should fix the travis build and then merge this. I'm also
getting a segfault in the Program tests on OS X but I think that is
unrelated.

On Sat, Aug 23, 2014 at 10:08 AM, Valentin Churavy <[email protected]

wrote:

I like your changes :)

Yes I was wondering how this might play with static compilation. But my
intuition would be to fix this when and if conditional modules and static
compilation is available.


Reply to this email directly or view it on GitHub
#42 (comment).

This was referenced Aug 27, 2014
@vchuravy
Copy link
Member Author

vchuravy commented Sep 5, 2014

superseded by #54

@vchuravy vchuravy closed this Sep 5, 2014
@vchuravy vchuravy deleted the vc/versioned_api branch January 18, 2016 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants