[cfe-dev] Parsing CUDA file to AST
Eli Bendersky
eliben at google.com
Wed Mar 5 13:58:30 PST 2014
On Wed, Mar 5, 2014 at 1:40 PM, jotas <julian.maciejewski at gmail.com> wrote:
> Actually I have same problem as this guy:
> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-June/015596.html
>
> I set search patches and now my program sees __global__ etc. but not
> blockDim.x or threadIdx.x.
>
Yeah, these don't work in Clang yet. Patches welcome!
I have some very initial patches to implement this, but very far from
something I could actually send upstream. It may take time until I get to
that.
Eli
> I set flag -D__CUDACC__ in makefile but it doesnt work. setting:
> TheCompInst.getPreprocessorOpts().addMacroDef("__CUDACC__"); gives even
> more errors like:
>
> /usr/local/cuda-5.5/include/cuda_runtime_api.h:1029:17: warning: unknown
> attribute 'cudart_builtin' ignored
> extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI
> cudaGetLastError(void);
> ^
> /usr/local/cuda-5.5/include/host_defines.h:199:22: note: expanded from
> macro '__cudart_builtin__'
> __location__(cudart_builtin)
> ^
> /usr/local/cuda-5.5/include/host_defines.h:83:22: note: expanded from macro
> '__location__'
> __annotate__(a)
>
>
>
>
>
>
>
>
>
>
> 2014-03-05 22:26 GMT+01:00 Eli Bendersky-2 [via Clang Developers] <
> ml-node+s42468n4038299h32 at n3.nabble.com>:
>
> >
> >
> >
> > On Wed, Mar 5, 2014 at 4:12 AM, jotas <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=4038299&i=0>
> > > wrote:
> >
> >> 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>
> >>
> >> #define N_WAVE 1024
> >> #define LOG2_N_WAVE 10
> >>
> >
> > These are usually defined as preprocessor macros in the CUDA headers,
> > something like:
> >
> > #define __device__ __attribute__((device))
> >
> > You can take a peek at the public CUDA headers for more information.
> >
> > Eli
> >
> >
> >
> >
> > _______________________________________________
> > cfe-dev mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4038299&i=1>
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
> >
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://clang-developers.42468.n3.nabble.com/Parsing-CUDA-file-to-AST-tp4038287p4038299.html
> > To unsubscribe from Parsing CUDA file to AST, click here<
> http://clang-developers.42468.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4038287&code=anVsaWFuLm1hY2llamV3c2tpQGdtYWlsLmNvbXw0MDM4Mjg3fC00NjM1OTk5MDA=
> >
> > .
> > NAML<
> http://clang-developers.42468.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/Parsing-CUDA-file-to-AST-tp4038287p4038301.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140305/80cec7c0/attachment.html>
More information about the cfe-dev
mailing list