<div dir="ltr">I am trying to compile<a href="http://iss.ices.utexas.edu/?p=projects/galois/lonestargpu/download"> LonestarGPU-rev2.0</a> benchmark suite with LLVM/CLANG.<div><br></div><div>This suite has a following piece of code (more info <a href="https://devtalk.nvidia.com/default/topic/481465/cuda-programming-and-performance/any-way-to-know-on-which-sm-a-thread-is-running-/2/?offset=21#4996171">here</a>):</div><div><br></div><div><li class="gmail-L0" style="margin:0px 0px 0px 30px;padding:0px;outline:none;color:rgb(102,102,102);font-family:monospace;font-size:14px;white-space:pre"><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">static</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> __device__ </span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">uint</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> get_smid</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">(</span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">void</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">)</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> </span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">{</span><br style="margin:0px;padding:0px;outline:none"></li><li class="gmail-L1" style="margin:0px 0px 0px 30px;padding:0px;outline:none;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:rgb(238,238,238);color:rgb(102,102,102);font-family:monospace;font-size:14px;white-space:pre"><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">     </span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">uint</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> ret</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">;</span><br style="margin:0px;padding:0px;outline:none"></li><li class="gmail-L2" style="margin:0px 0px 0px 30px;padding:0px;outline:none;color:rgb(102,102,102);font-family:monospace;font-size:14px;white-space:pre"><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">     </span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">asm</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">(</span><span class="gmail-str" style="margin:0px;padding:0px;outline:none;color:rgb(0,136,0)">"mov.u32 %0, %smid;"</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> </span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">:</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> </span><span class="gmail-str" style="margin:0px;padding:0px;outline:none;color:rgb(0,136,0)">"=r"</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">(</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">ret</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">)</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> </span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">);</span><br style="margin:0px;padding:0px;outline:none"></li><li class="gmail-L3" style="margin:0px 0px 0px 30px;padding:0px;outline:none;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:rgb(238,238,238);color:rgb(102,102,102);font-family:monospace;font-size:14px;white-space:pre"><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">     </span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">return</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> ret</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">;</span><br style="margin:0px;padding:0px;outline:none"></li><li class="gmail-L4" style="margin:0px 0px 0px 30px;padding:0px;outline:none;color:rgb(102,102,102);font-family:monospace;font-size:14px;white-space:pre"><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">}</span></li><font color="#666600" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre">The original make file has nvcc compiler with a flag -Xptxas -v. It compiles with nvcc.</span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre">LLVM has -Xcuda-ptxas <arg>, which I believe is the comparable command for compiling PTX code. I get following error when I try compiling (clang 4.0).:</span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div><div><ol class="gmail-linenums" style="margin:5px 0px 5px 11px;padding:0px;outline:none;color:rgb(102,102,102);font-family:monospace;font-size:14px;white-space:pre"><li class="gmail-L0" style="margin:0px 0px 0px 30px;padding:0px;outline:none"><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">../../</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">include</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">/</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">cutil_subset</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">.</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">h</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">:</span><span class="gmail-lit" style="margin:0px;padding:0px;outline:none;color:rgb(0,102,102)">23</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">:</span><span class="gmail-lit" style="margin:0px;padding:0px;outline:none;color:rgb(0,102,102)">25</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">:</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> error</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">:</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> invalid </span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">%</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> escape </span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">in</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> </span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">inline</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> assembly </span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">string</span><br style="margin:0px;padding:0px;outline:none"></li><li class="gmail-L1" style="margin:0px 0px 0px 30px;padding:0px;outline:none;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:rgb(238,238,238)"><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">     </span><span class="gmail-kwd" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,136)">asm</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">(</span><span class="gmail-str" style="margin:0px;padding:0px;outline:none;color:rgb(0,136,0)">"mov.u32 %0, %smid;"</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> </span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">:</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> </span><span class="gmail-str" style="margin:0px;padding:0px;outline:none;color:rgb(0,136,0)">"=r"</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">(</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)">ret</span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">)</span><span class="gmail-pln" style="margin:0px;padding:0px;outline:none;color:rgb(0,0,0)"> </span><span class="gmail-pun" style="margin:0px;padding:0px;outline:none;color:rgb(102,102,0)">);</span></li></ol><div><font color="#666600" face="monospace"><span style="font-size:14px;white-space:pre"><br></span></font></div></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre">It points to %smid.</span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre">I have been trying to figure out what is this error is but NVIDIA PTX has <a href="http://docs.nvidia.com/cuda/cuda-c-programming-guide/">this</a>.</span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre">Is this a bug or something?</span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre">Thanks.</span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre">-Guru</span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><span style="font-size:14px;white-space:pre"><br></span></font></div></div>