Skip to content

Add CUTLASS group queries and built-in Reduce/Sum - #11530

Open
tpn wants to merge 2 commits into
codex/cuda-coop-cutlass-03-logical-warp-load-storefrom
codex/cuda-coop-cutlass-04-groups-reduce
Open

tpn wants to merge 2 commits into
codex/cuda-coop-cutlass-03-logical-warp-load-storefrom
codex/cuda-coop-cutlass-04-groups-reduce

Conversation

@tpn

@tpn tpn commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Prerequisite: #11529.

CuTe kernels can query group membership, rank, and size, synchronize supported
groups, and compute built-in reductions and sums. The implementation covers
thread, warp, block, mapped, and cluster groups within the shared planner's
supported profiles. It uses exact compiler launch facts to select the group
and determine participation.

The planner selects CUDAX for supported full-group reductions and CUB for
valid scalar prefixes or explicit block algorithms. Results retain the common
visibility contract: a result without broadcast is defined only at group rank
zero. Inputs are preserved. Mapped-warp reductions require parent-block
participation, including nonmembers.

A separate shared typing commit accepts read-only compiler metadata and fixes
integer payload bounds. Scalar results remain CuTe values. The layer includes
qualified typing, an executable example, and documentation of participation
and result ownership. Custom operators remain unsupported.

Validation

Tests cover supported numeric dtypes, scalar and payload results, prefix
validation before narrowing, result chaining, multidimensional groups,
nonmembers, and two-block clusters. Mixed Load/Reduce/Store traces, focused
race checks, and final-cubin inspection cover both planner routes and scratch
reuse. Shared scalar typing consumers cover both backends.

These tests passed in the prior 12-layer tip's local regression on Linux with
CUDA 13.3 and SM 120, using a compatible development compiler. That
run covered the prior cumulative tip; intermediate PR heads have not been separately
rerun. Official public CUTLASS artifacts remain unqualified.

Final integrated regression: Passed: 879 shared-contract checks, 1,415 Numba host/compiler checks, 798 Numba GPU checks, seven standalone Numba commands, 1,757 CUTLASS host/compiler checks, and 2,136 CUTLASS GPU/compiler-lifecycle checks. Both GPU suites ran with race checking enabled; there were no failures or skips.
Final installed-wheel qualification: Fresh-wheel checks passed: all 252 Python sources/stubs match the final source, 40 packaging/typing tests passed, and base-only imports plus four mixed-backend activation cases passed. Installed GPU consumers passed 20 common/qualified example runs, four storage variants, runtime-first and disabled-auto-registration modes, and three executable guide tests.
Final documentation qualification: Full Sphinx rendered with only three existing libcu++ warnings; focused cooperative pages build without warnings. API signatures, 39 source excerpts, downloads, anchors, and local links pass. Local and live browser checks passed for 32 CUTLASS objects and all 14 explorers. The published docs match the tested source; 396 served resources match build hashes and the separate Numba docs remain unchanged.

Stack

Part 5 of 16 above #11392. Previous: #11529 · Next: #11531.
Complete stack and current common API coverage: #11541.

@copy-pr-bot

copy-pr-bot Bot commented Sep 21, 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 Sep 21, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Sep 21, 2026
@tpn
tpn force-pushed the codex/cuda-coop-cutlass-04-groups-reduce branch from 3e20e0b to b034a29 Compare September 21, 2026 04:15
@tpn
tpn force-pushed the codex/cuda-coop-cutlass-03-logical-warp-load-store branch from bd4fd9b to 3ffc4fd Compare September 21, 2026 04:15
tpn added 2 commits September 20, 2026 21:27
Accept compiler class metadata through readonly scalar properties.
Keep integer payload type variables within the signed and unsigned
scalar domain shared by the backend stubs.

Signed-off-by: Trent Nelson <trent@trent.me>
Resolve group methods from exact compiler launch facts and preserve the
unsigned query result types. Keep mapped group metadata storage-free.
Route built-in Reduce and Sum through the shared CUDAX and CUB plans,
with checked prefix counts, result ownership, and safe scratch reuse.

Signed-off-by: Trent Nelson <trent@trent.me>
@tpn
tpn force-pushed the codex/cuda-coop-cutlass-03-logical-warp-load-store branch from 3ffc4fd to 8511575 Compare September 21, 2026 04:31
@tpn
tpn force-pushed the codex/cuda-coop-cutlass-04-groups-reduce branch from b034a29 to 1500e1e Compare September 21, 2026 04:31
@tpn
tpn marked this pull request as ready for review September 21, 2026 17:42
Copilot AI lite review requested due to automatic review settings September 21, 2026 17:42
@tpn
tpn requested review from a team as code owners September 21, 2026 17:42
@tpn
tpn requested review from rwgk and wmaxey and removed request for a team September 21, 2026 17:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Progress to In Review in CCCL Sep 21, 2026
@github-actions

This comment has been minimized.

@tpn

tpn commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/cccl/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: eec1e5f7-932f-438b-8d17-20be429d3f79

📥 Commits

Reviewing files that changed from the base of the PR and between 8511575 and 1500e1e.

