This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] implement full reduction "scalarization" across loop nests
ClosedPublic

Authored by aartbik on Nov 2 2021, 8:15 PM.

Details

Summary

The earlier reduction "scalarization" was only applied to a chain of
*innermost* and *for* loops. This revision generalizes this to any
nesting of for- and while-loops. This implies that reductions can be
implemented with a lot less load and store operations. The chaining
is implemented with a forest of yield statements (but not as bad as
when we would also include the while-induction).

Fixes https://bugs.llvm.org/show_bug.cgi?id=52311

Diff Detail

Event Timeline

aartbik created this revision.Nov 2 2021, 8:15 PM
aartbik requested review of this revision.Nov 2 2021, 8:15 PM
aartbik edited the summary of this revision. (Show Details)Nov 2 2021, 8:25 PM
aartbik edited the summary of this revision. (Show Details)
aartbik updated this revision to Diff 384514.Nov 3 2021, 10:36 AM

fixed typo in comment

aartbik updated this revision to Diff 384532.Nov 3 2021, 11:24 AM

rebased against main

aartbik updated this revision to Diff 384576.Nov 3 2021, 1:56 PM

chain SIMD

bixia accepted this revision.Nov 4 2021, 4:58 PM
bixia added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
396

reduction

1266

I wonder whether we can name this better to avoid the confusion. This is the redVal for the loop level whether the if-stmt is, right?

This revision is now accepted and ready to land.Nov 4 2021, 4:58 PM
aartbik updated this revision to Diff 384916.Nov 4 2021, 5:18 PM
aartbik marked 2 inline comments as done.

addressed Bixia's comment, thanks!