[cfe-dev] How to compile OpenCL kernel functions?

Peter Collingbourne peter at pcc.me.uk
Mon Oct 3 06:31:36 PDT 2011


On Mon, Oct 03, 2011 at 01:36:58PM +0200, Dongrui She wrote:
> Hi All,
> 
> I am trying to use Clang (trunk version) to compile some OpenCL kernels.
> 
> I'm confused about how the the OpenCL address space is handled.
> The test case "clang/test/CodeGenOpenCL/address-spaces.cl" uses
> "-ffake-address-space-map" and it can pass when I use llvm-lit.
> 
> But when I try to compile it, clang gives a warning
> that "-ffake-address-space-map" is not used, and in the generated IR, and it
> seems that all the pointers are treated as "normal" pointers.
> 
> Can someone give me some advice?
> Or maybe point me to the right documentation.

The -ffake-address-space-map flag is only intended for use during
testing, because we don't actually have any targets in the tree that
define an address space map.

To declare a target with an address space map, you could add a new
target to lib/Basic/Targets.cpp with an address space map, or modify
one of the existing targets.

The attached patch shows how to add a new target with an address
space map.

Thanks,
-- 
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Define-the-KLEE-OpenCL-target.patch
Type: text/x-diff
Size: 2058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111003/3c9c4210/attachment.patch>


More information about the cfe-dev mailing list