[PATCH] D76132: [LoopUnrollAndJam] Changed safety checks to consider more than 2-levels loop nest.

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 08:03:34 PDT 2020


bmahjour added a comment.

> S2(i2,j2,k2) depends on S1(i1,j1,k1) iff i1==i2-1(A[i1] and A[i2-1] access the same element), j1==j2+1, k1==k2-1 and (i1,j1,k1) <=_{lexicographic} (i2,j2,k2), 
>  in other words, the dependence vector is (+1,-1,+1) or (GT,LT,GT) [direction from S1->S2, since S1 is the source and S2 is the consumer].

This is a bit counter intuitive, but a positive dependence direction, is represented as LT (not GT). See section 4.2.1 in //G.G, Ken Kennedy, C.W. Tseng, 1990. Practical Dependence Testing.//
The corresponding direction vector for (+1,-1,+1) is (LT, GT, LT) which would be a lexicographically positive direction vector.

>> I think loop-j is safe to unroll and jam.
>>  However if we only allow GT for loop-i, then this would be consider not safe.
> 
> But the dependency is strictly GT in the first element ?!?

Given that the direction vector is (LT, GT, LT), it follows that only allowing GT will disqualify the above example as an unsafe case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76132/new/

https://reviews.llvm.org/D76132





More information about the llvm-commits mailing list