Hi,
I ma building rewriter based on clang (based on some tutorial available on
the internet).
I am loading CUDA file and trying to traverse AST. I got a problem. It
doesn't recognize CUDA directives like __global__ etc.
I set:
TheCompInst.getLangOpts().CUDA = 1;
and source search patch to:
/usr/include/linux
Sould I do someting more?
I get an error:
:~/Documents/rewriter$ ./rewritersample bigfunc2.c
bigfunc2.c:17:1: error: unknown type name '__global__'
__global__ void foo22(int *a, int *b, int *c) {
^
bigfunc2.c:17:12: error: expected identifier or '('
__global__ void foo22(int *a, int *b, int *c) {
^ #include <cuda.h>
I set search patches and now my program sees __global__ etc. but not
blockDim.x or threadIdx.x.
I set flag -D__CUDACC__ in makefile but it doesnt work. setting:
TheCompInst.getPreprocessorOpts().addMacroDef("__CUDACC__"); gives even
more errors like:
Yep, but there are lots of publications about CU2CL which is CUDA to
Open-Cl source-to-source compiler. I'm curious how they made it if this
approach is not supported yet. Unfortunately there is no code of this
project in the Internet What should I do?