📒 Files selected for processing (31)
  • ci/validate_cuda_coop_wheel.py
  • docs/python/coop.rst
  • docs/python/coop_api.rst
  • docs/python/coop_cutlass.rst
  • python/cuda_coop/cuda/coop/_typing.pyi
  • python/cuda_coop/cuda/coop/cutlass/__init__.py
  • python/cuda_coop/cuda/coop/cutlass/__init__.pyi
  • python/cuda_coop/cuda/coop/cutlass/_group_reduce.py
  • python/cuda_coop/cuda/coop/cutlass/_group_reduce.pyi
  • python/cuda_coop/cuda/coop/cutlass/_lowering/_reduce.py
  • python/cuda_coop/cuda/coop/cutlass/_lowering/_thread_group.py
  • python/cuda_coop/cuda/coop/cutlass/_operators.py
  • python/cuda_coop/cuda/coop/cutlass/_thread_group.py
  • python/cuda_coop/cuda/coop/cutlass/_thread_group.pyi
  • python/cuda_coop/examples/cutlass/reduce.py
  • python/cuda_coop/tests/backends/cutlass/compile/test_group_compile.py
  • python/cuda_coop/tests/backends/cutlass/compile/test_reduce_compile.py
  • python/cuda_coop/tests/backends/cutlass/runtime/test_collective_bundle.py
  • python/cuda_coop/tests/backends/cutlass/runtime/test_group_hierarchy.py
  • python/cuda_coop/tests/backends/cutlass/runtime/test_reduce.py
  • python/cuda_coop/tests/backends/cutlass/runtime/test_reduce_reuse.py
  • python/cuda_coop/tests/backends/cutlass/runtime/test_reduce_widths.py
  • python/cuda_coop/tests/backends/cutlass/unit/test_group_methods.py
  • python/cuda_coop/tests/backends/cutlass/unit/test_reduce_plans.py
  • python/cuda_coop/tests/packaging/test_installed.py
  • python/cuda_coop/tests/packaging/test_metadata.py
  • python/cuda_coop/tests/packaging/test_typing.py
  • python/cuda_coop/tests/packaging/test_wheel.py
  • python/cuda_coop/tests/packaging/typing/cutlass_consumer.py
  • python/cuda_coop/tests/packaging/typing/cutlass_mypy.ini
  • python/cuda_coop/tests/packaging/typing/invalid_cutlass_consumer.py

Included review availability: Your plan provides up to 12 included reviews per hour; 7 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features

    • Added CUTLASS cooperative-group hierarchy queries, membership checks, and synchronization.
    • Added reduce and sum operations for block, warp, cluster, and supported logical groups.
    • Added broadcasting, partial-item reductions, selectable algorithms, and scalar or payload support.
    • Added thread, cluster, and grid group accessors.
    • Added a CUTLASS reduction example.
  • Documentation

    • Expanded CUTLASS documentation with supported groups, operations, constraints, and reduction examples.
    • Clarified API behavior for synchronization, hierarchy queries, and result handling.

Walkthrough

Changes

The CUTLASS backend now supports typed thread-group queries, synchronization, membership checks, and group reductions. The PR adds CUDAX/CUB lowering, public APIs, documentation, examples, extensive compile/runtime tests, and wheel and typing validation.

CUTLASS cooperative groups

Layer / File(s) Summary
Thread-group queries and synchronization
python/cuda_coop/cuda/coop/cutlass/_thread_group.py, python/cuda_coop/cuda/coop/cutlass/_thread_group.pyi, python/cuda_coop/cuda/coop/cutlass/_lowering/_thread_group.py, python/cuda_coop/tests/backends/cutlass/compile/test_group_compile.py, python/cuda_coop/tests/backends/cutlass/runtime/test_group_hierarchy.py, python/cuda_coop/tests/backends/cutlass/unit/test_group_methods.py
Adds group factories, rank/count queries, synchronization, membership checks, typed overloads, CUDAX lowering, and hierarchy validation.
Group reduction implementation
python/cuda_coop/cuda/coop/cutlass/_group_reduce.*, python/cuda_coop/cuda/coop/cutlass/_lowering/_reduce.py, python/cuda_coop/cuda/coop/cutlass/_operators.py, python/cuda_coop/examples/cutlass/reduce.py, python/cuda_coop/tests/backends/cutlass/{compile,runtime,unit}/*reduce*
Adds typed reduce and sum APIs, operator normalization, CUDAX/CUB plans, generated reduction requests, valid-prefix handling, and reduction tests and examples.
CUTLASS API documentation
docs/python/coop.rst, docs/python/coop_api.rst, docs/python/coop_cutlass.rst
Documents hierarchy operations, synchronization, load/store, reductions, supported groups and operators, broadcast behavior, prefix handling, and examples.
Wheel and typing validation
ci/validate_cuda_coop_wheel.py, python/cuda_coop/tests/packaging/*
Extends wheel contents, installed-package checks, implementation-file checks, and family-specific strict typing checks for the CUTLASS surface.

Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to 1500e

No actionable merge-blocking risk remains from the finalized findings.


Comment @coderabbitai help to get the list of available commands.

@tpn
tpn force-pushed the codex/cuda-coop-cutlass-03-logical-warp-load-store branch from 8511575 to 8959421 Compare September 21, 2026 18:52
@tpn
tpn force-pushed the codex/cuda-coop-cutlass-04-groups-reduce branch from 1500e1e to 41d8083 Compare September 21, 2026 18:52
@github-actions

This comment has been minimized.

@tpn
tpn force-pushed the codex/cuda-coop-cutlass-03-logical-warp-load-store branch from 8959421 to e3948d1 Compare September 21, 2026 19:46
@tpn
tpn force-pushed the codex/cuda-coop-cutlass-04-groups-reduce branch from 41d8083 to a0c7d38 Compare September 21, 2026 19:46
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 32m 28s: Pass: 100%/8 | Total: 1h 14m | Max: 28m 30s

See results here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants