This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] add support for std unary operations
ClosedPublic

Authored by aartbik on Jul 13 2021, 12:32 PM.

Details

Summary

Adds zero-preserving unary operators from std. Also adds xor.
Performs minor refactoring to remove "zero" node, and pushed
the irregular logic for negi (not support in std) into one place.

Diff Detail

Event Timeline

aartbik created this revision.Jul 13 2021, 12:32 PM
aartbik requested review of this revision.Jul 13 2021, 12:32 PM

Comments/questions, but otherwise this looks good!

mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h
108

Why remove the default here? It seems like in the kInvariant case, we'll now explicitly need to set e0 to -1u; is that true?

137–140

I think this should read "Maps the unary operator over the lattice set..." rather than the other way around!

aartbik marked 2 inline comments as done.Jul 13 2021, 2:00 PM
aartbik added inline comments.
mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h
108

No, the invariant case uses the addExp define on the next line. I needed the default for kZero (no operands), but now I just need the one ops or two ops cases, so first is always set.

137–140

Changed!

aartbik updated this revision to Diff 358424.Jul 13 2021, 2:04 PM
aartbik marked 2 inline comments as done.

changed comment

gussmith23 accepted this revision.Jul 13 2021, 2:10 PM
This revision is now accepted and ready to land.Jul 13 2021, 2:10 PM
This revision was landed with ongoing or failed builds.Jul 13 2021, 2:51 PM
This revision was automatically updated to reflect the committed changes.