<div dir="ltr"><div>For reference, the case with a variable loop count is filed as PR27894:<br><a href="https://llvm.org/bugs/show_bug.cgi?id=27894">https://llvm.org/bugs/show_bug.cgi?id=27894</a><br><br></div>And the case with a constant loop count is filed as PR27899:<br><a href="https://llvm.org/bugs/show_bug.cgi?id=27899">https://llvm.org/bugs/show_bug.cgi?id=27899</a><br> </div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 2, 2016 at 7:48 AM, Demikhovsky, Elena via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><a name="m_-7457908735878148991__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I implemented IV simplification with FP SCEV and uploaded a new patch. The loop bellow is converted to “start+const*N”.<u></u><u></u></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">(You can see the diff between patches to see what was added).
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">
<u></u><span style="font-family:"Calibri",sans-serif;color:#2f5496"><span>-<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span dir="LTR"></span><b><i><span style="color:#2f5496"> Elena<u></u><u></u></span></i></b></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><a name="m_-7457908735878148991______replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <a href="mailto:atrick@apple.com" target="_blank">atrick@apple.com</a> [mailto:<a href="mailto:atrick@apple.com" target="_blank">atrick@apple.com</a>]
<br>
<b>Sent:</b> Monday, May 30, 2016 21:40<br>
<b>To:</b> llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Cc:</b> Demikhovsky, Elena <<a href="mailto:elena.demikhovsky@intel.com" target="_blank">elena.demikhovsky@intel.com</a>>; Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.com</a>><br>
<b>Subject:</b> Floating Point SCEV Analysis<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">My response to this patch is below, but adding a floating-point feature to SCEV should really be hashed out on the llvm-dev list first. I would like to get the attention of floating-point experts on the design review.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I’d like to see a small design proposal justifying the feature and defending it’s soundness. My concern is that the approach may not be sound, but providing this core API would encourage llvm dev’s to use the feature without thinking.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I suggest starting with SCEV’s most basic functionality and proving the validity of increasingly complex cases. Can you defend SCEV’s ability to remove loops like this?<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">float fincby(float start, int N) {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> float result = start;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> for (int i = 0; i < N; ++i) {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> result += 1.0f;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return result;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">}<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">-Andy<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="http://reviews.llvm.org/D20695" target="_blank">http://reviews.llvm.org/D20695</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Begin forwarded message:<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><b><span style="font-family:"Helvetica",sans-serif">From: </span>
</b><span style="font-family:"Helvetica",sans-serif">Andrew Trick via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-family:"Helvetica",sans-serif">Subject: Re: [PATCH] D20695: Floating Point SCEV Analysis</span></b><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-family:"Helvetica",sans-serif">Date: </span>
</b><span style="font-family:"Helvetica",sans-serif">May 30, 2016 at 11:05:35 AM PDT</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-family:"Helvetica",sans-serif">To: </span>
</b><span style="font-family:"Helvetica",sans-serif"><a href="mailto:reviews+D20695+public+faa7820b5ed6aa91@reviews.llvm.org" target="_blank">reviews+D20695+public+faa7820b5ed6aa91@reviews.llvm.org</a></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-family:"Helvetica",sans-serif">Cc: </span>
</b><span style="font-family:"Helvetica",sans-serif"><a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>,
<a href="mailto:mssimpso@codeaurora.org" target="_blank">mssimpso@codeaurora.org</a></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-family:"Helvetica",sans-serif">Reply-To:
</span></b><span style="font-family:"Helvetica",sans-serif">Andrew Trick <<a href="mailto:atrick@apple.com" target="_blank">atrick@apple.com</a>></span><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On May 30, 2016, at 12:02 AM, Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.com</a>> wrote:<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">I have made some minor comments inline, but I still stand by my earlier comment that we should do something like this as a last resort. As an initial step we should at least
evaluate how far we can we can get on relevant workloads without teaching SCEV about floating point values at all.</span><u></u><u></u></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Are there conceivable use cases for this infrastructure beyond vectorizing a small subcategory of loops of this form?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">float x = init;<br>
for (int i=0;i<N;i++){<br>
A[i] = x;<br>
x += fp_inc; // Loop invariant variable or constant<br>
}<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Can the vectorizer handle loops of this form without querying SCEV?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">SCEV expressions have an inherent width. They are not infinite precision. This is the main challenge of working with SCEV expressions, as Sanjoy is well aware. What happens when incrementing a floating-point SCEV expression by a smaller
amount than ULP. Eventually that will happen in a floating-point recurrence. Do we have to prove that floating-point recurrences behave a certain way before we can legally convert them to SCEV expressions?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Honestly, I’m not an expert in floating-point semantics, and I wouldn’t feel comfortable adding this to SCEV without buy-in from someone who is.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Andy<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><u></u><u></u></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited</p>
<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">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><br></div>