This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] implement lowering rules for sparse_tensor.pack operation
ClosedPublic

Authored by Peiming on Feb 2 2023, 4:28 PM.

Diff Detail

Event Timeline

Peiming created this revision.Feb 2 2023, 4:28 PM
Herald added a project: Restricted Project. · View Herald Transcript
Peiming requested review of this revision.Feb 2 2023, 4:28 PM
aartbik added inline comments.Feb 3 2023, 10:50 AM
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
180–182

Don't we have utils for this in CodegenUtils? we should really use those,and move the enableInit there.
Also, I have to look below why you want stack allocation vs. heap here....

1051

is it not very unsafe to stack allocate here? will the scope be sufficient for the lifetime of the tensor

but yeah, we have a problem here, since we use the external allocated data for anything else....

1104

period at end

Peiming updated this revision to Diff 494719.Feb 3 2023, 1:41 PM

use constant for the first COO compressed lvl

Peiming updated this revision to Diff 494725.Feb 3 2023, 1:59 PM

remove outdated comments.

Peiming updated this revision to Diff 494743.Feb 3 2023, 2:43 PM

clean up code.

Peiming marked 3 inline comments as done.Feb 3 2023, 2:44 PM
aartbik accepted this revision.Feb 3 2023, 3:45 PM
aartbik added inline comments.
mlir/test/Dialect/SparseTensor/sparse_pack.mlir
16

Oh, this is beautiful!

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_pack.mlir
36

80-col

This revision is now accepted and ready to land.Feb 3 2023, 3:45 PM
Peiming updated this revision to Diff 494766.Feb 3 2023, 3:50 PM

fix test into 80col

Peiming marked an inline comment as done.Feb 3 2023, 3:50 PM
This revision was landed with ongoing or failed builds.Feb 3 2023, 3:51 PM
This revision was automatically updated to reflect the committed changes.
bixia added a subscriber: bixia.Feb 6 2023, 9:15 AM
bixia added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
1072–1073

The shape of the indices tensor is (nnz, rank), not the shape of the destination tensor. Am I right here?

bixia added inline comments.Feb 6 2023, 9:21 AM
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
1072–1073

I see, tensorType is the indices tensor type.