This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Change the quick sort pivot selection.
ClosedPublic

Authored by bixia on Jan 26 2023, 5:05 PM.

Details

Summary

Previously, we choose the value at (lo + hi)/2 as a pivot for partitioning the
data in [lo, hi). We now choose the median for the three values at lo, (lo +
hi)/2, and (hi-1) as a pivot to match the std::qsort implementation.

Diff Detail

Event Timeline

bixia created this revision.Jan 26 2023, 5:05 PM
Herald added a project: Restricted Project. · View Herald Transcript
bixia requested review of this revision.Jan 26 2023, 5:05 PM
aartbik accepted this revision.Jan 27 2023, 11:18 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
461

Have you considered using arith::SelectOp for all/some of these?
Yields slightly more readable IR, and may even perform better?

This revision is now accepted and ready to land.Jan 27 2023, 11:18 AM
bixia updated this revision to Diff 492926.Jan 27 2023, 3:25 PM
bixia marked an inline comment as done.

Use SelectOp.

This revision was automatically updated to reflect the committed changes.