[Polly] Isl AST reduction pragmas [V2]

Tobias Grosser tobias at grosser.es
Thu Jun 19 02:16:50 PDT 2014


On 19/06/2014 08:17, Johannes Doerfert wrote:
> What exactly is the problem if we dont takle this case?
>
> In my opinion:
> Sequential codegen:
>    - Nothing will change since we don't care about reduction dependences anyway
> Parallel codegen:
>    - We might think we broke reduction dependences even if we didn't... the
>      result will be redundant privatization which is only a performance concern.
>      [we actually don't have one since we don't have privatizations yet].
> Am I wrong?

There may be a test case (I did not create one), where the scheduler
decides for whatever reason to transform the code from:

for(i = 0; i < n; i++
S1:  A[0] +=

to:

for(i = 0; i < n; i+=2
S1a:  A[0] +=


for(i = 1; i < n; i+=2
S1b:  A[0] +=

In this case, there will be no loop carried dependences any more, as 
dependences now go always back and forth between S1a and S2b. So we may 
incorrectly detect the new loops as parallel.

I admit that the scheduler may most likely not take this very specific 
scheduling decision, but for more complicated access functions and loop 
structures certain reduction iterations may be split of, such that there 
are no loop carried dependences any more. If this happens, figuring out 
this happened due to incorrect reduction dependences will be hard. So 
let's better get it right the first time.

Tobias



More information about the llvm-commits mailing list