Repository navigation
Use Clang’s generic bit-reversal builtin for host execution - #1
Open
ivanmilevtues wants to merge 5 commits into
Open
ivanmilevtues wants to merge 5 commits into
ivanmilevtues wants to merge 5 commits into
Conversation
Use __builtin_bitreverseg when available while retaining existing width-specific and portable fallbacks. Exercise each bit position and its complement across unsigned integer widths. Amp-Thread-ID: https://ampcode.com/threads/T-01a1989f-4c32-7297-aa93-b60f6e3938ff Co-authored-by: Amp <amp@ampcode.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Svilen-Stefanov
left a comment
There was a problem hiding this comment.
I don't see an analysis on this PR, can we add one and maybe do something like eShop here for C++ users?
Member
Author
|
/codeboarding |
1 similar comment
Member
Author
|
/codeboarding |
CodeBoarding reviewStatus: 0 changed components (no analysed file changed) See the full change in CodeBoarding. graph LR
n_CUDA_Standard_C_Library["CUDA Standard C++ Library"]
n_Experimental_CUDA_C_Extensions["Experimental CUDA C++ Extensions"]
n_Parallel_Algorithm_Template_Library["Parallel Algorithm Template Library"]
n_GPU_Collective_Compute_Primitives["GPU Collective Compute Primitives"]
n_Python_Compute_and_Task_Bindings["Python Compute and Task Bindings"]
n_C_Runtime_and_JIT_Interface["C Runtime and JIT Interface"]
n_Continuous_Integration_and_Documentation["Continuous Integration and Documentation"]
n_Build_and_Static_Analysis_Tooling["Build and Static Analysis Tooling"]
n_CUDA_Standard_C_Library -- "references execution disposition types" --> n_Experimental_CUDA_C_Extensions
n_CUDA_Standard_C_Library -- "invokes parallel algorithms" --> n_Parallel_Algorithm_Template_Library
n_CUDA_Standard_C_Library -- "uses device runtime primitives" --> n_C_Runtime_and_JIT_Interface
n_Experimental_CUDA_C_Extensions -- "uses synchronization barriers and views" --> n_CUDA_Standard_C_Library
n_Experimental_CUDA_C_Extensions -- "dispatches parallel query operations" --> n_Parallel_Algorithm_Template_Library
n_Experimental_CUDA_C_Extensions -- "invokes device intrinsics and state helpers" --> n_C_Runtime_and_JIT_Interface
n_Parallel_Algorithm_Template_Library -- "delegates error termination and iterators" --> n_CUDA_Standard_C_Library
n_Parallel_Algorithm_Template_Library -- "routes memory error handling" --> n_Experimental_CUDA_C_Extensions
n_GPU_Collective_Compute_Primitives -- "queries device and execution context" --> n_Experimental_CUDA_C_Extensions
n_GPU_Collective_Compute_Primitives -- "dispatches parallel kernel invocations" --> n_C_Runtime_and_JIT_Interface
n_C_Runtime_and_JIT_Interface -- "uses standard memory management utilities" --> n_CUDA_Standard_C_Library
n_C_Runtime_and_JIT_Interface -- "controls stream and task execution" --> n_Experimental_CUDA_C_Extensions
n_C_Runtime_and_JIT_Interface -- "manages dynamic buffer storage" --> n_Parallel_Algorithm_Template_Library
n_C_Runtime_and_JIT_Interface -- "applies type trait modernization rules" --> n_Build_and_Static_Analysis_Tooling
classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
|
Consolidate the leading- and trailing-zero fallbacks around popcount while retaining compiler and device intrinsics. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c083-fef7-73f1-b175-43fb1b9be831 Co-authored-by: Amp <amp@ampcode.com>
CodeBoarding reviewStatus: 5 changed components See the full change in CodeBoarding. graph LR
n_CUDA_Standard_C_Library["CUDA Standard C++ Library"]
n_Experimental_CUDA_C_Extensions["Experimental CUDA C++ Extensions"]
n_Parallel_Algorithm_Template_Library["Parallel Algorithm Template Library"]
n_GPU_Collective_Compute_Primitives["GPU Collective Compute Primitives"]
n_Python_Compute_and_Task_Bindings["Python Compute and Task Bindings"]
n_C_Runtime_and_JIT_Interface["C Runtime and JIT Interface"]
n_Continuous_Integration_and_Documentation["Continuous Integration and Documentation"]
n_Build_and_Static_Analysis_Tooling["Build and Static Analysis Tooling"]
n_CUDA_Standard_C_Library -- "references execution disposition types" --> n_Experimental_CUDA_C_Extensions
n_CUDA_Standard_C_Library -- "invokes parallel algorithms" --> n_Parallel_Algorithm_Template_Library
n_CUDA_Standard_C_Library -- "uses device runtime primitives" --> n_C_Runtime_and_JIT_Interface
n_Experimental_CUDA_C_Extensions -- "uses synchronization barriers and views" --> n_CUDA_Standard_C_Library
n_Experimental_CUDA_C_Extensions -- "dispatches parallel query operations" --> n_Parallel_Algorithm_Template_Library
n_Experimental_CUDA_C_Extensions -- "invokes device intrinsics and state helpers" --> n_C_Runtime_and_JIT_Interface
n_Parallel_Algorithm_Template_Library -- "delegates error termination and iterators" --> n_CUDA_Standard_C_Library
n_Parallel_Algorithm_Template_Library -- "routes memory error handling" --> n_Experimental_CUDA_C_Extensions
n_GPU_Collective_Compute_Primitives -- "queries device and execution context" --> n_Experimental_CUDA_C_Extensions
n_GPU_Collective_Compute_Primitives -- "dispatches parallel kernel invocations" --> n_C_Runtime_and_JIT_Interface
n_C_Runtime_and_JIT_Interface -- "uses standard memory management utilities" --> n_CUDA_Standard_C_Library
n_C_Runtime_and_JIT_Interface -- "controls stream and task execution" --> n_Experimental_CUDA_C_Extensions
n_C_Runtime_and_JIT_Interface -- "manages dynamic buffer storage" --> n_Parallel_Algorithm_Template_Library
n_C_Runtime_and_JIT_Interface -- "applies type trait modernization rules" --> n_Build_and_Static_Analysis_Tooling
classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
class n_CUDA_Standard_C_Library,n_Parallel_Algorithm_Template_Library,n_C_Runtime_and_JIT_Interface modified;
|
Compose lazy bit-reversed indices with permutation iterators and the existing copy backend. Support explicit execution policies and inferred iterator systems, with CPU and GPU coverage and an FFT-style reordering example. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c083-fef7-73f1-b175-43fb1b9be831 Co-authored-by: Amp <amp@ampcode.com>
Replace the duplicated items-per-thread calculation with the existing CUB helper, preserving behavior. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c083-fef7-73f1-b175-43fb1b9be831 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1c083-fef7-73f1-b175-43fb1b9be831 Co-authored-by: Amp <amp@ampcode.com>
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.
Motivation
Clang 23 adds
__builtin_bitreverseg, which reverses unsigned integers without selecting a width-specific builtin. This implements the host-execution portion of the real upstream request NVIDIA#7779.Change
cuda::std::bit_reversehost implementation when feature detection reports it available.cuda::bit_reversedelegates to the same implementation.Validation
Showcase scope
This PR targets the CodeBoarding fork, not NVIDIA upstream. It is a real, independently reviewable implementation change prepared for a later CodeBoarding demonstration. Automated C++ PR analysis is deferred until the analyzer is released; no new analysis has been generated for this PR.