Skip to content

Document environments for the two-phase CUB device APIs - #12687

Merged
bernhardmgruber merged 5 commits into
NVIDIA:mainfrom
bernhardmgruber:cub-docs-two-phase-env
Nov 19, 2026
Merged

bernhardmgruber merged 5 commits into
NVIDIA:mainfrom
bernhardmgruber:cub-docs-two-phase-env

Conversation

@bernhardmgruber

@bernhardmgruber bernhardmgruber commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

With #11234, all two-phase CUB device APIs take an execution environment instead of a cudaStream_t (#9875). This updates the user docs, the developer guide and the env testing guidelines accordingly, and drops the now obsolete "that accept an environment" qualifier from the tuning sections of the device headers.

Fixes: #12680
Fixes: #9875

🤖 Generated with Claude Code

All two-phase CUB device APIs now take an execution environment instead of a
cudaStream_t. Update the user and developer documentation accordingly and drop
the obsolete "that accept an environment" qualifier from the tuning docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 18, 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.

@github-project-automation github-project-automation Bot moved this to Todo in CCCL Nov 18, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Nov 18, 2026
@bernhardmgruber
bernhardmgruber marked this pull request as ready for review November 18, 2026 23:28
@bernhardmgruber
bernhardmgruber requested review from a team as code owners November 18, 2026 23:28
@cccl-authenticator-app cccl-authenticator-app Bot moved this from In Progress to In Review in CCCL Nov 18, 2026
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Documentation
    • Expanded guidance on custom tuning policies across device-wide algorithms, including documented exceptions.
    • Updated API guidance for two-phase and single-phase calls, including how execution environments interact with caller-provided temporary storage and memory resources.
    • Revised testing guidance for API overloads, environment interactions, and custom streams.
    • Clarified the steps involved in classic two-phase calls and standardized terminology for API phases.

The change removes an environment dispatch utility and updates CUB documentation. The documentation covers environments on two-phase APIs, policy-selector tuning, and testing guidance for environment-aware overloads.

Changes: Environment API cleanup

Layer / File(s) Summary
Two-phase environment contract and utility
cub/cub/detail/env_dispatch.cuh, docs/cub/developer/device_scope.rst, docs/cub/device_wide.rst, docs/cub/environment.rst
Removes dispatch_with_env_validation_and_tuning. Documents environment parameters on two-phase APIs and states that they ignore the environment’s memory resource when callers provide temporary storage.
Policy-selector tuning documentation
cub/cub/device/device_adjacent_difference.cuh, cub/cub/device/device_copy.cuh, cub/cub/device/device_find.cuh, cub/cub/device/device_for.cuh, cub/cub/device/device_partition.cuh, cub/cub/device/device_radix_sort.cuh, cub/cub/device/device_reduce.cuh, cub/cub/device/device_segmented_sort.cuh, cub/cub/device/device_select.cuh, cub/cub/device/device_transform.cuh
Broadens the documented scope of custom policy-selector tuning beyond algorithms that accept an environment. The documentation retains stated algorithm exceptions.
Environment-aware API test guidance
docs/cub/developer/test_overview.rst
Updates the documented environment parameter convention, test coverage recommendations, and custom-stream test example.

Assessment against linked issues

