<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 6, 2017 at 2:21 PM Mehdi AMINI <<a href="mailto:joker.eph@gmail.com">joker.eph@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"><div class="gmail_extra"><div class="gmail_quote">2017-06-06 13:38 GMT-07:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><span class="m_-203227576041730874gmail-"><div dir="ltr">On Tue, Jun 6, 2017 at 1:26 PM Mehdi AMINI <<a href="mailto:joker.eph@gmail.com" target="_blank">joker.eph@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-06-05 14:27 GMT-07:00 David Blaikie 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">I know there's been a bunch of discussion here already, but I was wondering if perhaps someone (probably Teresa? Peter?) could:<br><br>1) summarize the current state<br>2) describe the end-goal<br>3) describe what steps (& how this patch relates) are planned to get to (2)<br><br>My naive thoughts, not being intimately familiar with any of this: Usually bitcode and textual IR support go in together or around the same time, and designed that way from the start (take r211920 for examaple, which added an explicit representation of COMDATs to the IR). This seems to have been an oversight in the implementation of IR summaries (is that an accurate representation/statement?)</div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>More or less: it was not an oversight. </div><div>The summaries are not really part of the IR, it is more like an "analysis result" that is serialized. It can always be recomputed from the IR. This aspect makes it quite "special", it is the only analysis result that I know of that we serialize.</div></div></div></div></blockquote></span><div><br>The use list work seems pretty similar in some ways (granted, can't be recomputed to match, hence the desire to serialize it for test case implementation).<br></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I see use-list as a leaky implementation detail of the IR that we serialized because it impact the processing of the IR.</div><div><br></div><div>Summaries are more like serializing the CFG for example.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>But it looks like the same is true here to a degree - there are test cases that exercise the summary handling, so they want summaries for input (for now, I think, I've seen test cases that run another LLVM tool to insert/create a summary to then feed that back in for a test), or to test that the resulting summary is correct.<br></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>We have cases were we want summaries as an input and check a combined summary as an output, and for these having the YAML representation will be useful (we didn't have it before).</div></div></div></div></blockquote><div><br>What I'm suggesting is that this is an (optional) IR feature as much as any other - so it seems slightly odd that it'd be YAML rather than something that looked more like the rest of the IR. Though I'm not outright opposed to YAML here - just want to make sure this information is being treated as a first class IR construct (as much as use order, comdats, etc are for rough examples)<br><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"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Can summaries be standalone? I thought they could (that'd be ideal for the distributed situation - only the summary needs to go to the 'thin link' step, I think? (currently maybe only the debug info is stripped for that - but ideally other unused IR wouldn't be shipped there as well, I would think)<br></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Yes conceptually they can be standalone.</div></div></div></div></blockquote><div><br>This seems to provide the strongest/clear motivation for having summaries as a first class (though optional) IR construct.<br><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"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class="m_-203227576041730874gmail-"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"> & now there's an effort to correct that. </div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>The main motivation here, I believe, is more to help dev to have human readable/understandable dump for ThinLTO bitcodes. Having to inspect separately summaries is a pain.</div></div></div></div></blockquote></span><div><br>Not sure I quite follow - inspect separately? </div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>llvm-dis does not display summaries today, so you can't just use llvm-dis like a "regular" flow.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>How are they inspected today?<br></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>llvm-bcanalyzer? And now the YAML dump as well.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>& also, I think there are test cases that want to/are currently testing summary input but do so somewhat awkwardly by using another tool to produce the summary first. Ideally the test case would have the summary written in to start, I would think, if that's a codepath worth testing?<br></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>The IR already contains all the information, so why repeating it? </div></div></div></div></blockquote><div><br>For the same reason that it's relevant to test cases which way it's encoded, etc (in the same way that the LLVM IR repeats types of uses, for example - even though they're totally redundant from a "does this have all the semantic information required) & because it can be standalone.<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"><div class="gmail_quote"><div>This makes the test case harder to maintain, in the vast majority, I expect that if a test needs IR then it shouldn't need to include a summary as well (and vice-versa).</div></div></div></div></blockquote><div><br>Ah, sorry, I'm not suggesting it should be required - in the same way it's not required in the bitcode. But if you want a summary in the bitcode when assembling a .ll file it seems OK To say you write it in the IR, and equally if there is a summary in the bitcode it seems reasonable that it be printed in the .ll file by llvm-dis.<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"><div class="gmail_quote"><div>In the majority of test we have we want to check if the importing does what it is supposed to do, and if the linkage are correctly adjusted. With a YAML (or other) serialization for the summaries this could indeed been done purely with summaries, without any IR involved.<br></div></div></div></div></blockquote><div><br>I'm not sure I understand - you mean for executions of tools that don't need the rest of the IR, there could be a different/separate tool that consumes YAML summaries and produces YAML summaries and that would be tested - but the "consuming a summary in a bitcode file" would not be?<br><br>I'm not sure I understand the benefit of this separation and asymmetry with the bitcode form of the same data.<br><br>- Dave<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"><div class="gmail_quote"><div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>-- </div><div>Mehdi</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br>- Dave<br> </div><div><div class="m_-203227576041730874gmail-h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><div> -- </div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Mehdi</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">So it seems like that would start with a discussion of what the right end-state would be: What the syntax in textual IR should be, then implementing it. I can understand implementing such a thing in steps - it's perhaps more involved than the COMDAT situation. In that case starting on either side seems fine - implementing the emission first (hidden behind a flag, so as not to break round-tripping in the interim) or the parsing first (no need to hide it behind any flags - manually written examples can be used as input tests).<br><br>(& it sounds like there's some partially implemented functionality using a YAML format that was intended to address how some test cases could be written? & this might be a good basis for the syntax - but seems to me like it might be a bit disjointed/out of place in the textual IR format that's not otherwise YAML-based?)<br><br>- Dave<br><br><div class="gmail_quote"><div><div class="m_-203227576041730874gmail-m_-6875764543502098033m_-4013738782446964300h5"><div dir="ltr">On Fri, Jun 2, 2017 at 8:46 AM Charles Saternos via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="m_-203227576041730874gmail-m_-6875764543502098033m_-4013738782446964300h5"><div dir="ltr">Hey all,<div><br></div><div>Below is the proposed format for the dump of the ThinLTO module summary in the llvm-dis utility:</div><div><br></div><div>> ../build/bin/llvm-dis t.o && cat t.o.ll</div><div><div>; ModuleID = '2.o'</div><div>source_filename = "2.ll"</div><div>target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"</div><div>target triple = "x86_64-unknown-linux-gnu"</div><div><br></div><div>@X = constant i32 42, section "foo", align 4</div><div><br></div><div>@a = weak alias i32, i32* @X</div><div><br></div><div>define void @afun() {</div><div>  %1 = load i32, i32* @a</div><div>  ret void</div><div>}</div><div><br></div><div>define void @testtest() {</div><div>  tail call void @boop()</div><div>  ret void</div><div>}</div><div><br></div><div>declare void @boop()</div><div><br></div><div>; Module summary:</div><div>;  testtest (External linkage)</div><div>;    Function (2 instructions)</div><div>;    Calls: boop</div><div>;  X (External linkage)</div><div>;    Global Variable</div><div>;  afun (External linkage)</div><div>;    Function (2 instructions)</div><div>;    Refs:</div><div>;      a</div><div>;  a (Weak any linkage)</div><div>;    Alias (aliasee X)</div></div><div><br></div><div>I've implemented the above format in the llvm-dis utility, since there currently isn't really a way of getting ThinLTO summaries in a human-readable format.</div><div><br></div><div>Let me know what you think of this format, and what information you think should be added/removed.</div><div><br></div><div>Thanks,</div><div>Charles</div><div><br></div></div></div></div><span>
_______________________________________________<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>
</span></blockquote></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></div></div></blockquote></div></div></div></div>
</blockquote></div></div></div></blockquote></div></div>