[Polly] Isl AST reduction pragmas [V2]

Johannes Doerfert jdoerfert at codeaurora.org
Wed Jun 18 23:17:13 PDT 2014


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?

Anyway, I'll obviously add your test case.

Best regards,
  Johannes

On 06/19, Tobias Grosser wrote:
> On 19/06/2014 03:00, Johannes Doerfert wrote:
> >Hey Tobi,
> >
> >I cannot come up with a test case which contains a reduction and will be
> >inverted.
> >
> >I tried combinations of loop nest similar to your example, but no luck so
> >far.
> >Handling this case would be a nice improvement, but do we need it right now
> >or can we go with the simpler solution which is slightly less general?
> 
> void foo(float *A, long n) {
> 
>         for (long i = 0; i < n; i++)
>                 A[i] = 1;
>         for (long i = 0; i < 2*n; i++)
>                 A[2*n-i-1] += 1;
> }
> 
> Compiled with polly-clang /tmp/test.c -mllvm -polly -O3 -mllvm
> -debug-only=polly-cloog -c -mllvm -polly-opt-fusion=max yields:
> 
> :: foo : entry.split => for.end10
> if (n >= 1) {
>   for (c1=1;c1<=n;c1++) {
>     Stmt_for_body((c1-1));
>     Stmt_for_body4((-c1+2*n));
>   }
>   for (c1=n+1;c1<=2*n;c1++) {
>     Stmt_for_body4((-c1+2*n));
>   }
> }
> 
> The second loop nest will now have negative reduction dependences, no?
> 
> As dependences are generally supposed to be positive, I believe it is an
> issue that a simple test may introduce negative dependences. So we either
> need to convince ourselves that negative dependences will never ever cause
> any issue, or we just adjust/recompute them after computing a new schedule.
> I believe the second option is easier for now.
> 
> Tobias
> 
> Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140618/c6abf70a/attachment.sig>


More information about the llvm-commits mailing list