parallel loop awareness to the LoopVectorizer

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

parallel loop awareness to the LoopVectorizer

Preston Briggs
About these disclaimers associated with ivdep and such...
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.

For example

len = 0;
while (A[i]) {

Assert all you want; the compiler won't parallelize the loop, and a good thing too.


> From: "Pekka Jääskeläinen" <[hidden email]>
> To: "Hal Finkel" <[hidden email]>
> Cc: "Nadav Rotem" <[hidden email]>, "LLVM Developers Mailing List" <[hidden email]>
> Sent: Monday, January 28, 2013 11:36:21 AM
> Subject: Re: [LLVMdev] [PATCH] parallel loop awareness to the LoopVectorizer
> On 01/28/2013 06:51 PM, Hal Finkel wrote:
> > Is this sufficient to implement #pragma ivdep in clang?
> I'm not completely sure of this:
> "Note: The proven dependencies that prevent vectorization are not
> ignored,
> only assumed dependencies are ignored."
> Thus, there's a slight difference. It cannot be used to disable
> dependency
> checking altogether (and just blame a sloppy programmer if there
> actually
> are dependencies), but it just converts the "unknown alias" to "no
> alias".
> If there's a "yes" from the analyzer it still prevents the
> vectorization.
> So, sort of a softened programmer-friendlier version of the
> semantics.
> The vagueness comes from that it depends on the intelligence
> of the dependency analysis implementation whether a dependency can be
> "proven"
> or not, doesn't it? Thus, #pragma ivdep with a non-existing
> loop dependence analyzer is equivalent to the semantics of the
> proposed
> metadata.

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.

> Also, it's a bit unclear what is the real difference to the #pragma
> parallel:
> It similarly states: "However, if dependencies are proven, they are
> not
> ignored." So conversely, if the compiler cannot prove a dependency
> for
> some reason, they *are* ignored?


> OpenMP's 'omp for', on the other hand, can be used to mark a truly
> parallel
> loop where this metadata could be used if one wants to parallelize
> those
> loops using a finer-granularity mechanism than threads.

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.

LLVM Developers mailing list
[hidden email]