This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] add convenience method for sparse tensor setup
ClosedPublic

Authored by aartbik on Sep 3 2021, 11:45 AM.

Details

Summary

This simplifies setting up sparse tensors through C-style data structures.
Useful for runtimes that want to interact with MLIR-generated code
without knowning about all bufferization details (viz. memrefs).

Diff Detail

Event Timeline

aartbik created this revision.Sep 3 2021, 11:45 AM
aartbik requested review of this revision.Sep 3 2021, 11:45 AM
bixia accepted this revision.Sep 3 2021, 12:13 PM
bixia added inline comments.
mlir/lib/ExecutionEngine/SparseUtils.cpp
729–734

NIT: this is the same as:
std::vector<uint8_t> sparse(rank, SparseTensorStorageBase::kCompressed)
std::vector<unit64_t> perm(rank);
std::iota(perm.begin(), perm.end(), 0);

This revision is now accepted and ready to land.Sep 3 2021, 12:13 PM
aartbik marked an inline comment as done.Sep 3 2021, 12:29 PM
aartbik added inline comments.
mlir/lib/ExecutionEngine/SparseUtils.cpp
729–734

Clever!

aartbik updated this revision to Diff 370648.Sep 3 2021, 12:30 PM
aartbik marked an inline comment as done.

use Bixia's clever C++ stuff