<div dir="ltr">Thanks for the heads up Philip !<div><br></div><div>I did come across a strange case where LLVM allowed "%" to be a part of a function's name. This was in the context of my patch <a href="https://reviews.llvm.org/D33985">https://reviews.llvm.org/D33985</a>, where I prefix the name of the source function and the Scop ( A special kind of Region that Polly can optimize, the name of the Scop is the name of the Region ) to the name of the PTX kernel generated from the Scop. For e.g. The edits like the following to <a href="https://github.com/llvm-mirror/polly/blob/6b8cb877c2fa3ee0e626cac5811115a9c5c71b5b/lib/CodeGen/PPCGCodeGeneration.cpp#L1422"><polly_src>/lib/CodeGen/PPCGCodeGeneration.cpp</a> achieves the above mentioned prefixing,</div><div><br></div><div><div><font face="monospace">@@ -1419,7 +1438,9 @@ void GPUNodeBuilder::createKernel(__isl_take isl_ast_node *KernelStmt) {</font></div><div><font face="monospace">   Builder.SetInsertPoint(&HostInsertPoint);</font></div><div><font face="monospace">   Value *Parameters = createLaunchParameters(Kernel, F, SubtreeValues);</font></div><div><font face="monospace"> </font></div><div><font face="monospace">-  std::string Name = "kernel_" + std::to_string(Kernel->id);</font></div><div><font face="monospace">+  std::string Name = S.getFunction().getName().str() + "_" +</font></div><div><font face="monospace">+                     S.getOrigName() + "_kernel_" +</font></div><div><font face="monospace">+                     std::to_string(Kernel->id);</font></div></div><div><br></div><div>(Where getOrigName returns the name of the Scop before the IRBuilder modified it)</div><div><br></div><div>Produces the effect,</div><div><div><font face="monospace">--- a/<a href="https://github.com/llvm-mirror/polly/blob/6b8cb877c2fa3ee0e626cac5811115a9c5c71b5b/test/GPGPU/kernel-params-only-some-arrays.ll#L19-L20">test/GPGPU/kernel-params-only-some-arrays.ll</a></font></div><div><font face="monospace">+++ b/test/GPGPU/kernel-params-only-some-arrays.ll</font></div><div><font face="monospace">@@ -16,12 +16,12 @@</font></div><div><font face="monospace"> ;        B[i] += 42;</font></div><div><font face="monospace"> ;    }</font></div><div><font face="monospace"> </font></div><div><font face="monospace">-; KERNEL: ; ModuleID = 'kernel_0'</font></div><div><font face="monospace">-; KERNEL-NEXT: source_filename = "kernel_0"</font></div><div><font face="monospace">+; KERNEL: ; ModuleID = 'kernel_params_only_some_arrays_%or.cond---%or.end9_kernel_0'</font></div><div><font face="monospace">+; KERNEL-NEXT: source_filename = "kernel_params_only_some_arrays_%or.cond---%or.end9_kernel_0"</font></div></div><div><br></div><div>I don't understand how <a href="https://github.com/llvm-mirror/polly/blob/6b8cb877c2fa3ee0e626cac5811115a9c5c71b5b/lib/CodeGen/PPCGCodeGeneration.cpp#L1813">Module verification</a> was fine with this name. What are your thoughts ?</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 22, 2017 at 6:14 PM Philip Pfaffe <<a href="mailto:philip.pfaffe@gmail.com">philip.pfaffe@gmail.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 Sanjay,<div><br></div><div>since I've seen you working with GPU code generation, one additional heads up: You must take care that your function names are also legal in the target architecture (such as PTX).</div><div><br></div><div>While backends can legalize function names, NVPTX can't/doesn't (it can't, really, because kernel invocation can be done by a name string). This means that you mustn't have, e.g., a dot in your function name. The dot is legal in an LLVM identifier, but not in a ptx function name. This also is noteworthy because the slot tracker automatically inserts dots into function names for deduplication.</div><div><br></div><div>Best,</div><div>Philip</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-22 14:34 GMT+02:00 SANJAY SRIVALLABH SINGAPURAM via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank You Chen !</div><div class="m_-6446313706070585348HOEnZb"><div class="m_-6446313706070585348h5"><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 22, 2017 at 5:21 PM 陳韋任 <<a href="mailto:chenwj.cs97g@g2.nctu.edu.tw" target="_blank">chenwj.cs97g@g2.nctu.edu.tw</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"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Perhaps you can refer to [1]. Function name should be a global one.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">[1] <a href="http://llvm.org/docs/LangRef.html#identifiers" target="_blank">http://llvm.org/docs/LangRef.html#identifiers</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">HTH,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">chenwj</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">2017-06-22 16:35 GMT+08:00 SANJAY SRIVALLABH SINGAPURAM via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br></div></div><div class="gmail_extra"><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">Hello,</div><div dir="ltr"><br></div><div dir="ltr">I'd like to know the format a function's name must conform to. Can I be pointed to LLVM documention that specifies the nomenclature for functions and other Identifiers as well (%registers, ModuleID etc.) ?</div><div dir="ltr"><br></div><div dir="ltr">Thanks,</div><div dir="ltr">Sanjay</div>
<br></blockquote></div></div><div class="gmail_extra"><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>
<br></blockquote></div></div><div class="gmail_extra"><br><br clear="all"><div><br></div>-- <br><div class="m_-6446313706070585348m_-6841911289086730866m_-413967065839515471gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Wei-Ren Chen (陳韋任)<br>Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank">https://people.cs.nctu.edu.tw/~chenwj</a></div></div></div>
</div></blockquote></div>
</div></div><br>_______________________________________________<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>
<br></blockquote></div><br></div>
</blockquote></div>