1

I am evaluating the possibility for using OpenCL for just-in-time compilation of performance-critical mathematical expressions for CPU devices. I am currently using LLVM directly (or rather, I have a working proof-of-concept), but would find the abstraction offered by OpenCL very useful going forward.

I am now trying to figure out if there is some way to call functions with external linkage when using OpenCL for CPU devices, equivalent to the following in LLVM:

... = llvm::Function::Create(..., llvm::Function::ExternalLinkage, "...", ...);

Since my OpenCL implementation at least is built on top of LLVM, I was hoping that this would be possible somehow.

1 Answer 1

2
+50

Does this function http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clEnqueueNativeKernel.html accomplish what you are after?

Edit: credit where credit is due: https://stackoverflow.com/a/10807728/717881

Sign up to request clarification or add additional context in comments.

2 Comments

No, that link is not really what I am after. What I meant was calling functions with external linkage from inside the (CPU) kernel. The second link is very useful however. The answers suggests that this might simply be impossible without doing something like "reverse communication" with the kernel.
I'll reward you the bounty, since the two links you provided essentially gives all the information I needed. by using reverse communication with the kernel in combination with clEnqueueNativeKernel, it should be possible to essentially call any external function from an OpenCL kernel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.