This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Split SparseTensorRewrite into PreSparsificationRewrite and PostSparsificationRewrite.
ClosedPublic

Authored by bixia on Nov 16 2022, 1:53 PM.

Diff Detail

Event Timeline

bixia created this revision.Nov 16 2022, 1:53 PM
Herald added a project: Restricted Project. · View Herald Transcript
bixia requested review of this revision.Nov 16 2022, 1:53 PM
bixia updated this revision to Diff 475929.Nov 16 2022, 3:00 PM

Rename the two passes.

bixia retitled this revision from [mlir][sparse] Split SparseTensorRewrite into SparseTensorPreRewrite and SparseTensorPostRewrite. to [mlir][sparse] Split SparseTensorRewrite into PreSparsificationRewrite and PostSparsificationRewrite..Nov 16 2022, 3:01 PM
bixia added a reviewer: Peiming.
wrengr added inline comments.Nov 16 2022, 3:18 PM
mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
62

I know this is just mimicking what was there before, but: why don't we pass the other boolean arguments too?

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
86–90

Would be better to rephrase this as PostSparsificationRewritePass(bool enableRuntimeLibrary, bool enableForeach, bool enableConvert) : enableRuntimeLibrary(enableRuntimeLibrary), enableForeach(enableForeach), enableConvert(enableConvert) {}

wrengr accepted this revision.Nov 16 2022, 3:34 PM
This revision is now accepted and ready to land.Nov 16 2022, 3:34 PM
aartbik accepted this revision.Nov 16 2022, 3:59 PM
aartbik added inline comments.
mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
158

I liked the original layout better, but I guess this is clang formatter?

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
1024–1034

empty line after big header section

wrengr added inline comments.Nov 16 2022, 4:01 PM
mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
158

If it's a big deal, then you can always add // NOLINT just before newlines you want git-clang-format to leave alone. (Though it's best to only do that sparingly, of course)

bixia marked an inline comment as done.Nov 16 2022, 4:02 PM
bixia added inline comments.
mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
158

Right, that was auto formatted.

mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
62

The other two booleans are for testing, disabling rewriting for two ops to simplify FileCheck.
In the real compile pass pipeline, we should never disable these two ops.

bixia updated this revision to Diff 475955.Nov 16 2022, 4:29 PM
bixia marked an inline comment as done and an inline comment as not done.

Address review comment.

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
86–90

Per offline discussion, this syntax doesn't work.