Conversation
DeviceSelect with USE_SELECT_FLAGS re-reads the whole input tile after the flag scan, so an invocation that keeps a small fraction of the items still pays full HBM traffic for the payload. When the predicate is a per-item flag and the payload is trivially copyable, the tile loop can instead read only the surviving indices and copy them straight to the output. Measured on an L20 (sm89, CUDA 12.8), ABBA-paired against the unpatched agent: 2.26x-3.48x when the selection rate is 0.1% or below, and parity from 50% upwards, where the flag scan already dominates. Correctness: 1040/1040 flagged-select cases and 120/120 shared-agent regression cases pass.
Contributor
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: NVIDIA/cccl/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughChanges
Select-If loading path
Suggested reviewers: Priority: ➖ Normal Change: Refactor ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DeviceSelectwithUSE_SELECT_FLAGSre-reads the whole input tile after the flag scan, so aninvocation that keeps a small fraction of the items still pays full HBM traffic for the payload
(issue #326). When the predicate is a per-item flag and the payload is trivially copyable, the tile
loop can read only the surviving indices and copy them straight out.
The fast path is gated on
SELECT_METHOD == USE_SELECT_FLAGS && SelectionOpt == SelectImpl::Select && is_trivially_copyable_v<InputT>, so every other configuration keeps the existing code path.Measured on an L20 (sm89, CUDA 12.8), ABBA-paired against the unpatched agent: 2.26x-3.48x at a
selection rate of 0.1% or below, parity from 50% upwards where the flag scan dominates. Correctness:
1040/1040 flagged-select cases and 120/120 shared-agent regression cases.
What the patch adds
can_predicate_item_loads— a compile-time gate that turns the fast path on only forSELECT_METHOD == USE_SELECT_FLAGS,SelectionOpt == SelectImpl::Selectand a trivially copyablepayload, so every other configuration keeps the existing code path untouched;
LoadItemsPredicated— reads only the flagged indices out of the tile instead of re-reading thewhole tile, and copies survivors straight to the output;
PrepareTilethat selects between the two.Correctness on the same machine: 1040/1040 flagged-select cases and 120/120 shared-agent regression
cases.
Measurement environment
The numbers above were taken on an L20 (sm89) with driver 570.86.10 / CUDA 12.8. The machine has
since been upgraded to driver 595.91.07, so the figures are being re-measured and this section
will carry the updated table; treat the current numbers as driver-570 references.