Skip to content

Add the portable cuda.coop foundation - #11035

Draft
tpn wants to merge 1 commit into
mainfrom
codex/cuda-coop-01-core
Draft

Add the portable cuda.coop foundation#11035
tpn wants to merge 1 commit into
mainfrom
codex/cuda-coop-01-core

Conversation

@tpn

@tpn tpn commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Why this is needed

This is the first layer of a stacked cuda.coop series. It gives compiler
integrations one backend-neutral contract for CUDA thread groups, fixed-size
per-thread values, temporary storage, and the initial load/store, reduce, and
scan operations.

Keeping these contracts in the root package lets later CUTLASS and
Numba-CUDA-MLIR PRs implement the same calls without coupling the public API
to either compiler.

import numpy as np
from cuda import coop

block = coop.this_block()
items = coop.ThreadData(2, dtype=np.int32)
loaded = coop.load(block, source, items, valid_items=count, oob_default=0)
total = coop.sum(block, loaded)
coop.store(block, destination, loaded, valid_items=count)

What this PR includes

  • the cuda-coop package foundation and backend-independent imports
  • thread groups, launch facts, argument bindings, ThreadData, and
    TempStorage
  • portable load/store, reduce/sum, and inclusive/exclusive scan contracts
  • bundled-header discovery and compiler-free contract tests

CUTLASS activation starts in the next PR. Numba-CUDA-MLIR and the remaining
primitive families follow in later stack layers.

Stack

  1. This PR: portable core, based on main
  2. PR #11044: CUTLASS walking cohort
  3. PR #11045: Numba-CUDA-MLIR walking cohort
  4. PR #11046: data collectives
  5. PR #11047: ordering and selection
  6. PR #11048: CUTLASS PCH
  7. PR #11049: CUTLASS AOT

Each PR targets the branch immediately below it; all seven are drafts.

Local validation

  • 379 source-tree core and header contract tests passed; two packaging-only
    tests were deselected
  • source imports and compileall passed
  • changed-file pre-commit and git diff --check passed
  • CodeRabbit and both required RoboRev reviewers completed for this first
    layer; all accepted fixes are folded into the commit

Wheel builds, installed-wheel qualification, GitHub CI, and backend
compilation are deferred to their owning stack layers. Automated AI review of
layers 2-7 is deferred for now.

@copy-pr-bot

copy-pr-bot Bot commented Aug 27, 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.

@github-project-automation github-project-automation Bot moved this to Todo in CCCL Aug 27, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Aug 27, 2026
Introduce the cuda-coop package and its compiler-neutral cooperative
contracts. Define groups, launch facts, argument bindings, payloads, and
temporary storage without importing a compiler backend.

Expose a focused walking cohort of load/store, reduce/sum, and scan so
later backend layers can prove the same public semantics before the API
expands.

Signed-off-by: Trent Nelson <trent@trent.me>
@jrhemstad

jrhemstad commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

16,000 lines is still too large for anyone to meaningfully review. We're going to need to break this smaller. I recommend focusing the first PR on enabling a single algorithm.

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.

2 participants