Skip to content

Add cudax::distributed and cudax::returned_to specifiers for cooperative algorithms#9862

Merged
davebayer merged 1 commit into
NVIDIA:mainfrom
Jacobfaib:jacobf/2026-07-14/cooperative-result-specifiers
Jul 15, 2026
Merged

Add cudax::distributed and cudax::returned_to specifiers for cooperative algorithms#9862
davebayer merged 1 commit into
NVIDIA:mainfrom
Jacobfaib:jacobf/2026-07-14/cooperative-result-specifiers

Conversation

@Jacobfaib

Copy link
Copy Markdown
Contributor

Description

Add 2 more specifiers:

  • cudax::distributed
  • cudax::returned_to(rank)

For use in cooperative/distributed algorithms. These are in addition to cudax::broadcasted which allow the algorithm to specify how results are distributed across the participating callers.

  • broadcasted: All participating ranks will receive an identical result.
  • returned_to(rank): Only the specified rank will receive the result. All other ranks receive either no result or undefined values. It is up to the algorithm to define their precise value.
  • distributed: All participating ranks receive some slice of the result. For example when sorting, all ranks will receive a slice of the globally sorted array. Or when doing an exclusive/inclusive scan, all ranks will receive their portion of the global scan.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@Jacobfaib Jacobfaib self-assigned this Jul 14, 2026
@Jacobfaib Jacobfaib requested a review from a team as a code owner July 14, 2026 18:00
@Jacobfaib Jacobfaib requested a review from andralex July 14, 2026 18:00
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jul 14, 2026
@Jacobfaib Jacobfaib requested a review from davebayer July 14, 2026 18:01
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jul 14, 2026
{
enum class broadcasted_t : unsigned char
template <class _Derived>
class __result_policy_base

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted a common base class so that algorithms which handle multiple result policies can define the parameter as:

template <class Policy, ...>
algorithm(__result_policy_base<Policy> __res, ...)

instead of a generic T

@coderabbitai

coderabbitai Bot commented Jul 14, 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
📝 Walkthrough

Walkthrough

The result policy utility adds returned_to and distributed, changes broadcasted_t to derive from a shared base, and replaces the removed utility header in cooperative algorithm includes. The broadcasted reduce example is marked for Doxygen and added to its example paths.

Changes

Result policy integration

Layer / File(s) Summary
Result policy types and objects
cudax/include/cuda/experimental/__utility/result_policy.cuh
The header guard changes, broadcasted_t derives from a shared base, and returned_to and distributed policy types and objects are added.
Cooperative header dependency updates
cudax/include/cuda/experimental/__coop/any_of.cuh, cudax/include/cuda/experimental/__coop/reduce.cuh
Both cooperative headers replace the removed broadcasted utility include with result_policy.cuh.
Broadcasted reduce example documentation
cudax/test/coop/reduce/this_block.cu, docs/cudax/Doxyfile
The broadcasted reduce call receives documentation markers, and the reduce directory is added to Doxygen’s example paths.

Suggested reviewers: ericniebler, andralex, davebayer


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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d62a5015-08a4-4069-b0ec-64ecb1bb14b1

📥 Commits

Reviewing files that changed from the base of the PR and between faa1c1c and cdd19e1.

📒 Files selected for processing (3)
  • cudax/include/cuda/experimental/__coop/any_of.cuh
  • cudax/include/cuda/experimental/__coop/reduce.cuh
  • cudax/include/cuda/experimental/__utility/result_policy.cuh

Comment thread cudax/include/cuda/experimental/__utility/result_policy.cuh Outdated
@Jacobfaib Jacobfaib requested a review from a team as a code owner July 14, 2026 18:27
@Jacobfaib Jacobfaib requested a review from ericniebler July 14, 2026 18:27
@Jacobfaib Jacobfaib changed the title Add cudax::distributed and cudax::returned_to specifiers for cooperative algorithms Add cudax::distributed and cudax::returned_to specifiers for cooperative algorithms Jul 14, 2026
@Jacobfaib Jacobfaib requested a review from pciolkosz July 14, 2026 18:31
@Jacobfaib Jacobfaib force-pushed the jacobf/2026-07-14/cooperative-result-specifiers branch from 0a52594 to 2a09676 Compare July 14, 2026 19:09
@github-actions

This comment has been minimized.

@Jacobfaib Jacobfaib force-pushed the jacobf/2026-07-14/cooperative-result-specifiers branch from 4550350 to 76fdc8d Compare July 14, 2026 19:52
@github-actions

This comment has been minimized.

@Jacobfaib Jacobfaib force-pushed the jacobf/2026-07-14/cooperative-result-specifiers branch from 76fdc8d to 75d98f9 Compare July 14, 2026 22:00
@github-actions

This comment has been minimized.

@Jacobfaib Jacobfaib force-pushed the jacobf/2026-07-14/cooperative-result-specifiers branch from 5c3e4da to e2632e7 Compare July 15, 2026 13:20
Comment thread cudax/include/cuda/experimental/__utility/result_policy.cuh
@davebayer davebayer enabled auto-merge (squash) July 15, 2026 13:46
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 47m 31s: Pass: 100%/57 | Total: 8h 11m | Max: 47m 28s | Hits: 79%/47414

See results here.

@davebayer davebayer merged commit cb9f59f into NVIDIA:main Jul 15, 2026
78 of 80 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Jul 15, 2026
@Jacobfaib Jacobfaib deleted the jacobf/2026-07-14/cooperative-result-specifiers branch July 15, 2026 14:14
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.

3 participants