<div dir="ltr">Hey Jingyue,<div><br></div><div>Though I tried `opt -nvvm-reflect` on both bc files, the nvvm reflect anchor didn't go away; ptxas is still complaining about the duplicate definition of of function '_ZL21__nvvm_reflect_anchorv' . Did I misused the nvvm-reflect pass?</div><div><br></div><div>Thanks!</div><div>yuanfeng</div>
</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 11, 2016 at 10:10 AM, Jingyue Wu <span dir="ltr"><<a href="mailto:jingyue@google.com" target="_blank">jingyue@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">According to the examples you sent, I believe the linking issue was caused by nvvm reflection anchors. I haven't played with that, but I guess running nvvm-reflect on an IR removes the nvvm reflect anchors. After that, you can llvm-link the two bc/ll files. <div><br></div><div>Another potential issue is that your cuda_hooks-sm_30.ll is unoptimized. This could cause the instrumented code to run super slow. </div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 11, 2016 at 9:40 AM, Yuanfeng Peng <span dir="ltr"><<a href="mailto:yuanfeng.jack.peng@gmail.com" target="_blank">yuanfeng.jack.peng@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey Jingyue,<div><br></div><div>Attached are the .ll files. Thanks!</div><span><font color="#888888"><div><br></div><div>yuanfeng</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 11, 2016 at 3:47 AM, Jingyue Wu <span dir="ltr"><<a href="mailto:jingyue@google.com" target="_blank">jingyue@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Looks like we are getting closer! <br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Thu, Mar 10, 2016 at 5:21 PM, Yuanfeng Peng <span dir="ltr"><<a href="mailto:yuanfeng.jack.peng@gmail.com" target="_blank">yuanfeng.jack.peng@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Hi Jingyue,</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thank you so much for the helpful response! I didn't know that PTX assembly cannot be linked; that's likely the reason for my issue.</div><div class="gmail_extra"><br></div><div class="gmail_extra">So I did the following as you suggested(axpy-sm_30.bc is the instrumented bitcode, and cuda_hooks-sm_30.bc contains the hook functions):</div><div class="gmail_extra"><br></div><div class="gmail_extra">
<p><i><b><span>llvm-link</span><span> axpy-sm_30.bc cuda_hooks-sm_30.bc -o inst_axpy-sm_30.bc</span></b></i></p><p><span><i><b>llc inst_axpy-sm_30.bc -o axpy-sm_30.s</b></i></span></p><p><span><i><b>
</b></i></span></p><p><span><i><b>"/usr/local/cuda/bin/ptxas" "-m64" "-O3" -c "--gpu-name" "sm_30" "--output-file" axpy-sm_30.o axpy-sm_30.s</b></i></span></p><p>However, I got the following error from ptxas:</p><p><span><b>ptxas axpy-sm_30.s, line 106; error : Duplicate definition of function '_ZL21__nvvm_reflect_anchorv'</b></span></p><p><span><b>ptxas axpy-sm_30.s, line 106; fatal : Parsing error near '.2': syntax error</b></span></p><p>
</p><p><span><b>ptxas fatal : Ptx assembly aborted due to errors</b></span></p><p>Looks like some cuda function definitions are in both bitcode files which caused duplicate definition... what am I supposed to do to resolve this issue?</p></div></div></blockquote></span><div>Can you attach axpy-sm_30.ll and cuda_hooks-sm_30.ll? The duplication may be caused by how nvvm reflection works, but I'd like to see a concrete example. <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_extra"><p><br></p><p>Thanks!</p><span><font color="#888888"><p>yuanfeng </p><p><span><b><br></b></span></p></font></span></div><div class="gmail_extra"><br><br></div></div>
</blockquote></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>