[PATCH] D76132: [LoopUnrollAndJam] Changed safety checks to consider more than 2-levels loop nest.
Whitney Tsang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 26 10:18:17 PDT 2020
Whitney added a comment.
In D76132#1943966 <https://reviews.llvm.org/D76132#1943966>, @Meinersbur wrote:
> In D76132#1943872 <https://reviews.llvm.org/D76132#1943872>, @Whitney wrote:
>
> > Thanks @Meinersbur ! I mostly used your code directly, except
> >
> > for (unsigned d = 1; d < UnrollLevel; ++d) {
> > // Check if dependence is carried by an outer loop.
> > // That is, changing
> > // (0,>,>,*,*)
> > // to
> > // (0,>,>=,*,*)
> > // will still not violate the dependency.
> > if (D->getDirection(d) == Dependence::DVEntry::GT)
> > return true;
> > }
> >
> >
> > which I think should be safe as long as the one dependence is not EQ then should be safe.
> >
> > for i
> > for j <= unroll loop
> > for k
> > A[i][j][k]
> > A[i-1][j+1][k]
> >
> >
> > Loop-j should be safe to unroll and jam. Am I right?
>
>
> Yes, that's what the cod above would be testing.
My above example was not good.
Consider this example:
for i
for j <= unroll loop
for k
A[i][j][k]
A[i-1][j+1][k-1]
The dependence direction vector would be [LT, GT, LT].
After unroll and jam loop-j:
for i
for j += 2
for k
A[i][j][k]
A[i-1][j+1][k-1]
A[i][j+1][k]
A[i-1][j+2][k-1]
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.
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