<div dir="ltr">About these disclaimers associated with ivdep and such...<div>You guys are overthinking it. They're just saying you cannot force the compiler to vectorize or parallelize a loop that it knows (can prove!) is not a parallel loop. They are not obliging the compiler to do dependence analysis or alias analysis or anything.<div>
<br></div><div>For example</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style>len = 0;</div><div style>while (A[i]) {</div><div style>  i++;</div><div style>  len++;</div><div style>
}  </div></blockquote><div><div class="gmail_extra"><br></div><div class="gmail_extra">Assert all you want; the compiler won't parallelize the loop, and a good thing too.<br><br>Preston</div><div class="gmail_extra"><br>
<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> From: "Pekka Jääskeläinen" <<a href="mailto:pekka.jaaskelainen@tut.fi">pekka.jaaskelainen@tut.fi</a>><br>
> To: "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>><br>
> Cc: "Nadav Rotem" <<a href="mailto:nrotem@apple.com">nrotem@apple.com</a>>, "LLVM Developers Mailing List" <<a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a>><br>
> Sent: Monday, January 28, 2013 11:36:21 AM<br>
> Subject: Re: [LLVMdev] [PATCH] parallel loop awareness to the LoopVectorizer<br>
><br>
> On 01/28/2013 06:51 PM, Hal Finkel wrote:<br>
> > Is this sufficient to implement #pragma ivdep in clang?<br>
><br>
> I'm not completely sure of this:<br>
><br>
> "Note: The proven dependencies that prevent vectorization are not<br>
> ignored,<br>
> only assumed dependencies are ignored."<br>
><br>
> <a href="http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/cref_cls/common/cppref_pragma_ivdep.htm" target="_blank">http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/cref_cls/common/cppref_pragma_ivdep.htm</a><br>

><br>
> Thus, there's a slight difference. It cannot be used to disable<br>
> dependency<br>
> checking altogether (and just blame a sloppy programmer if there<br>
> actually<br>
> are dependencies), but it just converts the "unknown alias" to "no<br>
> alias".<br>
> If there's a "yes" from the analyzer it still prevents the<br>
> vectorization.<br>
> So, sort of a softened programmer-friendlier version of the<br>
> semantics.<br>
><br>
> The vagueness comes from that it depends on the intelligence<br>
> of the dependency analysis implementation whether a dependency can be<br>
> "proven"<br>
> or not, doesn't it? Thus, #pragma ivdep with a non-existing<br>
> loop dependence analyzer is equivalent to the semantics of the<br>
> proposed<br>
> metadata.<br>
<br>
And the user has no way of knowing which dependencies are proven and which are assumed, right? It seems like the user just needs to assume that nothing is proven ;) Nevertheless, based on this, we probably do need something with slightly weaker semantics for ivdep.<br>

<br>
><br>
> Also, it's a bit unclear what is the real difference to the #pragma<br>
> parallel:<br>
> <a href="http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/cref_cls/common/cppref_pragma_parallel.htm" target="_blank">http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/cref_cls/common/cppref_pragma_parallel.htm</a><br>

><br>
> It similarly states: "However, if dependencies are proven, they are<br>
> not<br>
> ignored." So conversely, if the compiler cannot prove a dependency<br>
> for<br>
> some reason, they *are* ignored?<br>
<br>
Interesting.<br>
<br>
><br>
> OpenMP's 'omp for', on the other hand, can be used to mark a truly<br>
> parallel<br>
> loop where this metadata could be used if one wants to parallelize<br>
> those<br>
> loops using a finer-granularity mechanism than threads.<br>
<br>
Agreed; we should make sure to incorporate this into the upcoming OpenMP support. The loops will be outlined, but the outlined pieces can then be marked with this 'parallel' metadata.<br></blockquote><div> </div>
</div></div></div></div></div>