Use primitive lexicographic comparison for numeric sorting - #24138
Use primitive lexicographic comparison for numeric sorting#24138PointKernel wants to merge 3 commits into
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test |
|
I32/F32 only — 32 cases. Before = main; after = this PR, first paired round. Negative change means faster.
The primitive comparator delivers a 1.79x geometric-mean speedup for eight-column INT32/FLOAT32 sorting across three rounds on RTX PRO 6000. Block-sort and merge register usage drops from 64 to 48 registers per thread. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughChangesPrimitive lexicographic sorting
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~30 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change adds a faster comparison path for sorting tables whose columns are all numeric, with the previous general implementation retained for every other input. New tests cover nulls, NaN and signed-zero values, extreme values, sliced inputs, and tie ordering, and no unresolved correctness concerns remain, so the change looks ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (5 skipped: 5 unsupported.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
| make_device_uvector_async(null_precedence, stream, cudf::get_current_device_resource_ref()); | ||
| if (not column_order.empty() or not null_precedence.empty()) { | ||
| // Finish copying the host policies before the caller can release them after this call. | ||
| cudf::detail::sync_stream(stream); |
There was a problem hiding this comment.
I think we can defer this sync further, until after do_sort.
Also why should the stream sync responsibility be handled in different parts of the call stack for primitive and non-primitive? The other comparator below must be handling this internally, because there’s no corresponding stream sync for it.
Can we structure this as an if/else (rather than an early exit) and lift the stream syncs accordingly? Perhaps that means shifting the cudf::detail::row::lexicographic::self_comparator to take device views of the column order and null precedence, and doing the H->D copy and stream sync in this function.
Description
This PR adds a primitive lexicographic row comparator and uses it for multi-column numeric sorting, including stable sort. It reuses the reduced type map from primitive row equality to keep nonnumeric comparison instantiations out of numeric sort kernels. The comparator uses device views and ordering spans directly, avoiding general table preprocessing, with shared comparison helpers in
lexicographic_common.cuh.On RTX PRO 6000, the representative eight-column INT32/FLOAT32
sortandsorted_orderbenchmarks show a 1.79x geometric-mean speedup over main. Block-sort and merge register usage drops from 64 to 48 registers per thread.Checklist