cuda.coop: add Numba hierarchy Reduce - #11210
Draft
tpn wants to merge 17 commits into
Draft
Conversation
Contributor
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
tpn
force-pushed
the
codex/cuda-coop-cudax-reduce-reuse-prereq
branch
2 times, most recently
from
September 4, 2026 18:20
64d2fcd to
be03724
Compare
Add a compiler-local C ABI invocable for providers that own storage. Admit GROUP execution only for storage-free lowering plans. Require provider metadata to declare no storage or synchronization too. Signed-off-by: Trent Nelson <trent@trent.me>
Add portable Reduce and Sum contracts across supported group scopes. Route full built-in reductions to storage-free CUDAX plans. Keep prefixes, algorithms, and custom operators on CUB plans. Correct mapped topology at physical warp boundaries. Signed-off-by: Trent Nelson <trent@trent.me>
Compile stateless Python operators to device LTO-IR. Adapt scalar and aggregate values to the generated C ABI. Keep stateful callbacks outside this slice. Signed-off-by: Trent Nelson <trent@trent.me>
Register lazy Reduce and Sum lowering for supported thread groups. Route full built-in collectives through storage-free CUDAX providers and retain deterministic CUB block and warp paths for prefixes, arrays, and stateless callbacks. Signed-off-by: Trent Nelson <trent@trent.me>
Exercise storage-free CUDAX hierarchy sources and deterministic CUB block and warp providers with the real CUDA toolchain. Verify stateless callback LTO artifacts link with the generated wrapper. Signed-off-by: Trent Nelson <trent@trent.me>
Exercise hierarchy and direct-CUB reductions on representative payloads, groups, algorithms, and result-visibility modes. Isolate invalid-prefix trap probes so the parent CUDA context remains usable. Signed-off-by: Trent Nelson <trent@trent.me>
Ship the complete Reduce implementation and its required headers in the universal wheel. Exercise lazy registration and narrow portable and qualified type signatures to the supported numeric closure. Signed-off-by: Trent Nelson <trent@trent.me>
Use canonical ranks whenever a mapping covers its physical parent, even when it was declared nonexhaustive. This lets storage-bearing logical WarpReduce fallbacks allocate and select their per-group slices. Signed-off-by: Trent Nelson <trent@trent.me>
Describe CUDAX and CUB selection, result visibility, valid prefixes, storage, synchronization, and deferred functionality. Add a runnable portable block-sum example with a per-thread payload. Signed-off-by: Trent Nelson <trent@trent.me>
Compile stateless device callbacks for the exact compute capability and include that target in cache and coalescing identities. Reject callback artifacts before linking them with a provider for another target. Signed-off-by: Trent Nelson <trent@trent.me>
Keep provider registration dormant during backend activation and marker access. Import and register the Reduce providers only when the first Reduce or Sum call is planned. Signed-off-by: Trent Nelson <trent@trent.me>
Accept recognized NumPy ufunc and operator callable shapes for full-group qualified reductions. Keep dtype-specific custom callbacks on the direct-CUB, root-only overloads. Signed-off-by: Trent Nelson <trent@trent.me>
Recognized built-in aliases may use every deterministic block algorithm. Keep arbitrary callbacks off the commutativity-only algorithm. Signed-off-by: Trent Nelson <trent@trent.me>
Exercise callback paths for block arrays and logical-warp prefixes. Cover public operator aliases and the remaining bitwise built-in path. Signed-off-by: Trent Nelson <trent@trent.me>
Advance the standalone wheel validator from the Load and Store foundation to the cumulative Exchange, Shuffle, and Reduce surface. Require every shipped module and header while continuing to reject deferred Scan, stateful callback, dataclass, and CUTLASS code. Signed-off-by: Trent Nelson <trent@trent.me>
Use canonical string validation for portable and qualified Reduce algorithms and built-in operators before provider planning. Keep qualified callable extensions explicit and internal CUB enums behind the lowering boundary. Accept read-only portable payload protocols in qualified reduction stubs so input contracts match the portable API without weakening mutable result types. Signed-off-by: Trent Nelson <trent@trent.me>
tpn
force-pushed
the
codex/cuda-coop-numba-hierarchy-reduce
branch
from
September 4, 2026 18:21
ee48a4f to
6b15a85
Compare
Import the validated IR facade from rewrite support. This keeps private Numba-CUDA-MLIR compiler access inside the guarded compatibility boundary. Signed-off-by: Trent Nelson <trent@trent.me>
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.
Why this is needed
The preceding
cuda.coopstack establishes generic family, provider, result,storage, and synchronization seams. This PR adds Reduce as the first
hierarchy-wide collective on those seams, covering both storage-free CUDAX
providers and storage-bearing CUB providers without adding primitive
conditionals to generic activation, dispatch, caching, or rewrite phases.
Reviewer-visible behavior
reduceandsumfor thread, physical-Warp,logical-Warp, block, mapped-Warp, and cluster groups.
algorithm strings,
broadcast, and dtype inference for untypedThreadData.operatorand NumPyaliases and stateless Python device callbacks.
cuda::experimental::coop::reducefor full-group built-in operations,including broadcast and root-only projections without temporary storage.
prefixes, explicit algorithms, and qualified callback forms.
mismatches before provider generation.
ThreadDatainputs, isolates logical-group storage, andemits block or exact-mask Warp reuse synchronization from provider metadata.
stateful-callback, nondeterministic-algorithm, and invalid-prefix forms with
structured diagnostics.
Validation
The exact final-stack head
9b299e894f, which includes this layer, passed:tests outside the source tree.
Stack and scope
This draft is stacked on #11209. Stateful callbacks, Scan, prefix callbacks,
and a safe per-launch grid workspace policy remain deferred. The guarded
Numba-CUDA-MLIR compatibility shim remains inherited technical debt.