<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">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.<div class=""><br class=""></div><div class="">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.<div class=""><br class=""></div><div class="">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?<br class=""><div class=""><br class=""></div><div class=""><div class="">float fincby(float start, int N) {</div><div class="">  float result = start;</div><div class="">  for (int i = 0; i < N; ++i) {</div><div class="">    result += 1.0f;</div><div class="">  }</div><div class="">  return result;</div><div class="">}</div><div class=""><br class=""></div><div class="">-Andy<br class=""><div><br class=""></div><div><a href="http://reviews.llvm.org/D20695" class="">http://reviews.llvm.org/D20695</a></div><div><br class=""><blockquote type="cite" class=""><div class="">Begin forwarded message:</div><br class="Apple-interchange-newline"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">From: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Andrew Trick via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Subject: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><b class="">Re: [PATCH] D20695: Floating Point SCEV Analysis</b><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Date: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">May 30, 2016 at 11:05:35 AM PDT<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">To: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><a href="mailto:reviews+D20695+public+faa7820b5ed6aa91@reviews.llvm.org" class="">reviews+D20695+public+faa7820b5ed6aa91@reviews.llvm.org</a><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Cc: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>, <a href="mailto:mssimpso@codeaurora.org" class="">mssimpso@codeaurora.org</a><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Reply-To: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Andrew Trick <<a href="mailto:atrick@apple.com" class="">atrick@apple.com</a>><br class=""></span></div><br class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 30, 2016, at 12:02 AM, Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com" class="">sanjoy@playingwithpointers.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">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><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote></div><br class=""><div class="">Are there conceivable use cases for this infrastructure beyond vectorizing a small subcategory of loops of this form?</div><div class=""><br class=""></div><div class="">float x = init;<br class=""> for (int i=0;i<N;i++){<br class="">   A[i] = x;<br class="">   x += fp_inc; // Loop invariant variable or constant<br class=""> }</div><div class=""><br class=""></div><div class="">Can the vectorizer handle loops of this form without querying SCEV?</div><div class=""><br class=""></div><div class="">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?</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Andy</div></div>_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></div></blockquote></div><br class=""></div></div></div></div></body></html>