<div dir="ltr">Hi Justin,<div><br></div><div>To follow up, I tried out the sample code that you provided and the CUDAKernelCallExpr was in fact in the AST like you have said. I did some further troubleshooting with my code alongside making modifications to the code you provided me with and I discovered that the source of my issue was that I had been getting a missing file error for a header file for my source code (which had not interfered with anything for weeks now, so I disregarded it for the time-being) and the fact that I was getting that error was somehow interfering with the AST generation and causing the CUDAKernelCallExpr node to not appear in the AST only when it has template parameters. I added the includes directive for the missing header to your sample code and it had the same effect of causing the CUDAKernelCallExpr node to disappear. I have since resolved the missing dependency and all is well now with my original source code; all of the kernel call expressions are now showing up.</div><div><br></div><div>Thank you for your help!</div><div>Michael Ehmke</div><div class="gmail_quote"><div dir="ltr"><br></div><div dir="ltr">On Wed, Nov 29, 2017 at 9:05 AM Michael Ehmke <<a href="mailto:mehmke@ncsu.edu" target="_blank">mehmke@ncsu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Justin, <div><br></div><div>Thanks so much for the response. I'll try that out and get back to you. </div><div><br></div><div>Sincerely, </div><div></div><div>Michael Ehmke </div><div><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 29, 2017, 12:06 AM Justin Lebar <<a href="mailto:jlebar@google.com" target="_blank">jlebar@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, Michael.<div><br></div><div>Are you able to create a reduced testcase which demonstrates your problem?</div><div><br></div><div>I tried</div><div><br></div><div><div>template <int N></div><div>__global__ void Kernel() {}</div><div><br></div><div>void test() {</div><div>  Kernel<16><<<100, 200>>>();</div><div>}</div></div><div><br></div><div>which I compiled with </div><div><br></div><div>  $ clang -c -Xclang -ast-dump <a href="http://test.cu" target="_blank">test.cu</a></div><div><br></div><div>and the AST looks fine to me -- the CUDAKernelCallExpr shows up as expected.</div><div><br></div><div>-Justin</div></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr">On Tue, Nov 28, 2017 at 2:33 PM Michael Ehmke via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><span style="color:rgb(33,33,33);font-size:13px">Hello all,</span></div><div><span style="color:rgb(33,33,33);font-size:13px"><br></span></div><div><span style="color:rgb(33,33,33);font-size:13px">I'm using Clang and am trying to refactor CUDA code. I want to traverse the AST to access a CUDAKernelCallExpr node where the kernel call has template parameters. I have been able to successfully match on and access CUDA kernel calls which have no template parameters by using the AST matchers to match on a CUDAKernelCallExpr. However, when my code comes across a kernel call with template parameters, it appears that the expression is not even existent in the AST when it is dumped. </span></div><div><span style="color:rgb(33,33,33);font-size:13px"><br></span></div><div><span style="color:rgb(33,33,33);font-size:13px">This is the expression that I'm having trouble parsing:</span><br></div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">ex. matrixMulCUDA<16><<< grid, threads >>>(d_C, d_A, d_B, dimsA.x, dimsB.x);</div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">This expression does not show up at all in the AST when dumping the AST. I have been able to successfully parse the following kernel call expression and it shows up in the AST as a "CudaKernelCallExpr" node.</div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">ex. matrixMulCUDA<<< grid, threads >>>(d_C, d_A, d_B, dimsA.x, dimsB.x);  <br></div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">As you can see, the only difference is the <16> after the name of the call, and this node is clearly represented in the AST.</div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33);font-size:13px">Here is a screenshot showing the lack of a node to represent the call with template parameters.</div><br class="m_5138060682211408265m_-8050031867887171610m_2500589351128703923m_-7529029660080803153m_4654841480214208958inbox-inbox-Apple-interchange-newline"><div><img src="cid:16003a4a6f6cb971f161" alt="image.png" class="" style="max-width: 100%;"><br></div><div><div style="color:rgb(33,33,33);font-size:13px">If I could get any assistance on why this is happening, I would appreciate it greatly.</div></div><div><br></div><div>Thank you,</div></div><div dir="ltr"><div>Michael Ehmke</div></div></div></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div></div></blockquote></div></div>