<div dir="ltr"><div><div>Hello,<br><br></div>I enabled "-polly-dump-before -polly-dump-after" to obtain the IR before and after Polly. Have attached kernel_gemm-before.ll (kg_before.ll) and kernel_gemm-after.ll (kg_after.ll)<br><br></div><div>observations,<br></div><div><ul><li>Both kg_before.ll and kg_after.ll have,</li><ul><li>The only DICompileUnit is at !2</li><li>!<a href="http://llvm.dbg.cu">llvm.dbg.cu</a>=!{!2}</li><li>I don't think Julia is generating incorrect debug info .<br></li></ul><li>For <font size="4"><span style="font-family:monospace">opt kernel_gemm-before.ll $FLAG -o output.ll</span></font></li><ul><li>All the following FLAGs except "-O3 -polly -polly-target=gpu" didn't have a problem with the Module,</li><ul><li>-O3 -polly -polly-target=cpu</li><li>-O3</li></ul><li>The only time verifyModule is called within Polly is at kernerlFinalize.</li><ul><li>This could mean that Polly's generating the wrong debug info, which is uncovered only when GPU code's generated.</li><ul><li>I'm not sure if verifyModule is called indirectly when -polly-target=cpu<br></li></ul><li>Or, the debug information is corrupted when sending or/and receiving information to/from PPCG. <br></li></ul></ul><li>For opt output.ll -O3 -polly -polly-target=gpu -o output.output.ll, where output.ll generated by opt kg_before.ll -O3 -polly -polly-target=cpu,</li><ul><li>verifyModule is involed thrice, but issues the same error<br></li><ul><li>Possibly 3 SCoPs detected ?</li></ul><li>This increases the possibility that Polly isn't handling the debug info properly<br></li></ul><li>For <font size="4"><span style="font-family:monospace">opt kernel_gemm-after.ll $ANY_FLAG -o output.ll</span></font></li><ul><li><font size="4"><span style="font-family:monospace">Cannot invoke an intrinsic other than donothing, patchpoint, statepoint, coro_resume or coro_destroy</span></font></li><li><font size="4"><span style="font-family:monospace"> store void (metadata, i64, metadata, metadata)* @llvm.dbg.value, void (metadata, i64, metadata, metadata)** %polly_launch_0_param_7</span></font></li><li><font size="4"><span style="font-family:monospace">Invalid user of intrinsic instruction!</span></font></li><li><font size="4"><span style="font-family:monospace"> store void (metadata, i64, metadata, metadata)* @llvm.dbg.value, void (metadata, i64, metadata, metadata)** %polly_launch_0_param_7</span></font></li><li><font size="4"><span style="font-family:monospace">./llvm_build/bin/opt: kernel_gemm-after.ll: error: input module is broken!</span></font></li><li><font size="4"><font size="2">and output.ll isn't produced</font><span style="font-family:monospace">.<br></span></font></li></ul></ul><br></div><div>-Sanjay<br></div><div><br></div>Only target=gpu giving me error, but verufyModule is only in the path of target=gpu.<br><div><div><div><div><div><br><div class="gmail_quote"><div dir="ltr">On Sun, Mar 12, 2017 at 2:10 PM Tobias Grosser <<a href="mailto:tobias@grosser.es">tobias@grosser.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Mar 11, 2017, at 07:34 PM, David Blaikie via llvm-dev wrote:<br class="gmail_msg">
> On Sat, Mar 11, 2017 at 3:10 AM SANJAY SRIVALLABH SINGAPURAM via llvm-dev<br class="gmail_msg">
> <<br class="gmail_msg">
> <a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br class="gmail_msg">
><br class="gmail_msg">
> > Hello,<br class="gmail_msg">
> ><br class="gmail_msg">
> > One of my Julia programs failed to execute with the following error,<br class="gmail_msg">
> > DICompileUnit not listed in <a href="http://llvm.dbg.cu" rel="noreferrer" class="gmail_msg" target="_blank">llvm.dbg.cu</a><br class="gmail_msg">
> > !11 = distinct !DICompileUnit(language: DW_LANG_C89, file: !3, producer:<br class="gmail_msg">
> > "julia", isOptimized: true, runtimeVersion: 0,emissionKind: FullDebug,<br class="gmail_msg">
> > enums: !12)<br class="gmail_msg">
> ><br class="gmail_msg">
> > This was generated by verifyModule(*GPUModule,&(llvm::errs())>From whithin<br class="gmail_msg">
> > PPCGCodeGeneration.cpp in Polly.<br class="gmail_msg">
> ><br class="gmail_msg">
> > From <llvm_src>/test/Verifier/dbg-orphaned-compileunit.ll, I understand<br class="gmail_msg">
> > that the debug info, of a compile unit, represented by !11 is missing from<br class="gmail_msg">
> > <a href="http://llvm.dbg.cu" rel="noreferrer" class="gmail_msg" target="_blank">llvm.dbg.cu</a>.<br class="gmail_msg">
> ><br class="gmail_msg">
> > What does this mean ? What could have caused this problem and how can I<br class="gmail_msg">
> > fix it ?<br class="gmail_msg">
> ><br class="gmail_msg">
><br class="gmail_msg">
> At the LLVM level, it means that the CU debug info (DICompileUnit) wasn't<br class="gmail_msg">
> listed in the list of all compile units (!<a href="http://llvm.dbg.cu" rel="noreferrer" class="gmail_msg" target="_blank">llvm.dbg.cu</a> global named<br class="gmail_msg">
> metadata<br class="gmail_msg">
> node) when it should be. Whatever produced the IR you are using likely<br class="gmail_msg">
> has<br class="gmail_msg">
> a bug and should be fixed to ensure the DICompileUnits created are<br class="gmail_msg">
> included<br class="gmail_msg">
> in the !<a href="http://llvm.dbg.cu" rel="noreferrer" class="gmail_msg" target="_blank">llvm.dbg.cu</a> global named metadata node (check Clang's behavior<br class="gmail_msg">
> for<br class="gmail_msg">
> comparison - usually a good reference point)<br class="gmail_msg">
><br class="gmail_msg">
> This invariant was added a while ago (in LLVM time - I think it was in<br class="gmail_msg">
> the<br class="gmail_msg">
> last year or maybe two) by Adrian.<br class="gmail_msg">
<br class="gmail_msg">
Right. It seems as if Julia is emitting invalid debug symbols. If you<br class="gmail_msg">
want to point them to this issue, you can probably call<br class="gmail_msg">
"verifyModule(*GPUModule))" after their initial IR is generated and<br class="gmail_msg">
already see the issue. If this is not the case, Polly might make a<br class="gmail_msg">
mistake when extracting the GPU module and might miss to transfer all<br class="gmail_msg">
debug information. Can you send me the output of the flag<br class="gmail_msg">
"-polly-dump-before"?<br class="gmail_msg">
Can you pass the dumped IR through 'opt' without seeing an error? In<br class="gmail_msg">
this case, the<br class="gmail_msg">
IR that enters Polly is still correct, but Polly might mis-transform it.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
An alternative fix would be to extract the debug-info stripping<br class="gmail_msg">
functionality in lib/Transforms/IPO/StripSymbols.cpp into its own<br class="gmail_msg">
function and call this on our Kernel-IR. It is unlikely that we want to<br class="gmail_msg">
debug GPU kernels, so we can just remove debug information for now.<br class="gmail_msg">
<br class="gmail_msg">
Best,<br class="gmail_msg">
Tobias<br class="gmail_msg">
<br class="gmail_msg">
><br class="gmail_msg">
> - Dave<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> ><br class="gmail_msg">
> > Thank You,<br class="gmail_msg">
> > Sanjay<br class="gmail_msg">
> > _______________________________________________<br class="gmail_msg">
> > LLVM Developers mailing list<br class="gmail_msg">
> > <a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg">
> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="gmail_msg">
> ><br class="gmail_msg">
> _______________________________________________<br class="gmail_msg">
> LLVM Developers mailing list<br class="gmail_msg">
> <a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg">
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="gmail_msg">
</blockquote></div></div></div></div></div></div></div>