This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] sparse storage scheme type conversion
ClosedPublic

Authored by aartbik on Aug 31 2022, 1:47 PM.

Details

Summary

This builds a compound type for the buffers required for the sparse storage scheme defined by the MLIR sparse tensor types. The use of a tuple allows for a simple 1:1 type conversion. A subsequent pass can expand this tuple into its component with an isolated 1:N type conversion.

Diff Detail

Event Timeline

aartbik created this revision.Aug 31 2022, 1:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2022, 1:47 PM
aartbik requested review of this revision.Aug 31 2022, 1:47 PM
Peiming added inline comments.Aug 31 2022, 2:02 PM
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
63

Good to see it here!

74

So the permutation is not handled here? I assume that it will be considered later when trying to mapping back from dim => tuple index?

Peiming accepted this revision.Aug 31 2022, 2:03 PM
This revision is now accepted and ready to land.Aug 31 2022, 2:03 PM
aartbik marked an inline comment as done.Aug 31 2022, 2:10 PM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
74

That is right. It may be surprising, but the dimension level types are interpreted *after* applying the reordering (see my comment in this posting: https://discourse.llvm.org/t/sparse-tensors-in-mlir/3389/12). So we can construct the basic type without considering the ordering. However, when filling in the sizes *and* when querying the type, reordering needs to be included. I think I will make some top level utilities for this, so we don't make mistakes in the codegen parts that we will add below.

This revision was automatically updated to reflect the committed changes.
aartbik marked an inline comment as done.