<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><div></div><div><br></div><div><div>On Feb 7, 2013, at 1:42 PM, Nadav Rotem <<a href="mailto:nrotem@apple.com">nrotem@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp</div><div>@@ -3045,7 +3045,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, unsigned VF) {</div><div>     // We mark this instruction as zero-cost because scalar GEPs are usually</div><div>     // lowered to the intruction addressing mode. At the moment we don't</div><div>     // generate vector geps.</div><div>-    return 0;</div><div>+    return TTI.getAddressComputationCost(VectorTy);</div><div>+</div></div><div><br></div><div>We include the cost of GEPs when we calculate the Load/Store costs.   Are you worried about cases where GEPs is not consumed by load/stores ? </div><div><br></div><div>Thanks,</div><div>Nadav</div><div><br></div><div><br></div><br><div><div>On Feb 7, 2013, at 11:32 AM, Renato Golin <<a href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">On 7 February 2013 14:31, Arnold <span dir="ltr"><<a href="mailto:aschwaighofer@apple.com" target="_blank">aschwaighofer@apple.com</a>></span> wrote:<br><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-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="auto" style="word-wrap:break-word"><div class="im">
<div><span style="color:rgb(34,34,34)">I agree with you, it is unfortunate. However, I am trying to model an idiosyncrasy of the processor that has a big implication on performance. It is very expensive on swift if you happen to load into a S register, or D sub lane. Two such instructions are not pipelined but sequentialized.</span></div>
</div></div></blockquote><div><br></div><div style="">In that case, the cost will be much more than 2 or 3, no?</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="auto" style="word-wrap:break-word"><div class="im"><span style="color:rgb(34,34,34)">Stride has the value of the isConsecutivePtr method:</span></div></div></blockquote><div><br></div><div style="">Ok, in the original code you had:</div>
<div style=""><br></div><div style="">if (Stride < 0)</div><div style="">  return parent::cost();</div><div style="">return Cost;</div><div style=""><br></div><div style="">In this you have:</div><div style=""><br></div><div style=""><div>if (Stride > 0)</div>
<div>  return Cost;<br></div><div>return parent::cost();</div><div><br></div><div style="">It seems you're missing the case where it's == 0, but I can't tell which way it should go.</div><div style=""><br>
</div><div style=""><br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="auto" style="word-wrap:break-word">
<div>I don't think we need a function call for the value 3 here. It is a value just like any other that is returned by TTI.<br></div></div></blockquote><div><br></div><div style="">What I'm trying to say is that this value seems to come out of the blue. I could be wrong, obviously, but it seems to me that you're experimenting with a micro-benchmark and fine-tuning to your particular example, which is dangerous on a wider perspective.</div>
<div style=""><br></div><div style="">I understand that this might be a big hit on a set of examples, but we should get some constants out, just to make it clear that we're not talking about "idealized cycle count", but something else entirely.</div>
<div style=""><br></div><div style="">Like:</div><div style=""><br></div><div style="">const int AVOID_AT_ALL_COSTS = 100;</div><div style="">const int DANGEROUS_IN_MOST_CASES = 10;</div><div style="">const int NOT_GOOD_BUT_COULD_BE_OK = 5;</div>
<div style=""><br></div><div style="">etc...</div><div style=""><br></div><div style="">cheers,</div><div style="">--renato</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="auto" style="word-wrap:break-word"><blockquote type="cite">
</blockquote></div></blockquote></div></div></div>
</blockquote></div><br></div></blockquote></div><br></div></body></html>