This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Add sparse_tensor.select
ClosedPublic

Authored by jim22k on Sep 9 2022, 5:36 AM.

Details

Summary

Add the tablegen definition for a new select operation.
This is used to filter the entries of a sparse tensor via a function
that decides whether each entry should be kept or not.

Diff Detail

Event Timeline

jim22k created this revision.Sep 9 2022, 5:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2022, 5:36 AM
jim22k requested review of this revision.Sep 9 2022, 5:36 AM
jim22k updated this revision to Diff 459559.Sep 12 2022, 2:31 PM

Rebuild; no changes.

jim22k updated this revision to Diff 459573.Sep 12 2022, 3:20 PM

Fix formatting

looks good, few nits

mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
612

evaluation within a linalg.generic operation

622

Can we use e.g. A >= 4.0 just to show the threshold concept (the >= 0 feels still a bit "sparse")

mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
461–481

what happened to the empty test?

jim22k added inline comments.Sep 13 2022, 11:01 AM
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
461–481

I realized this was a copy-paste mistake that came over from binary and unary. Those operations can have empty regions, but reduce cannot. Neither can select. If the region is empty, we want to fail, and verifyNumBlockArgs will give a reasonable failure message in that case.

jim22k updated this revision to Diff 459815.Sep 13 2022, 11:05 AM
jim22k marked 2 inline comments as done.

Update description based on feedback

aartbik accepted this revision.Sep 13 2022, 1:03 PM

Thanks!

This revision is now accepted and ready to land.Sep 13 2022, 1:03 PM
This revision was automatically updated to reflect the committed changes.