This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Implement hybrid quick sort for sparse_tensor.sort.
ClosedPublic

Authored by bixia on Feb 2 2023, 3:57 PM.

Diff Detail

Event Timeline

bixia created this revision.Feb 2 2023, 3:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
bixia requested review of this revision.Feb 2 2023, 3:57 PM
aartbik accepted this revision.Feb 7 2023, 10:42 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
1037

isn't the nTrailingP a boolean here, deciding between two versions?
The int seems to imply more semantics than there are?

You even start with

assert(nTrailingP == 1 || nTrailingP == 0);

bool isHybrid = (nTrailingP == 1);

so why not just passing in isHybrid?

This revision is now accepted and ready to land.Feb 7 2023, 10:42 AM
wrengr added inline comments.Feb 7 2023, 11:56 AM
mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
48

Why not name this "_sparse_qsort_" so that it matches the "_sparse_hybrid_qsort_" name?

bixia updated this revision to Diff 495870.Feb 8 2023, 9:05 AM
bixia marked an inline comment as done.

Change _sparse_quick_sort to _sparse_qsort. Rebase.

bixia added inline comments.Feb 8 2023, 9:12 AM
mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
1037

This is because FuncGeneratorType requires it to be an uint32_t. And the reason that FuncGeneratorType uses uint32_t not boolean is we can potentially have more trailing data, such as for collecting the number of swaps performed.