This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Add rewriting rules for the sparse_tensor.new operator.
ClosedPublic

Authored by bixia on Oct 11 2022, 9:37 AM.

Diff Detail

Event Timeline

bixia created this revision.Oct 11 2022, 9:37 AM
Herald added a project: Restricted Project. · View Herald Transcript
bixia requested review of this revision.Oct 11 2022, 9:37 AM
aartbik added inline comments.Oct 11 2022, 12:21 PM
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
530

add a comment to this block of code as well, similar to what you show below (e.g. show what you generate in pseudo code)

mlir/test/Dialect/SparseTensor/rewriting_for_codegen.mlir
14–16

Please align code (2 to the left, only indent inside the for loop)

21

Good for now, very functional. I am wondering if later we want to "chunk" the reading so that we have less calling overhead per element?

bixia updated this revision to Diff 466905.Oct 11 2022, 1:48 PM
bixia marked 2 inline comments as done.

Add comment for a code block. Fix test format.

mlir/test/Dialect/SparseTensor/rewriting_for_codegen.mlir
21

Do you mean reading multiple elements at one getSparseTensorReader call?

aartbik accepted this revision.Oct 11 2022, 2:02 PM
aartbik added inline comments.
mlir/test/Dialect/SparseTensor/rewriting_for_codegen.mlir
21

Yeah, not for now, but just amortizing the overhead of each method call by simply reading in a chunk of elements (and returning the number of items read for example. That would require a value buffer too then. But just thoughts for later....

This revision is now accepted and ready to land.Oct 11 2022, 2:02 PM
bixia updated this revision to Diff 466930.Oct 11 2022, 2:47 PM

Rebase.