This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] implement singleton dimension level type
ClosedPublic

Authored by aartbik on Sep 16 2022, 6:28 PM.

Details

Summary

This is a first step towards fully implementing the new dimension
level types and properties, illustrating with a fully functional
sorted COO of any dimension. Note that the sparsification part is
pretty complete. The required parts in the runtime support library
have been kept to a minimum, to avoid huge conflicts with Wren's
ongoing refactoring. The missing parts will be filled in later.

Event Timeline

aartbik created this revision.Sep 16 2022, 6:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 6:28 PM
aartbik requested review of this revision.Sep 16 2022, 6:28 PM
Peiming added inline comments.Sep 19 2022, 9:05 AM
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
1390–1391

How about having a merger.isSparseLevel utils?

Peiming added inline comments.Sep 19 2022, 9:15 AM
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
1327–1328

What if you have lo = 0, hi = 1 here for singleton? (to allow the loop unroll opt kicking in later?)

1369

And you do not overwrite the value here. (the pidxs for singleton will become loop invariant, but it is okay because there is no loop actually).

aartbik marked 3 inline comments as done.Sep 19 2022, 10:21 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
1327–1328

Yeah that would be a good way to get the current loop unroller working.

But I also feel we would break the regularity of codegen in sparsification just for the sake of working around a limitation in unrolling. Besides, I have put one of my best people on the task of improving unrolling ;-)

1369

Note that the "loop" could co-iterates with another, and then it remains. I have a CHECK example for that ready in the next revision.

1390–1391

Yeah, good idea, I can also use that for the scan one.
(do you insist of having it in this revision?)

Peiming added inline comments.Sep 19 2022, 11:28 AM
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
1221

I am wondering which one of the followings should we use?

(d0) -> (d0 + 1)
or
()[s0]->(s0 + 1)

aartbik marked 3 inline comments as done.Sep 19 2022, 11:58 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
1221

Waiting to see what feedback you get on https://reviews.llvm.org/D134204

Peiming added inline comments.Sep 19 2022, 1:57 PM
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
1390–1391

No, not really.

Peiming accepted this revision.Sep 19 2022, 2:32 PM
This revision is now accepted and ready to land.Sep 19 2022, 2:32 PM
aartbik updated this revision to Diff 461419.Sep 19 2022, 5:02 PM

rebased with Peiming's unrolling: single loop for COO now!

Holding off landing this revision until Wren's chain of refactoring lands, and I will rebase this then before submitting.

aartbik added inline comments.Sep 20 2022, 12:54 PM
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
1221

Note that I reverted this again to addi over affine apply

aartbik updated this revision to Diff 461666.Sep 20 2022, 12:59 PM

rebased with Peiming's recent change (affine apply -> addi)

aartbik updated this revision to Diff 462053.Sep 21 2022, 5:40 PM

rebase with main

aartbik updated this revision to Diff 462059.Sep 21 2022, 6:27 PM

rebased with main

aartbik updated this revision to Diff 462188.Sep 22 2022, 8:58 AM

rebased with main

aartbik updated this revision to Diff 463369.Sep 27 2022, 4:53 PM

rebased against main

aartbik updated this revision to Diff 464064.Sep 29 2022, 3:21 PM

rebased with main
(note that all changes in support lib for singleton
disappeared since Wren already prefetched them into
the refactored support lib revisions)

This revision was automatically updated to reflect the committed changes.