Skip to content

Unwrap zip_iterators in DeviceTransform - #11255

Merged
bernhardmgruber merged 5 commits into
NVIDIA:mainfrom
bernhardmgruber:unwrap_zip_transform
Sep 8, 2026
Merged

bernhardmgruber merged 5 commits into
NVIDIA:mainfrom
bernhardmgruber:unwrap_zip_transform

Conversation

@bernhardmgruber

Copy link
Copy Markdown
Contributor

Fixes: #7442

@bernhardmgruber
bernhardmgruber requested review from a team as code owners September 8, 2026 08:49
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Sep 8, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: e10bb5eb-e8a5-46ca-8174-654d216952f5

📥 Commits

Reviewing files that changed from the base of the PR and between d1643d8 and 61a275c.

📒 Files selected for processing (1)
  • cub/test/catch2_test_device_transform.cu
🚧 Files skipped from review as they are similar to previous changes (1)
  • cub/test/catch2_test_device_transform.cu

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


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved CUDA and Thrust transform operations involving zipped iterators.
    • Ensured zipped inputs invoke the correct transformation logic and produce accurate results.
    • Improved consistency across CUDA and Thrust zipped-iterator implementations.
  • Tests

    • Added coverage confirming correct results for transformations using CUDA and Thrust zip iterators.
    • Expanded transform-related testing to validate zipped input handling across supported scenarios.
    • Added verification for separate sum and difference outputs when processing zipped data.

Walkthrough

Changes

DeviceTransform zip support

Layer / File(s) Summary
Add zip input detection and unpacking
cub/cub/device/device_transform.cuh
DeviceTransform detects CUDA and Thrust zip inputs, extracts their underlying iterator tuples and callables, and recursively uses the existing transform dispatch.
Remove duplicate CUDA transform unpacking
thrust/thrust/system/cuda/detail/transform.h
CUDA Thrust transform removes its specialized zip overloads and uses the generic CUB transform path.
Validate unwrapped zip transforms
cub/test/catch2_test_device_transform.cu, cub/benchmarks/bench/transform/grayscale.cu, cub/test/catch2_test_device_segmented_reduce_large_offsets.cu, thrust/testing/cuda/transform.cu
Tests verify CUDA and Thrust zip transformations with sum and difference outputs. Related sources add the required zip_function header.

Assessment against linked issues

Objective Addressed Explanation
Move CUDA and Thrust zip_iterator unpacking from thrust::transform to cub::DeviceTransform [#7442] ✅

Priority: ⬇️ Low — Defer the zip-iterator handling change because it is a targeted CUB and Thrust transform compatibility improvement without evidence of urgent external impact.

Merge Risk: 🔵 Low · up to 61a27

Zip-based Thrust transforms may copy callable objects rather than moving them, potentially rejecting move-only callables or adding unnecessary copying. The impact is bounded, but the path should be aligned before merge where possible.


Comment @coderabbitai help to get the list of available commands.

Comment thread cub/cub/device/device_transform.cuh Resolved
Comment thread cub/cub/device/device_transform.cuh Resolved
Co-authored-by: Michael Schellenberger Costa <[email protected]>

@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)
cub/cub/device/device_transform.cuh (1)

196-196: 🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

suggestion: Move THRUST_NS_QUALIFIER::zip_function<TransformOp>::underlying_function() when forwarding. The accessor returns Function&, so the current lvalue selects the generic __transform_internal overload by copying TransformOp. This adds a copy and rejects move-only callables. Use ::cuda::std::move(transform_op.underlying_function()) and add a move-only-callable test.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2d8a3715-628d-4050-a5d1-baf7c23e0a42

📥 Commits

Reviewing files that changed from the base of the PR and between 49c5144 and 499c67f.

📒 Files selected for processing (1)
  • cub/cub/device/device_transform.cuh

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

…rom docs

Removing <thrust/zip_function.h>/<thrust/iterator/zip_iterator.h> from
thrust/system/cuda/detail/transform.h broke a few files that relied on
the transitive include for thrust::make_zip_function. Add the include
directly where it's used.

Also wrap the thrust::zip_iterator/zip_function forward declarations in
device_transform.cuh with @cond/@endcond so Doxygen doesn't treat them
as duplicate declarations of the real Thrust classes.
@bernhardmgruber
bernhardmgruber requested a review from a team as a code owner September 8, 2026 11:02
@github-actions

This comment has been minimized.

Comment thread cub/cub/device/device_transform.cuh Resolved

@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

🧹 Nitpick comments (1)
cub/cub/device/device_transform.cuh (1)

136-137: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

suggestion: Both branches repeat the ::cuda::std::is_same_v<Predicate, ::cuda::always_true> test. Hoist it into a local constexpr bool and keep the two if constexpr conditions to the zip traits. This keeps the intent visible if a third zip flavor is added.

Also applies to: 147-148


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a7ef1ede-9ca8-4053-919c-4591f22c0c9c

📥 Commits

Reviewing files that changed from the base of the PR and between 455688d and d1643d8.

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

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

@bernhardmgruber
bernhardmgruber enabled auto-merge (squash) September 8, 2026 17:34
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 53m: Pass: 100%/230 | Total: 10d 04h | Max: 2h 46m | Hits: 45%/827538

See results here.

@bernhardmgruber
bernhardmgruber merged commit dbbbdcc into NVIDIA:main Sep 8, 2026
258 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Sep 8, 2026
@bernhardmgruber
bernhardmgruber deleted the unwrap_zip_transform branch September 9, 2026 07:45
kaatish pushed a commit to kaatish/cccl that referenced this pull request Sep 11, 2026
Fixes: NVIDIA#7442

Co-authored-by: Michael Schellenberger Costa <[email protected]>
charan-003 pushed a commit to charan-003/cccl that referenced this pull request Sep 15, 2026
Fixes: NVIDIA#7442

Co-authored-by: Michael Schellenberger Costa <[email protected]>
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.

Move zip_iterator unpacking logic form thrust::transform to cub::DeviceTransform

3 participants