<div dir="ltr">Hi All,<div><br></div><div>One particularly interesting case would be to allow user specify the maximum vector length - such number of iterations that user knows there is no loop-carried dependence with less than that number - and then let vectorizer choose any width/unroll combination based on its heuristics and target information.</div>
<div><br></div><div>omp simd's 'safelen' clause would specify such number, and probably it would be useful to have such ability with #pragma vectorize as well. In our github implementation we currently only set 'width' to the 'safelen' value.</div>
<div><br></div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-22 20:34 GMT+04:00 Nadav Rotem <span dir="ltr"><<a href="mailto:nrotem@apple.com" target="_blank">nrotem@apple.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Hal, <div><br></div><div>Thanks for the review and for your support of this feature. </div>
<div><br><div><div class=""><blockquote type="cite"><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
I feel strongly that we should separate the unrolling pragma from the vectorization pragma. The fact that modulo unrolling is implemented by our loop vectorizer is an implementation detail that I do not want to expose to our users directly.</div>
</blockquote><div><br></div></div><div>I think that the name ‘unroll’ is misleading because what the vectorizer does is not the usual loop unrolling. The vectorizer uses two or more SIMD registers to perform the widened scalar operations. I would like to allow users to control this special kind of unrolling within the vectorization pragma.  Maybe we should give it a different name, like ‘widen’ ?</div>
<div><div class="h5"><div><br></div><blockquote type="cite"><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
 Also, we have a concatenation unroller which performs unrolling separate from the vectorizer. I think we should do something like this:<br><br>1. For the purpose of this patch, please split off the unrolling into a separate pragma:<br>
   #pragma unroll(_value_ | enable | disable)<br><br>2. In the future, this syntax will be enhanced to something like this:<br>   #pragma unroll(unroll-spec-list)<br><br>   unroll-spec-list:<br>    kind_prefix_opt unroll-spec<br>
<br>   unroll-spec:<br>     _value_<br>     enable<br>     disable<br><br>   kind_prefix:<br>     kind :<br><br>   kind:<br>     sequenced :<br>     unsequenced :<br>     any :<br><br>[this sequenced vs unsequenced terminology is what we decided we liked for the parallel algorithms library being considered in WG21, and I think it applies just as well here]<br>
<br>In our implementation, 'unsequenced' unrolling means the modulo unrolling performed by the loop vectorizer. 'sequenced' unrolling means the concatenation unrolling performed by the generic unroller.<br>
<br>Adding Chandler, he might have some opinion on my use of the sequenced vs. unsequenced suggestion.<br><br>Also, adding Alexey and Alexander who have done some similar work in clang-omp.<br><br>-Hal<br><br>----- Original Message -----<br>
<blockquote type="cite">From: "Tyler Nowicki" <<a href="mailto:tnowicki@apple.com" target="_blank">tnowicki@apple.com</a>><br>To:<span> </span><a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
Cc: "Nadav Rotem" <<a href="mailto:nrotem@apple.com" target="_blank">nrotem@apple.com</a>><br>Sent: Monday, April 21, 2014 6:23:02 PM<br>Subject: [PATCH] #pragma vectorize<br><br><br><br>Hi,<br><br>Please review the attached patch for adding pragma vectorize syntax /<br>
vectorization hints to clang.<br><br>pragma vectorize<br>* supports the options enable, disable, unroll(_value_), and<br>width(_value_)<br>* options are turned into vectorization hints that are used during<br>codegen to add metadata to the conditional branch of the for, while,<br>
and do-while loops.<br>* enable forces the vectorizer to consider the loop, for example when<br>compiling with Os<br>* disable prevents vectorization of the loop<br>* The _value_ specified by unroll(_value_) and width(_value_) must be<br>
a positive integer. It will be used to set the<br>llvm.vectorizer.unroll or llvm.vectorizer.width metadata values.<br><br>Thank you,<br><br>Tyler Nowicki<br>Apple<br><br><br><br>_______________________________________________<br>
cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote><br>--<span> </span><br>Hal Finkel<br>Assistant Computational Scientist<br>Leadership Computing Facility<br>Argonne National Laboratory</div></blockquote></div></div></div><br></div></div></blockquote></div>
<br><br clear="all"><div><br></div>-- <br>Best regards,<br>Alexander Musman<br>+79154687051<br>skype: alexander.musman<br><div><br></div>
</div></div>