Skip to content

[cudax] Rework cudax::coop::group_as mapping - #12223

Merged
davebayer merged 2 commits into
NVIDIA:mainfrom
davebayer:rework_group_as
Oct 26, 2026
Merged

davebayer merged 2 commits into
NVIDIA:mainfrom
davebayer:rework_group_as

Conversation

@davebayer

Copy link
Copy Markdown
Contributor

This PR reworks the group_as mapping to take a viewable range instead of a contiguous piece of memory. This make it much more flexible and easier to use.

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

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 036ecd2
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 5dd99b76-b9ed-4313-86c3-712718478d0e
Commits

Reviewing files that changed from the base of the PR and between fffca4e and 0913bf8.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Summary

Summary by CodeRabbit

  • New Features
    • group_as accepts sized ranges of group counts, including C arrays, cuda::std::array, and cuda::std::span, to define group mappings.
    • Group mappings use the supplied range’s size and values, including values determined at runtime.
  • Compatibility
    • group_as no longer accepts index_sequence arguments; use a sized range instead.
  • Bug Fixes
    • Exhaustive mappings validate that group counts sum to the available units. Non-exhaustive mappings mark ranks beyond that sum as invalid.

group_as now accepts sized ranges whose values convert to uint32_t. It derives group counts and mapping validity from range values. Tests cover C arrays, cuda::std::array, and cuda::std::span; existing test call sites use arrays instead of index_sequence.

Changes: Group mapping

Layer / File(s) Summary
Range-based group_as mapping
cudax/include/cuda/experimental/coop/__group/fwd.cuh, cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh, cudax/include/cuda/experimental/coop/__group/synchronizer/interwarp_synchronizer.cuh
group_as stores a sized range whose values convert to uint32_t. It derives group counts and mapping validity from the range. Forward declarations and the interwarp synchronizer diagnostic use the _RangeView parameter name.
Range mapping test coverage
cudax/test/coop/group/mapping/group_as.cu, cudax/test/coop/group/mapping/composite_mapping.cu
Tests cover exhaustive and non-exhaustive mappings with C arrays, cuda::std::array, and cuda::std::span. Composite mapping tests use array-backed counts and expect dynamic group counts.
Array-based group_as call sites
cudax/test/coop/group/group_stacking.cu, cudax/test/coop/group/virtual_group_stacking.cu, cudax/test/coop/group/make_group.cu
These tests pass cuda::std::array values to group_as instead of index_sequence values.

Possibly related PRs

  • NVIDIA/cccl#12229: Both changes apply a range-view template contract to cudax::coop synchronizer components.

Priority: Normal

Change: Feature

Merge Risk: Low · up to fffca

Several narrow range-input cases can fail to compile or produce incorrect group mappings; address them before relying on the new flexibility.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · important: Cast __n to uint32_t before the braced _MappingResult… · group_as.cuh:114-125

cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh:114-125
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

important: Cast __n to uint32_t before the braced _MappingResult initialization.

__n keeps the range element type. The _MappingResult aggregate initializes its uint32_t __unit_count_ field from __n in braces. When the range element type is int or size_t, that conversion narrows. Narrowing in list-initialization is ill-formed when the source value is not a constant expression, and __i_count is not one. The class static_assert admits any element type convertible to uint32_t, so group_as accepts these ranges, but __do_map cannot compile for them.

Suggested fix
-        const auto __n          = __i_count;
+        const auto __n          = static_cast<::cuda::std::uint32_t>(__i_count);

ℹ️ Review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 72a288d
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 372375f7-8deb-4f21-a1c5-064901c0cdcb
📥 Commits

Reviewing files that changed from the base of the PR and between 72a288d and 4aab0d7.

📒 Files selected for processing: 8
  • cudax/include/cuda/experimental/coop/__group/fwd.cuh
  • cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh
  • cudax/include/cuda/experimental/coop/__group/synchronizer/interwarp_synchronizer.cuh
  • cudax/test/coop/group/group_stacking.cu
  • cudax/test/coop/group/make_group.cu
  • cudax/test/coop/group/mapping/composite_mapping.cu
  • cudax/test/coop/group/mapping/group_as.cu
  • cudax/test/coop/group/virtual_group_stacking.cu

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

Comment thread cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh
@davebayer davebayer changed the title [libcu++] Rework cudax::coop::group_as mapping [cudax] Rework cudax::coop::group_as mapping Oct 23, 2026
@github-actions

This comment has been minimized.

@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
  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 4811a1c
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: c7d01e7a-5ed4-4fc0-9eb8-d5ed3112e252
📥 Commits

Reviewing files that changed from the base of the PR and between 4aab0d7 and ed846e1.

📒 Files selected for processing: 1
  • cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.

Comment thread cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh

@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
  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 4811a1c
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: e08bc12a-f117-4422-a40b-59b0a8de063d
📥 Commits

Reviewing files that changed from the base of the PR and between ed846e1 and fffca4e.

📒 Files selected for processing: 1
  • cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh

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

Comment thread cudax/include/cuda/experimental/coop/__group/mapping/group_as.cuh
@davebayer
davebayer enabled auto-merge (squash) October 23, 2026 18:53
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 31m: Pass: 100%/73 | Total: 1d 02h | Max: 1h 14m | Hits: 34%/136590

See results here.

@davebayer
davebayer merged commit 27fee24 into NVIDIA:main Oct 26, 2026
100 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants