Repository navigation
Optimize WarpReduce for bitwise operators - #11279
Conversation
📝 SummarySummary by CodeRabbit
WalkthroughThe change adds wide unsigned bitwise reduction support, removes the specialized reduction path from incremental lookahead, documents ChangesWarp reduction support
Suggested reviewers: Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Partial lookahead batches can produce incorrect aggregates because inactive lanes may contribute uninitialized values before the reduction count is applied. This should be corrected before merge. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 85043dca-9919-4409-9ad9-6a68784ab2b5
📒 Files selected for processing (4)
cub/cub/detail/warpspeed/look_ahead.cuhcub/cub/warp/specializations/warp_redux.cuhcub/cub/warp/warp_reduce.cuhcub/test/warp/catch2_test_warp_reduce.cu
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bernhardmgruber
left a comment
There was a problem hiding this comment.
We definitely need to see a benchmark of scan on B200 :) I am looking forward to the results!
|
Here the summary on a B200, CTK 13.3. There are a couple of cases marked as "slow" but the corresponding Rel. Diff is < 2% and/or the types are not handled by the new code. The only case that has ~2% regression is scan.exclusive.sum.lookahead.base
scan.exclusive.sum.base
scan.exclusive.deterministic.base
scan.exclusive.custom.base
|
|
@fbusato please always post the full benchmark diff. We need to see the results for all problem sizes in the benchmark. You can use |
|
@bernhardmgruber I don't want to spend further time on this. I will revert Scan code to the old bloated one. |
🥳 CI Workflow Results🟩 Finished in 3h 00m: Pass: 100%/176 | Total: 8d 09h | Max: 2h 59m | Hits: 30%/601924See results here. |
Cherry-picked the look_ahead.cuh portion of PR NVIDIA#11279 commit 71378a9 ("Optimize WarpReduce for bitwise operators"), which removes the manual warp_redux_sm80 fast-path special-case in favor of relying on WarpReduce directly. Applied without the corresponding generic WarpReduce/warp_redux.cuh optimization from that commit, for testing purposes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Co-Authored-By: Federico Busato <fbusato@nvidia.com>
Description
#10768 remembered me that there is still low-hanging fruit to optimize
WarpReduce.The PR optimizes bitwise operators for unsigned types > 4B by applying
warp_reduxto 32-bit chunks. This leads to 4x better perf for 64-bit, and 25x for 128-bit integers.I also realized that
warpspeedis using the internalwarp_reduxfunction for a smaller set of types. The original concern was related to the large number of SASS instructions. Instead, switching to the top-level API reduced the number of SASS instructions. The simplification decreases the code fragmentation and potentially the suboptimal paths (@bernhardmgruber for visibility)