This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Add SparseTensorStorageExpansion Pass to expand compounded sparse tensor tuples
ClosedPublic

Authored by Peiming on Sep 1 2022, 10:18 AM.

Details

Summary

This patch adds SparseTensorStorageExpansion pass, it flattens the tuple used to store a sparse
tensor handle.

Right now, it only set up the skeleton for the pass, more lowering rules for sparse tensor storage
operation need to be added.

Diff Detail

Event Timeline

Peiming created this revision.Sep 1 2022, 10:18 AM
Herald added a project: Restricted Project. · View Herald Transcript
Peiming requested review of this revision.Sep 1 2022, 10:18 AM
Peiming updated this revision to Diff 457315.Sep 1 2022, 10:21 AM

add missing period in comments...

very good progress!

mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
154

period at end here too

160

can you break the multi line a bit

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
162

I had a fix for that in my revision that looks a bit more idiomatic

197

I definitely like having this as a new pass for the time being, since it nicely progressively lowers and can be tested in isolation!

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorStorageExpansion.cpp
10

nested -> compound?

mlir/test/Dialect/SparseTensor/sparse_tensor_storage.mlir
10

can you indent so that the tuples "line up"?

12

can you also add a call to this test already?

aartbik added inline comments.Sep 1 2022, 1:35 PM
mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
152

One complication is that we actually expand all tuples, not just storage formats. I don't think that is an immediate problem, since tuples seem mostly unused. But for safety perhaps we should indeed consider having our own extension of tuple as a sparse_storage_tuple or so, so that we only rewrite what we introduced....

Peiming updated this revision to Diff 457391.Sep 1 2022, 2:02 PM
Peiming marked 7 inline comments as done.

address comments from Aart

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
162

Reverted!

mlir/test/Dialect/SparseTensor/sparse_tensor_storage.mlir
12

Not yet.

aartbik accepted this revision.Sep 1 2022, 3:21 PM

Few last comments, please address, but good to merge in.

mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
168

This comment seems copy and paste? How about

/// Sparse tensor type converter from compound to expanded form.

Or something like that.

174

Similar

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
161

maybe remove 161 as well to avoid merge conflicts now

This revision is now accepted and ready to land.Sep 1 2022, 3:21 PM
Peiming updated this revision to Diff 457424.Sep 1 2022, 3:28 PM
Peiming marked 3 inline comments as done.

address comments from Aart

This revision was landed with ongoing or failed builds.Sep 1 2022, 3:47 PM
This revision was automatically updated to reflect the committed changes.