Skip to content

[cudax] Implement cudax::group_view - #10787

Merged
davebayer merged 2 commits into
NVIDIA:mainfrom
davebayer:group_view3
Aug 19, 2026
Merged

davebayer merged 2 commits into
NVIDIA:mainfrom
davebayer:group_view3

Conversation

@davebayer

Copy link
Copy Markdown
Contributor

Fixes #10754

@davebayer
davebayer requested review from a team as code owners August 13, 2026 11:42
@davebayer
davebayer requested a review from andralex August 13, 2026 11:42
@davebayer
davebayer requested a review from griwes August 13, 2026 11:42
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Aug 13, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Aug 13, 2026
@coderabbitai

coderabbitai Bot commented Aug 13, 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: e5750765-0682-4763-ba8e-b57bb178db0e

📥 Commits

Reviewing files that changed from the base of the PR and between c949401 and 4a7c9e3.

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

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


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added cuda::experimental::group_view for creating views over groups and subgroup units.
    • Added synchronization, hierarchy, mapping, count, rank, and static extent access through group views.
    • Added support for nested views and multiple execution levels, including threads, warps, blocks, clusters, and grids.
    • Improved group hierarchy access, synchronizer visibility, and validation of compatible group levels.
  • Tests

    • Added comprehensive CUDA coverage for construction, membership, synchronization, counts, ranks, static extents, and nested views.

Walkthrough

The change adds cuda::experimental::group_view, with mapped subgroup construction, synchronization reuse, hierarchy queries, count and rank operations, public header wiring, and CUDA tests across multiple hierarchy levels.

Changes

Group view implementation

Layer / File(s) Summary
Group contracts and count-rank helpers
cudax/include/cuda/experimental/__group/group.cuh, cudax/include/cuda/experimental/__group/this_group.cuh, cudax/include/cuda/experimental/__group/traits.cuh, libcudacxx/include/cuda/__hierarchy/hierarchy_level_base.h
Groups validate compatible unit hierarchies, expose hierarchy and synchronizer state, and use shared hierarchy-aware count and rank helpers.
Group view mapping and API
cudax/include/cuda/experimental/__group/fwd.cuh, cudax/include/cuda/experimental/__group/group_view.cuh
group_view supports group, unit/group, and nested view construction. It stores adapted mappings and synchronizer state, and exposes synchronization, hierarchy, count, and rank operations.
Public group_view exposure
cudax/include/cuda/experimental/group.cuh
The experimental umbrella header includes group_view.cuh.
Group view validation
cudax/test/CMakeLists.txt, cudax/test/group/group_view.cu
A Catch2 CUDA test target validates construction, membership, unit changes, nested views, counts, ranks, synchronization, and launches across hierarchy levels.

Assessment against linked issues

