Up to date usage example

Hi,

Is there a complete example that shows how to compile and link a kernel with the latest versions (3.9) of clang and libclc ?

After building clang and libclc the compile-test.sh script does not appear to work on any of the kernels in the test directory. The initial error is due to the absence of the file
nvptx–nvidiacl/lib/builtins.bc. I tried changing the command to use builtins.opt.bc but other errors occurred.

I’ve seen some examples online but it isn’t clear that any of them are up to date.

This command:

clang -O3 --include /usr/local/include/clc/clc.h -I /usr/local/include/clc -Dcl_clang_storage_class_specifiers -x cl -Xclang -mlink-bitcode-file -Xclang /usr/local/lib/clc/tonga-amdgcn–.bc -target amdgcn–amdhsa -mcpu=tonga -Xclang -cl-std=CL2.0 -DCL20 cos.cl -o cos.bc

fails because clang-3.9 attempts to find ld,lld (which I have not installed since my understanding is that it shouldn’t be needed for libclc).

(cos.cl is from the libclc tests directory.)

If I change the above command to produce cos.ll by adding the -S option it works but then

llvm-link cos.ll /usr/local/lib/clc/tonga-amdgcn–amdhsa.bc -o cos-linked.bc

fails with the error:

llvm-link: output.ll:1:2: error: expected top-level entity
.text

Any help here would be appreciated.

Thanks,
Tim Flynn

-S will produce the text isa output. If you want the linked bitcode file you need to add -emit-llvm

-Matt