This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] improved sparse runtime support library
ClosedPublic

Authored by aartbik on Jan 15 2021, 6:18 PM.

Details

Summary

Added the ability to read (an extended version of) the FROSTT
file format, so that we can now read in sparse tensors of arbitrary
rank. Generalized the API to deal with more than two dimensions.

Also added the ability to sort the indices of sparse tensors
lexicographically. This is an important step towards supporting
auto gen of initialization code, since sparse storage formats
are easier to initialize if the indices are sorted. Since most
external formats don't enforce such properties, it is convenient
to have this ability in our runtime support library.

Lastly, the re-entrant problem of the original implementation
is fixed by passing an opaque object around (rather than having
a single static variable, ugh!).

Diff Detail

Event Timeline

aartbik created this revision.Jan 15 2021, 6:18 PM
aartbik requested review of this revision.Jan 15 2021, 6:18 PM
aartbik updated this revision to Diff 317147.Jan 15 2021, 8:12 PM

fixed lint issue

nicolasvasilache accepted this revision.Jan 16 2021, 5:00 AM
This revision is now accepted and ready to land.Jan 16 2021, 5:00 AM
This revision was automatically updated to reflect the committed changes.
mehdi_amini added inline comments.Feb 10 2021, 4:51 PM
mlir/lib/ExecutionEngine/SparseUtils.cpp
141

I find this "uint64_t *idata" quite hard to follow. Can we use C++ types and encapsulation everywhere instead of ad-hoc offset into an opaque pointer here?

aartbik marked an inline comment as done.Feb 10 2021, 7:02 PM
aartbik added inline comments.
mlir/lib/ExecutionEngine/SparseUtils.cpp
141

Yes, this was arguable getting a bit too Fortran /COMMON/ block, right?
I am planning an improvement of this file next anyway, and will include your suggestion.