Skip to content

[cudax] Implement cudax::interwarp_synchronizer - #11211

Open
davebayer wants to merge 1 commit into
NVIDIA:mainfrom
davebayer:inter_warp_barrier
Open

[cudax] Implement cudax::interwarp_synchronizer#11211
davebayer wants to merge 1 commit into
NVIDIA:mainfrom
davebayer:inter_warp_barrier

Conversation

@davebayer

@davebayer davebayer commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

This PR implements interwarp_synchronizer synchronizer that allows you to use the native warp barriers as for synchronizing warps within a single block.

The idea is that the user passes a range of barrier ids that must be convertible to uint32_t, which are split among the newly created groups. The barrier id is then used in __barrier_sync_count(...) call.

Using this synchronizer requires some deeper knowledge of the device architecture and it is expected to be used by advanced users.

@davebayer
davebayer requested a review from a team as a code owner September 4, 2026 13:14
@davebayer
davebayer requested a review from andralex September 4, 2026 13:14
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Sep 4, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Sep 4, 2026
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4b207672-470b-4d77-9b05-edef7650b01a

📥 Commits

Reviewing files that changed from the base of the PR and between 922b95d and 1d628e8.

📒 Files selected for processing (1)
  • cudax/include/cuda/experimental/__group/synchronizer/level_synchronizer.cuh
🚧 Files skipped from review as they are similar to previous changes (1)
  • cudax/include/cuda/experimental/__group/synchronizer/level_synchronizer.cuh

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 an experimental CUDA interwarp synchronizer for coordinating groups of warps within a block.
    • Supports standard and aligned synchronization, per-group instances, and synchronizer views.
    • Exposed the feature through the experimental group API.
    • Added validation for supported barrier identifiers, group limits, range capacity, and invalid mappings.
  • Bug Fixes

    • Improved memory ordering for aligned cluster synchronization operations.
  • Tests

    • Added coverage for synchronization, validation, cleanup, and multiple block configurations.

Walkthrough

Changes

The PR adds interwarp_synchronizer<_Range> and its per-group instance implementation. It exposes the implementation through the experimental group header, updates aligned cluster barrier memory ordering, and adds CUDA tests for construction, synchronization, views, deinitialization, and launch configurations.

Interwarp synchronizer

Layer / File(s) Summary
Synchronizer API and implementation
cudax/include/cuda/experimental/__group/fwd.cuh, cudax/include/cuda/experimental/__group/synchronizer/interwarp_synchronizer.cuh, cudax/include/cuda/experimental/__group/synchronizer/level_synchronizer.cuh
Adds the forward declaration, barrier-backed synchronizer instance, constrained range-based synchronizer, barrier ID selection, deduction guide, and memory clobbers for aligned cluster barriers.
Public header wiring
cudax/include/cuda/experimental/group.cuh
Includes the interwarp synchronizer in the experimental group umbrella header.
CUDA test coverage
cudax/test/group/synchronizer/interwarp_synchronizer.cu, cudax/test/CMakeLists.txt
Adds warp-in-block mapping tests, synchronization and trait checks, two 256-thread launches, and the Catch2 test target registration.

Merge Risk: 🟡 Moderate · up to 1d628

The new interwarp synchronizer may fail for invalid group mappings or certain otherwise accepted barrier-ID ranges. These API correctness issues should be resolved before merge.


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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: cde92d75-e1e5-47c5-89c2-c2f4b7539157

📥 Commits

Reviewing files that changed from the base of the PR and between 5457227 and c540f53.

📒 Files selected for processing (5)
  • cudax/include/cuda/experimental/__group/fwd.cuh
  • cudax/include/cuda/experimental/__group/synchronizer/interwarp_synchronizer.cuh
  • cudax/include/cuda/experimental/group.cuh
  • cudax/test/CMakeLists.txt
  • cudax/test/group/synchronizer/interwarp_synchronizer.cu

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

Comment thread cudax/include/cuda/experimental/__group/synchronizer/interwarp_synchronizer.cuh Outdated
Comment thread cudax/include/cuda/experimental/__group/synchronizer/interwarp_synchronizer.cuh Outdated

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

♻️ Duplicate comments (2)
cudax/include/cuda/experimental/__group/synchronizer/interwarp_synchronizer.cuh (2)

117-118: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

important: Handle invalid mappings before advancing the range.

For group_by&lt;2, false&gt; over three warps, the invalid warp can have is_valid() == false and group_rank() == 0xffff'ffff. Line 117 advances from the range start by that sentinel, and Line 118 dereferences the resulting iterator. Return an inert __synchronizer_instance before advancing. The supplied test at cudax/test/group/synchronizer/interwarp_synchronizer.cu:77-130 does not cover this path.


118-118: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

important: Enforce unique barrier IDs for active groups.

make_instance selects one ID per group rank, but no check rejects duplicate IDs. Two groups can then target the same CTA barrier resource, allowing arrivals from one group to satisfy the other group's barrier count. This can release a group before all of its members arrive. Reject duplicates or enforce uniqueness as an API precondition. The supplied test uses distinct IDs and does not cover this case. (docs.nvidia.com)

Source: MCP tools


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8b0b23dc-77ca-451d-977b-072d8f2a9a37

📥 Commits

Reviewing files that changed from the base of the PR and between c540f53 and 9aa72e4.

📒 Files selected for processing (1)
  • cudax/include/cuda/experimental/__group/synchronizer/interwarp_synchronizer.cuh

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

Comment thread cudax/include/cuda/experimental/__group/synchronizer/interwarp_synchronizer.cuh Outdated

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 11e8252a-8f29-431f-a907-7fe2c25c8016

📥 Commits

Reviewing files that changed from the base of the PR and between e7b7a2c and 922b95d.

📒 Files selected for processing (2)
  • cudax/include/cuda/experimental/__group/synchronizer/interwarp_synchronizer.cuh
  • cudax/include/cuda/experimental/__group/synchronizer/level_synchronizer.cuh

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

Comment thread cudax/include/cuda/experimental/__group/synchronizer/level_synchronizer.cuh Outdated
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 36m: Pass: 100%/63 | Total: 14h 17m | Max: 54m 27s | Hits: 60%/59452

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.

1 participant