Objective Addressed Explanation
Provide cudax::group_view over an existing group, reuse its synchronization mechanism, and support further subgroup splitting [#10754] ✅

Suggested reviewers: andralex


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

🧹 Nitpick comments (4)
cudax/include/cuda/experimental/__group/group_view.cuh (1)

156-159: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

suggestion: static_count names its __parent parameter but does not use it, which can trigger unused-parameter warnings in system-header-disabled builds. Drop the name to match count_as and rank_as in this same class.

-  [[nodiscard]] _CCCL_DEVICE_API static constexpr ::cuda::std::size_t static_count(const _ParentGroup& __parent) noexcept
+  [[nodiscard]] _CCCL_DEVICE_API static constexpr ::cuda::std::size_t static_count(const _ParentGroup&) noexcept

_ParentMappingResult at line 60 is also unused in this class; remove it unless a follow-up commit needs it.

cudax/include/cuda/experimental/__group/synchronizer/level_synchronizer.cuh (1)

64-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

suggestion: the generic implementation now uses ::cuda::std::is_same_v, ::cuda::std::__always_false_v, and NV_IF_ELSE_TARGET directly, but this header includes only <cuda/hierarchy> and <cuda/std/__limits/numeric_limits.h>. Add the precise headers instead of relying on transitive includes.

 `#include` <cuda/hierarchy>
 `#include` <cuda/std/__limits/numeric_limits.h>
+#include <cuda/std/__type_traits/always_false.h>
+#include <cuda/std/__type_traits/is_same.h>
+
+#include <nv/target>

The coding guidelines state: "Include all headers needed by the symbols being used; do not rely on transitive includes" and "Use the most precise available header". Confirm the exact header that defines __always_false_v in the current tree.

Also applies to: 92-92

Source: Coding guidelines

cudax/test/group/group_view.cu (1)

11-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

suggestion: line 92 uses cuda::std::dynamic_extent, but the file does not include <cuda/std/span>. Add the direct include rather than relying on cuda/experimental/group.cuh.

 `#include` <cuda/std/type_traits>
 `#include` <cuda/std/utility>
+#include <cuda/std/span>
 `#include` <cuda/stream>

The coding guidelines state: "Include all headers needed by the symbols being used; do not rely on transitive includes."

Also applies to: 92-92

Source: Coding guidelines

cudax/test/group/synchronizer/barrier_synchronizer.cu (1)

106-114: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

suggestion: the updated calls match the new instance API, but this test does not cover the two other new members, view() and deinit(...). group_view depends on view() returning a usable instance, and deinit is the paired teardown for a barrier-backed instance. Add assertions for both, in the style of the existing do_sync checks.

     static_assert(noexcept(synchronizer_instance.do_sync_aligned(mapping_result, hierarchy)));
     synchronizer_instance.do_sync_aligned(mapping_result, hierarchy);
+
+    // Test view().
+    static_assert(noexcept(synchronizer_instance.view()));
+    const auto instance_view = synchronizer_instance.view();
+    instance_view.do_sync(mapping_result, hierarchy);

The cudax path instruction directs review focus to "correctness, lifetime/resource ownership, ... experimental API clarity, tests".

Source: Path instructions


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 27e01c67-c46e-42b5-b4da-b8255f8765fa

📥 Commits

Reviewing files that changed from the base of the PR and between 16bd510 and 2ed7cee.

📒 Files selected for processing (14)
  • cudax/include/cuda/experimental/__group/group.cuh
  • cudax/include/cuda/experimental/__group/group_view.cuh
  • cudax/include/cuda/experimental/__group/synchronizer/barrier_synchronizer.cuh
  • cudax/include/cuda/experimental/__group/synchronizer/lane_synchronizer.cuh
  • cudax/include/cuda/experimental/__group/synchronizer/level_synchronizer.cuh
  • cudax/include/cuda/experimental/__group/this_group.cuh
  • cudax/include/cuda/experimental/__group/traits.cuh
  • cudax/include/cuda/experimental/group.cuh
  • cudax/test/CMakeLists.txt
  • cudax/test/group/group_view.cu
  • cudax/test/group/synchronizer/barrier_synchronizer.cu
  • cudax/test/group/synchronizer/lane_synchronizer.cu
  • cudax/test/group/synchronizer/level_synchronizer.cu
  • libcudacxx/include/cuda/__hierarchy/hierarchy_level_base.h

Comment thread cudax/test/group/group_view.cu Resolved
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@griwes

griwes commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

I assume #10820 is how we want the changes in that PR to be merged, and then we want to merge that into here?

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

Caution

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

⚠️ Outside diff range comments (1)
cudax/include/cuda/experimental/__group/group.cuh (1)

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

important: Delete both copy operations for group. A copied valid group calls __synchronizer_instance_.deinit() twice. A synchronizer that performs completion or barrier cleanup can then observe duplicate participation. Replace the TODO with deleted copy constructor and copy-assignment declarations. As per path instructions, focus on “lifetime/resource ownership” for cudax/**/*.

Source: Path instructions

🧹 Nitpick comments (1)
cudax/test/group/group_view.cu (1)

60-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

suggestion: Add sync_aligned() coverage. group_view::sync_aligned() calls do_sync_aligned, but this test only calls sync(). Add calls for the same-unit, changed-unit, nested, and generic-group view cases.

Also applies to: 104-104, 150-150, 199-199

🔇 Additional comments (6)
cudax/include/cuda/experimental/__group/group_view.cuh (3)

83-117: important: Store __hier_ by value or reject rvalue parent groups. Each constructor binds __hier_ to storage owned by __group. A temporary parent leaves the view with a dangling hierarchy reference.


136-144: important: Skip synchronization when __mapping_result_ is invalid. Non-member threads otherwise call do_sync() or do_sync_aligned() with an invalid mapping result.


87-93: 🎯 Functional Correctness

important: Verify that group_view satisfies is_group and can construct a further-split group. group_view declares synchronizer_type but does not provide synchronizer(), unlike group and __this_group_base. The PR objective requires a viewed group to support further splitting.

cudax/include/cuda/experimental/__group/this_group.cuh (1)

158-240: LGTM!

cudax/include/cuda/experimental/__group/fwd.cuh (1)

72-73: LGTM!

cudax/test/group/group_view.cu (1)

225-229: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

important: Make the grid dimension divisible by the cluster dimension. CCCL defines grid_dims in blocks, and CUDA requires each grid dimension to be divisible by its cluster dimension. This configuration requests two blocks with clusters of three blocks, so the capability-gated launch is invalid. (nvidia.github.io)

-      cuda::grid_dims<2>(), cuda::cluster_dims<3>(), cuda::block_dims<128>(), cuda::cooperative_launch{});
+      cuda::grid_dims<3>(), cuda::cluster_dims<3>(), cuda::block_dims<128>(), cuda::cooperative_launch{});

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c535bad3-93a8-4f6d-9c77-0e916b330434

