<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">Hi,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">> The problem I see is that the warning isn't very actionable. </span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">Fully agreed. </span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">> Good </span><span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">warnings
are supposed to be actionable, but what is the developer </span><span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">supposed to do in this case? </span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">This diagnostic is unclear. But to be more precise, the first part says the optimisation
could not be performed. This is spot on, and an improvement of what we had before because that didn't issue any diagnostic at all, so one could falsely be under the impression the transformation had actually been applied.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">The second part of the diagnostic, the suggestion is unclear / is not applicable. This needs
fixing. </span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">The "workaround" is that extra optimisation remarks can be requested, that will tell in more
detail what and what didn't happen.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">> The code looks perfectly set up for </span><span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">vectorization,
but the compiler doesn't </span><span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0);">vectorize. What's the fix for </span><span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0);">the
code?</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">Not a strong argument but this is perhaps a bit of an edge case because this is vectorisation with -Oz; this problem
won't appear (or it will less) with higher opt levels. In this particular case, as Florian mentiond, it's looprotate not doing something. But forgetting this for a moment, a</span><span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0);">s
I also mentioned earlier, I think there are a few things that are orthogonal to this particular change:</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<ul>
<li><span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">diagnostics can be improved (what Hal and Michael brought up and discussed)</span></li><li><span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">the vectoriser can be made a bit smarter (or looprotate, as Florian mentioned, and someone is working on that)</span></li></ul>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">> </span><span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">Another
question is what we should do at -O0, because there I think </span><span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">we still don't warn.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; background-color: rgba(0, 0, 0, 0); display: inline !important;">I will look into this. I was hoping we would issue exactly the same warning, which in this
case would be correct: the transformation didn't run.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">Cheers,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">Sjoerd.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br style="color: rgb(32, 31, 30); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; background-color: rgb(255, 255, 255)">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Hans Wennborg <hans@chromium.org><br>
<b>Sent:</b> 07 October 2019 09:13<br>
<b>To:</b> Sjoerd Meijer <Sjoerd.Meijer@arm.com><br>
<b>Cc:</b> Michael Kruse <llvmdev@meinersbur.de>; Finkel, Hal J. <hfinkel@anl.gov>; llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org>; Kruse, Michael <michael.kruse@anl.gov>; hans@hanshq.net <hans@hanshq.net><br>
<b>Subject:</b> Re: [llvm-dev] vectorize.enable</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Sorry for coming late to this thread, I was out a few days.<br>
<br>
I wasn't familiar with this pragma before, but if the intended meaning<br>
is indeed "vectorize this" and not "if vectorizing, use this width",<br>
then the change makes sense.<br>
<br>
The problem I see is that the warning isn't very actionable. Good<br>
warnings are supposed to be actionable, but what is the developer<br>
supposed to do in this case? The code looks perfectly set up for<br>
vectorization, but the compiler doesn't vectorize. What's the fix for<br>
the code?<br>
<br>
I think the thread mentioned that someone was working on fixing the<br>
vectorization for this case. Maybe we should wait for that?<br>
<br>
(Another question is what we should do at -O0, because there I think<br>
we still don't warn. Does that mean the pragma doesn't have the same<br>
meaning at -O0?)<br>
<br>
Thanks,<br>
Hans<br>
<br>
On Fri, Oct 4, 2019 at 4:28 PM Sjoerd Meijer via llvm-dev<br>
<llvm-dev@lists.llvm.org> wrote:<br>
><br>
> Thanks for your replies. That was a very useful discussion.<br>
> I won't recommit on a Friday afternoon, but will do on Monday, as it looks like we agreed again on the direction and the change.<br>
> Orthogonal to this change, the interesting topics brought up are improved diagnostics, and the cases the vectoriser misses. I will briefly look why this particular case isn't vectorised, but I suspect that it's a simple case of some prep / clean-up passes
not running at Oz.<br>
><br>
> Cheers,<br>
> Sjoerd.<br>
> ________________________________<br>
> From: llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Finkel, Hal J. via llvm-dev <llvm-dev@lists.llvm.org><br>
> Sent: 03 October 2019 00:18<br>
> To: Michael Kruse <llvmdev@meinersbur.de><br>
> Cc: llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org>; Kruse, Michael <michael.kruse@anl.gov>; hans@hanshq.net <hans@hanshq.net><br>
> Subject: Re: [llvm-dev] vectorize.enable<br>
><br>
> On 10/2/19 5:31 PM, Michael Kruse wrote:<br>
> > Am Mi., 2. Okt. 2019 um 15:56 Uhr schrieb Finkel, Hal J. <hfinkel@anl.gov>:<br>
> >>> It's done by the WarnMissedTransformation and just looks for<br>
> >>> transformation metadata that is still in the IR after all passes that<br>
> >>> should have transformed them have ran. That is, it does not know why<br>
> >>> it is still there -- it could be because the LoopVectorize pass is not<br>
> >>> even in the pipeline -- and we cannot be more specific in the message.<br>
> >>> However, -Rpass-missed=loop-vectorize may give more information.<br>
> >> As I recall, there is some trade-off here because it's hard for a<br>
> >> transformation to know that it's last - either the last run of that<br>
> >> particular transformation in the pipeline or the last transformation in<br>
> >> the pipeline that can service a particular transformation request (and<br>
> >> this is especially true if there are multiple, separated pipelines<br>
> >> involved, such as in LTO). This is why we did not have transformations<br>
> >> warn if they can't perform the requested transformation for structural<br>
> >> reasons - maybe they will be able to later. However, we also should<br>
> >> improve the diagnostics in these cases.<br>
> > This was not the only consideration. With ordered transformations,<br>
> > such as vectorize after unroll-and-jam, the LoopVectorize does not<br>
> > even have a chance to analyze the code since it is located after the<br>
> > LoopUnrollAndJam pass. We would still warn that vectorization has not<br>
> > been performed.<br>
> ><br>
> ><br>
> >> I recommend that we consider taking a kind of delayed-diagnostic<br>
> >> approach. When a pass cannot perform the requested transformation, it<br>
> >> records some rationale into the metadata. That rationale can be reported<br>
> >> by WarnMissedTransformation, if available, to make the diagnostic more<br>
> >> helpful. If the transformation is later actually performed, then the<br>
> >> extra information is discarded along with the transformation metadata<br>
> >> itself.<br>
> > I like the idea, but I am not sure how helpful are messages such as<br>
> > "The exiting block is not the loop latch" or "Cannot identify array<br>
> > bounds" are to the end user. It would still be an improvement.<br>
><br>
><br>
> It probably wouldn't be, but might encourage some more-useful bug reports.<br>
><br>
><br>
> ><br>
> > If there is no diagnostic metadata, do we keep emitting the current<br>
> > message?<br>
><br>
><br>
> That was my thought. If we don't know anything else, just keep doing<br>
> what we're doing.<br>
><br>
><br>
> > If there already is an explanation metadata, does the new one<br>
> > override the old one or is it appended?<br>
><br>
><br>
> Lacking data, I'll say append (because why throw away information?), but<br>
> only print the last one by default (because, for example, if a pass runs<br>
> multiple times, what I probably care about it why it couldn't perform<br>
> the transformation during the last run, not the previous times when the<br>
> IR might have been in a less-optimizable state) - that's probably less<br>
> confusing.<br>
><br>
><br>
> ><br>
> > We could also just a hint to the diagnostic such as<br>
> > "-Rpass=loop-vectorize may provide more information".<br>
><br>
><br>
> Agreed. That is probably the easiest thing, and might be the most useful<br>
> as well. We just need a bit in the metadata to provide some information<br>
> on whether the transformation was attempted but failed.<br>
><br>
> -Hal<br>
><br>
><br>
> ><br>
> > Michael<br>
><br>
> --<br>
> Hal Finkel<br>
> Lead, Compiler Technology and Programming Languages<br>
> Leadership Computing Facility<br>
> Argonne National Laboratory<br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> llvm-dev@lists.llvm.org<br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> llvm-dev@lists.llvm.org<br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</div>
</span></font></div>
</body>
</html>