This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] add restrictive versions of division support
ClosedPublic

Authored by aartbik on Jul 9 2021, 1:53 PM.

Details

Summary

Right now, we only accept x/c with nonzero c, since this
conceptually can be treated as a x*(1/c) conjunction for both
FP and INT as far as lattice computations go. The codegen
keeps the division though to preserve precise semantics.

See discussion:
https://llvm.discourse.group/t/sparse-tensors-in-mlir/3389/28

Diff Detail

Event Timeline

aartbik created this revision.Jul 9 2021, 1:53 PM
aartbik requested review of this revision.Jul 9 2021, 1:53 PM
aartbik updated this revision to Diff 357638.Jul 9 2021, 2:20 PM

extra table

aartbik updated this revision to Diff 357694.Jul 9 2021, 9:02 PM

more compact if

gussmith23 added inline comments.Jul 12 2021, 2:28 PM
mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
338

Out of curiosity, any reason for the brackets here when you don't have them on the kMulI/kMulF cases?

mlir/test/Dialect/SparseTensor/sparse_int_ops.mlir
249

Is it possible to test the situations where we can't prove that the denominator is zero, and thus code can't be generated? At first I thought that could go in invalid.mlir, but it doesn't seem like that would be the right place.

aartbik marked 2 inline comments as done.Jul 12 2021, 2:33 PM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
338

ah, left over from when I had a local. Thanks. Removed!

mlir/test/Dialect/SparseTensor/sparse_int_ops.mlir
249

Not easy with the CHECK, but it will become possible with your unit test!

aartbik updated this revision to Diff 358071.Jul 12 2021, 2:38 PM
aartbik marked 2 inline comments as done.

removed braces

gussmith23 accepted this revision.Jul 12 2021, 2:42 PM

This looks good to me!

This revision is now accepted and ready to land.Jul 12 2021, 2:42 PM
This revision was landed with ongoing or failed builds.Jul 12 2021, 3:00 PM
This revision was automatically updated to reflect the committed changes.