📥 Commits

Reviewing files that changed from the base of the PR and between 2ed7cee and a16e402.

📒 Files selected for processing (6)
  • cudax/include/cuda/experimental/__group/fwd.cuh
  • cudax/include/cuda/experimental/__group/group.cuh
  • cudax/include/cuda/experimental/__group/group_view.cuh
  • cudax/include/cuda/experimental/__group/this_group.cuh
  • cudax/test/CMakeLists.txt
  • cudax/test/group/group_view.cu
🚧 Files skipped from review as they are similar to previous changes (1)
  • cudax/test/CMakeLists.txt

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

@github-actions

This comment has been minimized.

@davebayer

Copy link
Copy Markdown
Contributor Author

I assume #10820 is how we want the changes in that PR to be merged, and then we want to merge that into here?

Yeah, I split this PR into multiple smaller PRs, sorry about that!

@github-actions

This comment has been minimized.

@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

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 63d82601-5306-4a2f-a48c-aea8cb3b37ac

📥 Commits

Reviewing files that changed from the base of the PR and between 398a2a8 and c949401.

📒 Files selected for processing (4)
  • cudax/include/cuda/experimental/__group/group.cuh
  • cudax/include/cuda/experimental/__group/group_view.cuh
  • cudax/include/cuda/experimental/__group/this_group.cuh
  • cudax/include/cuda/experimental/__group/traits.cuh
🚧 Files skipped from review as they are similar to previous changes (2)
  • cudax/include/cuda/experimental/__group/this_group.cuh
  • cudax/include/cuda/experimental/__group/group_view.cuh

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

@github-actions

This comment has been minimized.

@davebayer
davebayer enabled auto-merge (squash) August 18, 2026 13:32
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@davebayer
davebayer force-pushed the group_view3 branch 2 times, most recently from 8426bc8 to 75b36cb Compare August 18, 2026 16:00
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

⏱️ CCCL compile-time benchmark comparison: Public headers compile-time bench

Result: 0 regression row(s), 2 improvement row(s) above threshold.

Run Value
Config public-headers-gcc13
Baseline origin/main
Preset all-dev
Targets cub.headers.base, thrust.cpp.cuda.headers.base, libcudacxx.test.public_headers
GPU / launch args rtx2080 / --cuda 13.3 --host gcc13

Artifacts: reports and traces

Direct file processing

-f file-processing exclusive --sort total

🟢 Direct file processing — Improvements
Rank Improvement impact Selected Δ Baseline Current Event Matched traces
1 0.697121 -0.697121 5.527906 4.830785 Processing Header File: libcudacxx/include/cuda/std/__cccl/prologue.h 554
2 0.236337 -0.236337 1.710555 1.474218 Processing Header File: libcudacxx/include/cuda/std/__cccl/epilogue.h 554

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 1h 37m: Pass: 100%/158 | Total: 1d 05h | Max: 1h 03m | Hits: 100%/361175

See results here.

@davebayer
davebayer merged commit 55e3ce0 into NVIDIA:main Aug 19, 2026
538 of 546 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Aug 19, 2026
charan-003 pushed a commit to charan-003/cccl that referenced this pull request Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[FEA]: Provide cudax::group_view

3 participants