Objective Addressed Explanation
Clean up environment overload utilities and documentation [#12680] ✅
Document that two-phase APIs ignore the environment memory resource [#9875] ✅
Complete the device-scope public API migration to environment parameters [#9875] ❌ This diff changes no public API declarations or overload implementations.

Possibly related issues

  • NVIDIA/cccl#11613: The PR updates environment-aware API testing guidance but does not modify or audit the test files discussed in the issue.

Suggested reviewers: griwes, gonidelis

Change: Other

Merge Risk: Low · up to 3ad4f

This change updates the CUB documentation and testing guidance for environment-aware two-phase APIs. A few statements remain inaccurate, covering the allocator warning, the deprecated ArgMin/ArgMax overloads, the allocation test checklist, and the custom-stream test guidance. These carry little merge risk, but correcting them would stop readers from being misled.

Architecture risk: Low · up to 3ad4f

The change affects 2 systems.

Changed systems: cub, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — cub (service) was modified; 11 changed files map to changed impact.
  • observed — docs (service) was modified; 4 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in cub/cub/detail/env_dispatch.cuh: Removed dispatch_with_env_validation_and_tuning, which validated the environment before delegating to automatic-storage dispatch with a tuning-policy selector.
  • observed — Modified behavior in cub/cub/device/device_adjacent_difference.cuh: The tuning documentation broadens the stated scope of custom policy-selector tuning from algorithms accepting an environment to all DeviceAdjacentDifference algorithms.
  • observed — Modified behavior in cub/cub/device/device_copy.cuh: The tuning documentation removes the restriction to Batched algorithms that accept an environment; it now describes tuning Batched algorithms generally.
  • observed — Modified behavior in cub/cub/device/device_find.cuh: The tuning documentation removes the restriction to FindIf algorithms that accept an environment; it now refers to the FindIf algorithms generally.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 9f91409
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: e33716bf-4a4c-433a-bb40-18b9daf5cec1
Commits

Reviewing files that changed from the base of the PR and between ad8ea04 and 3ad4fb1.

Files selected for processing: 1

  • docs/cub/developer/test_overview.rst

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

@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

Caution

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

⚠️ Outside diff range comments (1)

Minor · important: Limit the allocator warning to single-phase APIs. · environment.rst:255-258

docs/cub/environment.rst:255-258
Minor · Functional Correctness · Quick win

important: Limit the allocator warning to single-phase APIs.

Two-phase APIs now also accept environments, but they use caller-provided storage and ignore the environment's memory resource. The warning says the environment-based API requires cudaMallocAsync and advises passing a resource when it is unavailable. That advice does not apply to two-phase calls. State that the warning applies to automatic temporary-storage allocation.

As per path instructions, documentation changes must focus on “technical accuracy” and “API/version consistency.”

Source: Path instructions

Review info

Run configuration

  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 9f91409
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 6aeb4fec-8ced-4c83-9ede-d77adb8f22ec
Commits

Reviewing files that changed from the base of the PR and between 9f91409 and ad8ea04.

Files selected for processing: 15

  • cub/cub/detail/env_dispatch.cuh
  • cub/cub/device/device_adjacent_difference.cuh
  • cub/cub/device/device_copy.cuh
  • cub/cub/device/device_find.cuh
  • cub/cub/device/device_for.cuh
  • cub/cub/device/device_partition.cuh
  • cub/cub/device/device_radix_sort.cuh
  • cub/cub/device/device_reduce.cuh
  • cub/cub/device/device_segmented_sort.cuh
  • cub/cub/device/device_select.cuh
  • cub/cub/device/device_transform.cuh
  • docs/cub/developer/device_scope.rst
  • docs/cub/developer/test_overview.rst
  • docs/cub/device_wide.rst
  • docs/cub/environment.rst
Files with no reviewable changes: 1

  • cub/cub/detail/env_dispatch.cuh

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 cub/cub/device/device_reduce.cuh Resolved
Comment thread docs/cub/developer/test_overview.rst Resolved
Comment thread docs/cub/developer/test_overview.rst Resolved
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 3h 09m: Pass: 100%/210 | Total: 8d 03h | Max: 3h 09m | Hits: 35%/913762

See results here.

@bernhardmgruber
bernhardmgruber merged commit a394457 into NVIDIA:main Nov 19, 2026
242 checks passed
@bernhardmgruber
bernhardmgruber deleted the cub-docs-two-phase-env branch November 19, 2026 08:42
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Nov 19, 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.

Cleanup env overload utilities and docs [EPIC] Refactor CUB device-scope APIs to take an environment instead of cudaStream_t

2 participants