Fixes a race condition in DeviceTopK - #10627
Conversation
DeviceTopK
📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesTopK synchronization
Suggested reviewers: Comment |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
pauleonix
left a comment
There was a problem hiding this comment.
I hope this is not another false alarm from my side, but is the order of the two correct? Don't we need all results flushed to L2 before synchronizing the CTA so that the atomic certainly arrives after stores from all threads in the CTA?
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cub/cub/agent/agent_topk.cuh (1)
650-655: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winsuggestion: Add a deterministic multi-CTA regression test for this ordering. The supplied
cub/test/catch2_test_device_topk_keys.cu:73-112test validates final keys, but its random size selection does not guarantee multiple CTAs or repeated execution of this publication path. Add a fixed case that launches multiple CTAs, reachesfinalize_passmore than once, and repeats the operation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 87d7e43c-158a-42c5-aede-a3d2a356bc8d
📒 Files selected for processing (1)
cub/cub/agent/agent_topk.cuh
I see. I changed the order, to be on the safe side.
However, based on the AI assessment, the current order apparently would still hold up, but for less obvious reasons:
|
⏱️ CCCL compile-time benchmark comparison: Public headers compile-time benchResult: 0 regression row(s), 7 improvement row(s) above threshold.
Artifacts: reports and traces Direct file processing
🟢 Direct file processing — Improvements
|
🥳 CI Workflow Results🟩 Finished in 1h 25m: Pass: 100%/270 | Total: 2d 01h | Max: 56m 05s | Hits: 87%/222326See results here. |
|
/backport |
|
Successfully created backport PR for |
|
Successfully created backport PR for |
Description
Fixes a potential race condition, where thread
0signals a CTA's completion ofmerge_histogramswhile some other threads have not concluded contributing their counts to the global yet.