Repository navigation
Add stable_sort NVHPC stdpar smoke test - #11882
Conversation
📝 SummarySummary by CodeRabbit
WalkthroughAdds a stdpar test that compares parallel stable-sort results with sequential results for ascending and descending key order. It also checks empty ranges and validates the configured CCCL version at compile time. ChangesStable sort test
Priority: ⬇️ Low Change: Other Merge Risk: 🔵 Low · up to The test may miss a regression where an empty-range comparator overload changes elements outside the range. Using unsorted input and checking it against a pre-call copy would make that behavior detectable.
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/stdpar/tests/stable_sort.cpp (1)
73-75: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuesuggestion: Test the empty range with unsorted data.
At this point,
valuesis already sorted bygreater_key. A full-range sort by that comparator leaves it unchanged, so the final check misses that overload sorting outside the empty range. Use unsortedinputand compare it with a copy made before both calls.Suggested fix
// Sorting an empty range must leave the data untouched - std::stable_sort(std::execution::par, values.begin(), values.begin()); - std::stable_sort(std::execution::par, values.begin(), values.begin(), greater_key); - if (values != expected) + const std::vector<item> input_before_empty_range = input; + std::stable_sort(std::execution::par, input.begin(), input.begin()); + std::stable_sort(std::execution::par, input.begin(), input.begin(), greater_key); + if (input != input_before_empty_range)
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: NVIDIA/cccl/.coderabbit.yaml
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
6829c57a-aeac-481b-8afc-d44589024842
📒 Files selected for processing (1)
test/stdpar/tests/stable_sort.cpp
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
|
/ok to test d791382 |
🥳 CI Workflow Results🟩 Finished in 1h 04m: Pass: 100%/2 | Total: 1h 09m | Max: 1h 04m | Hits: 0%/0See results here. AI failure analysis1. cuOpt compilation fails on RMM 26.12 stream APIs · 1 jobExplanation: cuOpt is compiled against RMM 26.12 from main, but its sources still use unavailable RMM stream interfaces, causing multiple CUDA and C++ objects to fail during compilation. The PR only adds `test/stdpar/tests/stable_sort.cpp`; this downstream cuOpt failure occurs before that test is involved and is likely an unrelated RAPIDS dependency transition. Evidence: Copy this prompt into a coding agentJobs: |
|
Thanks for the contribution! |
Summary
Adds a
std::stable_sortsmoke test for #6486. It covers both overloads that take an execution policy (default order and a custom comparator).Each element carries its original position, and only the key is compared, so the test can see whether equal keys kept their order. Each parallel sort is checked against a regular
std::stable_sortof the same data, positions included. It also checks that sorting an empty range changes nothing.Testing
/W4 /WX.std::sort, which doesn't keep equal keys in order.-stdpar=gpuisn't checked yet. Relying on CI for that.