[PATCH] D28080: [Docs][OpenCL] Added OpenCL feature description to user manual.

Pekka Jääskeläinen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 22:11:06 PST 2017


pekka.jaaskelainen added a comment.

In https://reviews.llvm.org/D28080#653493, @Anastasia wrote:

> > Also, for me the command without -emit-llvm doesn't output anything.
>
> What targets do you use?


In this case I used only SPIR. I suppose this is fine as the concept of linking is unclear in case of Clang's OpenCL
support.

> I think the problem is that it's not clear what the default output of the standalone compiler should be for the most of the OpenCL targets, since it does't produce a valid binary. If let's say we emit an x86 binary, would it be valid to run it for POCL directly?  Perhaps, we could try to emit the bitcode by default then.

An x86 OpenCL binary from Clang is not executable as is (especially in case of multi-WI WGs), but needs a transformation to convert the multi-WI
to parallel loops, fibers, straight to vector instructions, or similar.  However, I try to keep the Clang's OpenCL output of any target valid for pocl without
a special triplet code for now. This way it should be possible to get OpenCL support for most, if not all, targets supported by LLVM out of the box.

One problem I've found are the host callable kernel functions. We don't want the target-specific CC/ABI used for them as they have clSetKernelArg()
mappable arguments and other interfacing considerations, especially with heterogeneous setups. Recently I discovered that there might be a way to fix this
nicely via the SPIR target. If we use SPIR ABI by default for OpenCL kernel functions, the rest of it might just work with the target's default settings.

Just a heads up, I will propose this patch to upstream after some testing: 
https://raw.githubusercontent.com/pocl/pocl/c9ae29f2268d3b92462d6ca97d1d596dae0d15a1/tools/patches/clang-3.9-always-spir-cc-for-kernels.patch


https://reviews.llvm.org/D28080





More information about the cfe-commits mailing list