This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] generalize sparse storage format to many more types
ClosedPublic

Authored by aartbik on Feb 16 2021, 3:18 PM.

Details

Summary

Rationale:
Narrower types for overhead storage yield a smaller memory footprint for
sparse tensors and thus needs to be supported. Also, more value types
need to be supported to deal with all kinds of kernels. Since the
"one-size-fits-all" sparse storage scheme implementation is used
instead of actual codegen, the library needs to be able to support
all combinations of desired types. With some crafty templating and
overloading, the actual code for this is kept reasonably sized though.

Diff Detail

Event Timeline

aartbik created this revision.Feb 16 2021, 3:18 PM
aartbik requested review of this revision.Feb 16 2021, 3:18 PM
bixia accepted this revision.Feb 17 2021, 2:22 PM

Thanks for your work! It looks good to me and I only have a few minor comments.

mlir/lib/ExecutionEngine/SparseUtils.cpp
77

Adds

84

Sorts

124

Instead of saying "unsupported", would it be more helpful to say something more specific, such as the requested the data type doesn't match how the data is stored in SparseTensorStorage?

159

We probably don't need this until it needs an implementation that is different from what is in the base class.

184–185

The previous word was fine. It is "pointer structure" not "pointers structure". Right?
Alternative, we may want to say "structure with pointers".

206

Similar to the above.

224

This is called sparsity in class SparseTensorStorage. Why don't we call it sparsity here?

This revision is now accepted and ready to land.Feb 17 2021, 2:22 PM
aartbik marked 6 inline comments as done.Feb 17 2021, 4:46 PM

Thanks Bixia!

mlir/lib/ExecutionEngine/SparseUtils.cpp
124

I had that originally, then decided against it, but now I am convinced it is needed again ;-)
Thanks!

aartbik updated this revision to Diff 324466.Feb 17 2021, 4:53 PM
aartbik marked an inline comment as done.

addressed comments

This revision was landed with ongoing or failed builds.Feb 17 2021, 6:20 PM
This revision was automatically updated to reflect the committed changes.