This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] add affine subscripts to sparse compilation pass
ClosedPublic

Authored by aartbik on Sep 14 2021, 1:42 PM.

Details

Summary

This enables the sparsification of more kernels, such as convolutions
where there is a x(i+j) subscript. It also enables more tensor invariants
such as x(1) or other affine subscripts such as x(i+1). Currently, we
reject sparsity altogether for such tensors. Despite this restriction,
however, we can already handle a lot more kernels with compound subscripts
for dense access (viz. convolution with dense input and sparse filter).
Some unit tests and an integration test demonstrate new capability.

Diff Detail

Event Timeline

aartbik created this revision.Sep 14 2021, 1:42 PM
aartbik requested review of this revision.Sep 14 2021, 1:42 PM
bixia accepted this revision.Sep 14 2021, 11:06 PM
bixia added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
133

It looks to me that the routine returns false if there is any Affine that can't be handled, and returns true if all Affines can be handled. Am I right?

478–479

This routine currently generates Affine for unannotated tensor only.
Shall we document this and/or rename the routine to make this explicit?

516–518

Can we add a comment here that says we currently only support direct indexing Affine for annotated tensors?

704

s/Determine/Determines/

705

This can be a const reference. Right?

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_filter_conv2d.mlir
25

TENSOR0 is not needed?

This revision is now accepted and ready to land.Sep 14 2021, 11:06 PM
aartbik marked 5 inline comments as done.Sep 15 2021, 2:48 PM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
133

Yes, added more text to doc.

478–479

added TODO (I don't want to rename later)

aartbik updated this revision to Diff 372823.Sep 15 2021, 3:42 PM
aartbik marked 2 inline comments as done.

addressed comments

aartbik marked an inline comment as done.Sep 15 2021, 6:47 PM
aartbik added inline comments.
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_filter_conv2d.mlir
25

sharp eye!

aartbik updated this revision to Diff 372851.Sep 15 2021, 6:52 PM
aartbik marked an inline comment as done.

removed obsolete TENSOR def