Repository navigation
Optimize cuda::device::warp_shuffle - #10035
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughSummary by CodeRabbit
WalkthroughChangesWarp shuffle operations now share packing, precondition, and result-construction paths. Runtime tests cover additional types and predicates. New architecture-specific SASS tests validate emitted instructions and wrapper/native register usage. Warp shuffle behavior
Possibly related PRs
Suggested reviewers: 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: 5655ce3a-9e53-4e59-8c1c-d112ca368704
📒 Files selected for processing (8)
CMakePresets.jsonlibcudacxx/include/cuda/__warp/warp_shuffle.hlibcudacxx/test/CMakeLists.txtlibcudacxx/test/libcudacxx/cuda/warp/warp_shuffle.pass.cpplibcudacxx/test/warp_codegen/CMakeLists.txtlibcudacxx/test/warp_codegen/compare_register_usage.pylibcudacxx/test/warp_codegen/warp_shuffle.culibcudacxx/test/warp_codegen/warp_shuffle_stress.cu
This comment has been minimized.
This comment has been minimized.
|
Do we have/need a benchmark for |
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: d5bf2479-0e91-445c-87bb-e2dd2fca66a0
📒 Files selected for processing (2)
libcudacxx/include/cuda/__warp/warp_shuffle.hlibcudacxx/test/libcudacxx/cuda/warp/warp_shuffle.pass.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- libcudacxx/test/libcudacxx/cuda/warp/warp_shuffle.pass.cpp
I think SASS codegen tests are enough. The goal is to match or outperform standard shuffle intrinsics. WarpBitonicSort is a very good candidate to check for potential perf/SASS issues |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
To be on the safe side, we should be expanding testing a bit:
- I think we are missing test coverage for 2-byte types in
warp_shuffle.pass.cpp. Also, we should be shuffling distinct values for the 1 byte case, to confirm values are shuffled correctly. - We should have 128-bit codegen tests
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔬 CUB benchmark SASS comparisonHow to request a benchmark run
Targets with a SASS change
|
🥳 CI Workflow Results🟩 Finished in 2h 57m: Pass: 100%/609 | Total: 21d 12h | Max: 2h 56m | Hits: 36%/2283719See results here. AI failure analysis1. RAPIDS conda environment: rapidsai-nightly repodata HTTP 503 · 4 jobsExplanation: All four jobs fail before compilation while creating the shared RAPIDS conda environment because libmamba cannot retrieve both rapidsai-nightly repodata subdirectories. The identical signatures within seconds across disjoint matrices, combined with no RAPIDS or CI files in the PR diff, indicate an external channel availability failure; subsequent fork and exit errors are derivative. Evidence: Copy this prompt into a coding agentJobs: |
* draft * add codegen tests * __shuffle_cast * code simplification * address comments * static_cast * fix CI failures * fix CI * Update libcudacxx/include/cuda/__warp/warp_shuffle.h Co-authored-by: Elias Stehle <3958403+elstehle@users.noreply.github.com> * Update libcudacxx/include/cuda/__warp/warp_shuffle.h Co-authored-by: Elias Stehle <3958403+elstehle@users.noreply.github.com> * address comments * fix cmakePresents * Update libcudacxx/include/cuda/__warp/warp_shuffle.h Co-authored-by: Michael Schellenberger Costa <miscco@nvidia.com> * Update libcudacxx/include/cuda/__warp/warp_shuffle.h Co-authored-by: Michael Schellenberger Costa <miscco@nvidia.com> * [bench-only] * use "mandates" * add _CCCL_NODEBUG_ALIAS * use CodegenTest.cmake facilities * use _CCCL_NODEBUG * use int128 shift * remove uniform delta check * remove int128 specialization * revert bench.yaml * use shift for 64-bit values --------- Co-authored-by: Elias Stehle <3958403+elstehle@users.noreply.github.com> Co-authored-by: Michael Schellenberger Costa <miscco@nvidia.com>
Description
The work related to the PR
highlighted that
cuda::device::warp_shufflegenerates code that is inefficient compared to plain__shfl_<op>_syncinstrinsics. This behavior is caused by additional instructions and far greater register pressure.The PR addresses the following issues:
movinstructions instead ofmemcpyto map generic types to their unsigned types when possible.memcpyto avoid UB values that significantly incremented the register pressure._idxand_xorfunctions (implicit).