Skip to content

[CUB] Refactor DeviceAdjacentDifference::SubtractLeft to always take an environment#9418

Open
miscco wants to merge 1 commit into
mainfrom
device_adjacent_difference_subtract_left_env
Open

[CUB] Refactor DeviceAdjacentDifference::SubtractLeft to always take an environment#9418
miscco wants to merge 1 commit into
mainfrom
device_adjacent_difference_subtract_left_env

Conversation

@miscco

@miscco miscco commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

closes

Checklist

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

@copy-pr-bot

copy-pr-bot Bot commented Jun 12, 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.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Jun 12, 2026
@miscco miscco marked this pull request as ready for review June 12, 2026 11:03
@miscco miscco requested a review from a team as a code owner June 12, 2026 11:03
@miscco miscco requested a review from bernhardmgruber June 12, 2026 11:03
@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Progress to In Review in CCCL Jun 12, 2026
@coderabbitai

coderabbitai Bot commented Jun 12, 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

DeviceAdjacentDifference SubtractLeft and SubtractLeftCopy overloads switch stream parameters to const EnvT& env, route execution through dispatch_with_env_and_tuning with a policy selector, update convenience-enable_if to require indirectly-binary-invocable, and add iterator concepts plus Catch2 tests covering multiple environment types and temp-storage usage.

Changes

Environment-based dispatch for SubtractLeft APIs*

Layer / File(s) Summary
Iterator binary invocability concepts
libcudacxx/include/cuda/std/__iterator/concepts.h
Add indirectly_binary_invocable and indirectly_regular_binary_invocable concepts extending unary patterns to two iterators with copy-constructibility, invocability across value/reference/common-reference operand combinations, and common-reference result constraints; provide both _CCCL_HAS_CONCEPTS() concept definitions and fallback _CCCL_CONCEPT/_CCCL_REQUIRES_EXPR macro implementations.
Temp-storage variant API contract and dispatch
cub/cub/device/device_adjacent_difference.cuh
Temp-storage SubtractLeftCopy and SubtractLeft replace cudaStream_t stream with const EnvT& env, add EnvT template parameter and API documentation, include cuda/std/__iterator/concepts.h, and route execution through dispatch_with_env_and_tuning into adjacent_difference::dispatch with the computed policy selector and left/read option.
Convenience overload signature and lambda forwarding
cub/cub/device/device_adjacent_difference.cuh
Convenience overloads change SFINAE constraints to require ::cuda::std::indirectly_binary_invocable<...>, take const EnvT& env by const reference, and adjust dispatch_with_env_and_tuning lambdas to forward storage/bytes with the policy_selector into adjacent_difference::dispatch.
CUB integration tests for environment variants
cub/test/catch2_test_device_adjacent_difference_substract_left.cu
Add CUDA standard execution headers and two Catch2 tests for SubtractLeft and SubtractLeftCopy that query temp-storage size with null calls, allocate user temp storage, run each API across multiple environment/policy variants (raw stream, cuda::stream, cuda::stream_ref, cuda::std::execution::env, cuda::execution::gpu), perform CUDA error checks and synchronization, and validate GPU outputs against std::adjacent_difference.
Iterator concept tests and support types
libcudacxx/test/libcudacxx/std/iterators/..., libcudacxx/test/support/indirectly_readable.h
Add compile-pass tests for indirectly_binary_invocable and indirectly_regular_binary_invocable with positive cases (GoodInvocable overload sets covering value/reference/common-reference combinations) and negative cases (non-copy-constructible invocables, deleted operator() for specific argument categories, return-type common-reference failures); add IndirectlyReadable2 support type mirroring existing pattern for two-iterator tests.

Possibly related PRs

  • NVIDIA/cccl#9318: Migrates other Device APIs to const EnvT& environment-based dispatch via dispatch_with_env_and_tuning.

Suggested reviewers

  • gevtushenko
  • shwina
  • gonidelis

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: 0203dc71-7802-4f71-a286-b6a226094643

📥 Commits

Reviewing files that changed from the base of the PR and between c345dcf and ba420ef.

📒 Files selected for processing (2)
  • cub/cub/device/device_adjacent_difference.cuh
  • cub/test/catch2_test_device_adjacent_difference_substract_left.cu

Comment thread cub/test/catch2_test_device_adjacent_difference_substract_left.cu
Comment thread cub/test/catch2_test_device_adjacent_difference_substract_left.cu
@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch 2 times, most recently from 3c91b42 to f351e63 Compare June 12, 2026 11:21
@copy-pr-bot

copy-pr-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment thread cub/cub/device/device_adjacent_difference.cuh Outdated
Comment thread cub/cub/device/device_adjacent_difference.cuh
Comment thread cub/test/catch2_test_device_adjacent_difference_substract_left.cu
Comment thread cub/test/catch2_test_device_adjacent_difference_substract_left.cu
@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch 2 times, most recently from 3c91b42 to 9004022 Compare June 12, 2026 12:04
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch from 9004022 to 30ac019 Compare June 12, 2026 15:30
@miscco miscco requested a review from a team as a code owner June 12, 2026 15:30
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch from 30ac019 to ebfba0b Compare June 15, 2026 06:56
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch 2 times, most recently from 32c5fb1 to 7e4f535 Compare June 15, 2026 12:51
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch from 7e4f535 to 9fdb70a Compare June 16, 2026 10:57
Comment thread cub/cub/device/device_adjacent_difference.cuh
Comment thread cub/cub/device/device_adjacent_difference.cuh Outdated
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch from 9fdb70a to 287fe50 Compare June 17, 2026 10:53
@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch from 287fe50 to ec65ce0 Compare June 17, 2026 10:53
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch from ec65ce0 to c77736c Compare June 22, 2026 09:50
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch from c77736c to ecb8b70 Compare June 23, 2026 07:11
…e an environment

We want to be able to pass tunings to the APIs that take user provided memory.
@miscco miscco force-pushed the device_adjacent_difference_subtract_left_env branch from ecb8b70 to 478203c Compare June 23, 2026 09:48
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 55m: Pass: 100%/287 | Total: 2d 20h | Max: 1h 15m | Hits: 99%/198283

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.

3 participants