Skip to content

cuda.coop: add Numba Block and Warp Scan - #11212

Draft
tpn wants to merge 11 commits into
codex/cuda-coop-numba-hierarchy-reducefrom
codex/cuda-coop-numba-base-scan
Draft

cuda.coop: add Numba Block and Warp Scan#11212
tpn wants to merge 11 commits into
codex/cuda-coop-numba-hierarchy-reducefrom
codex/cuda-coop-numba-base-scan

Conversation

@tpn

@tpn tpn commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Why this is needed

The preceding cuda.coop stack establishes declarative group topology,
storage, result projection, and stateless operator compilation. This PR adds
Scan as another independently registered family without changing activation,
root dispatch, caching, or rewrite phase orchestration.

Reviewer-visible behavior

  • Adds portable and qualified Scan, InclusiveScan, ExclusiveScan,
    InclusiveSum, and ExclusiveSum entry points.
  • Portable and qualified calls share the same call prefix, payload protocols,
    lowercase modes, operators and algorithms, storage descriptors, and dtype
    inference for untyped ThreadData.
  • Qualified-only extensions are Block local-array payloads, runtime
    valid_items, aggregate output, and compiler-resolved callback or operator
    aliases.
  • Supports Block scalar and ThreadData payloads and scalar physical or
    logical Warp payloads.
  • Supports initial values, CUB BlockScan algorithm selection,
    implicit/caller/dynamic Block storage, and compiler-owned per-Warp storage.
  • Validates partial-Warp prefix bounds before CUB narrowing and documents that
    only outputs within the valid prefix are defined.
  • Keeps stateful and prefix callbacks out of this base Scan layer.

Validation

The exact final-stack head 9b299e894f, which includes this layer, passed:

  • 1,440 source-tree tests with the GPU hidden.
  • 607 installed-wheel contract, packaging, public-surface, and activation
    tests outside the source tree.
  • 50 installed-wheel real NVRTC LTO/nvJitLink compile tests.
  • 366 installed-wheel runtime tests on an RTX PRO 6000.

Stack and scope

This draft is stacked on #11210. Stateful and prefix Scan callbacks and any
grid workspace policy remain deferred. CUDA 12/13 L4 and Windows CI remain
external readiness gates.

@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown
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.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Sep 4, 2026
@tpn
tpn force-pushed the codex/cuda-coop-numba-hierarchy-reduce branch from ee48a4f to 6b15a85 Compare September 4, 2026 18:21
@tpn
tpn force-pushed the codex/cuda-coop-numba-base-scan branch from cf1672c to 1eef1a3 Compare September 4, 2026 18:30
tpn added 10 commits September 4, 2026 11:46
Define backend-neutral Block and Warp Scan semantics, including
out-of-place results, aggregate side outputs, prefix bounds, and storage
contracts.

Expose five portable group-first spellings while keeping backend-only
controls out of the root API.

Signed-off-by: Trent Nelson <trent@trent.me>
Materialize scalar and array BlockScan plus scalar physical and logical
WarpScan providers through the existing core adapter. Preserve callback
LTO, CUB storage, and scope-derived reuse barriers.

Add an explicit dependent type-expression placeholder so partial
exclusive sums inject a typed zero.

Signed-off-by: Trent Nelson <trent@trent.me>
Recognize all five Scan spellings through the family registry and
lower them from exact launch topology.

Carry inferred payload, initial, aggregate, prefix-width, and storage
facts into providers without changing the shared compiler phases.

Signed-off-by: Trent Nelson <trent@trent.me>
Exercise every numeric dtype through real provider compilation and
cover Block, physical-Warp, and logical-Warp execution.

Cover aggregate, initial, prefix, storage, callback, and isolated
invalid-prefix paths so every concrete ABI runs end to end.

Signed-off-by: Trent Nelson <trent@trent.me>
Require complete portable and qualified Scan APIs in installed wheels
while preserving lazy compiler-family loading.

Exercise valid and invalid static call shapes, including Python
initial literals and the explicit N6 exclusions.

Signed-off-by: Trent Nelson <trent@trent.me>
Describe Scan modes, operators, result ownership, partial-Warp rules,
storage synchronization, and the prefix-callback deferral.

Add a runnable portable Block Load, Scan, and Store example and expose
the family from the Python documentation index.

Signed-off-by: Trent Nelson <trent@trent.me>
Extend the standalone wheel validator with every portable and Numba
Scan module plus the bundled CUB BlockScan and WarpScan headers.

Keep stateful prefix callbacks, dataclasses, CUTLASS, and AOT payloads
out of the supported wheel surface.

Signed-off-by: Trent Nelson <trent@trent.me>
Require string selectors for Scan across the portable and qualified
surfaces, and normalize shared aliases through one path. Keep callable
operators as a qualified-only extension.

Use common read-only payload, storage, and contextual initial-value
typing contracts, and remove the public BlockScanAlgorithm enum.

Signed-off-by: Trent Nelson <trent@trent.me>
Reject string-backed enums for Scan modes and algorithms.

Apply the same rule to built-in operators.

Enforce it at portable, planner, and provider boundaries.

Match shared runtime signatures while retaining qualified extensions.

Prevent the removed public enum API from returning through coercions.

Signed-off-by: Trent Nelson <trent@trent.me>
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>
@tpn
tpn force-pushed the codex/cuda-coop-numba-base-scan branch from 1eef1a3 to 8a594e5 Compare September 4, 2026 18:47
Retain separate variables for the portable descriptor and the qualified
descriptor viewed through their shared protocol. This keeps the strict
consumer valid as Scan adds its cross-surface storage check.

Signed-off-by: Trent Nelson <trent@trent.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant