Repository navigation
Hardcode DeviceTransform OffsetT to int64 - #9127
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
important: WalkthroughStandardizes DeviceTransform internals to use a fixed ::cuda::std::int64_t offset and updates benchmarks, tests, dispatch, kernels, and Thrust call-sites to pass element counts as int64_t and use int64_t-based Offset logic. ChangesDeviceTransform Offset Type Standardization
Assessment against linked issues
Suggested labels
Suggested reviewers
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cub/benchmarks/bench/transform/complex_cmp.cu (1)
32-43:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winimportant: benchmark accounting is inconsistent with the actual transform length. You execute
n - 1items on Line 42, but recordnon Line 36 and Line 38. Use the same count for execution and metrics so reported throughput is accurate.As per coding guidelines, "Use docs/cub/benchmarking.rst for benchmark conventions... keep axes comparable... and preserve useful comparison data."
🧹 Nitpick comments (1)
cub/test/catch2_test_device_transform.cu (1)
108-111: ⚡ Quick winsuggestion: Update comment to remove I32 offset type reference.
The comment mentions "Both deltas fit in I32 and I64 offset types," but the test now only uses
::cuda::std::int64_tsince offset types are hardcoded per this PR. Update the comment to clarify this test exercises the >4 GiB byte-offset regime with int64_t offsets only, removing the now-obsolete I32 mention.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 59a54297-0830-4d6c-92df-5b5f88afaa8c
📒 Files selected for processing (14)
cub/benchmarks/bench/transform/babelstream.cucub/benchmarks/bench/transform/common.hcub/benchmarks/bench/transform/complex_cmp.cucub/benchmarks/bench/transform/fib.cucub/benchmarks/bench/transform/fill.cucub/benchmarks/bench/transform/grayscale.cucub/benchmarks/bench/transform/heavy.cucub/benchmarks/bench/transform/pytorch.cucub/cub/device/device_transform.cuhcub/cub/device/dispatch/dispatch_transform.cuhcub/cub/device/dispatch/kernels/kernel_transform.cuhcub/test/catch2_test_device_transform.cucub/test/catch2_test_device_transform_if.cuthrust/thrust/system/cuda/detail/transform.h
miscco
left a comment
There was a problem hiding this comment.
Looks good to me, the regressions are small enough IMHO to be ignored.
I would also be curious if we could get rid of them by tuning with just the 64 bit offset
| ::cuda::std::tuple<RandomAccessIteratorsIn...> inputs, | ||
| RandomAccessIteratorOut output, | ||
| OffsetT num_items, | ||
| ::cuda::std::size_t num_items, |
There was a problem hiding this comment.
I changed the public API again to use a templated NumItemsT parameter, so a user does not suddenly get conversion warnings. I only cast to int64 before calling the dispatch layer now.
There was a problem hiding this comment.
Changed the occurrence here to int64
| const Offset offset = static_cast<Offset>(blockIdx.x) * tile_size; | ||
| const int valid_items = static_cast<int>((::cuda::std::min) (num_items - offset, Offset{tile_size})); | ||
| const int valid_items = static_cast<int>((::cuda::std::min) (num_items - offset, static_cast<Offset>(tile_size))); |
There was a problem hiding this comment.
Why do we still have a template Offset when it should always be int64_t?
There was a problem hiding this comment.
I left the dispatch and kernel as is for now, since I want to play a bit withuint64_t in the future. It did give a speedup in some runs, so I want to know why and whether we can extract that speedup somehow #8805 by using unsigned types in a few places in the kernel.
| }; | ||
|
|
||
| // Reduces the items_per_thread when necessary to generate enough blocks to reach the maximum occupancy. | ||
| template <typename Offset, typename Policy> |
There was a problem hiding this comment.
Ditto: Why is Offset still needed as a template argument?
There was a problem hiding this comment.
Same reason as above
12ed874 to
39955ac
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 3605c976-410b-4902-9735-813b6468e626
📒 Files selected for processing (14)
cub/benchmarks/bench/transform/babelstream.cucub/benchmarks/bench/transform/common.hcub/benchmarks/bench/transform/complex_cmp.cucub/benchmarks/bench/transform/fib.cucub/benchmarks/bench/transform/fill.cucub/benchmarks/bench/transform/grayscale.cucub/benchmarks/bench/transform/heavy.cucub/benchmarks/bench/transform/pytorch.cucub/cub/device/device_transform.cuhcub/cub/device/dispatch/dispatch_transform.cuhcub/cub/device/dispatch/kernels/kernel_transform.cuhcub/test/catch2_test_device_transform.cucub/test/catch2_test_device_transform_if.cuthrust/thrust/system/cuda/detail/transform.h
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cub/benchmarks/bench/transform/common.h (1)
79-84: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winimportant: Annotate
bench_transformwith a CCCL function API macro.
bench_transformis declared in a header without_CCCL_HOST_API,_CCCL_DEVICE_API, or_CCCL_API. Please add the appropriate annotation on this function declaration.As per coding guidelines, "All functions must be marked with _CCCL_HOST_API, _CCCL_DEVICE_API, or _CCCL_API".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 77e6018f-c6ca-411a-984f-388ee8c64293
📒 Files selected for processing (1)
cub/benchmarks/bench/transform/common.h
This comment has been minimized.
This comment has been minimized.
|
@NaderAlAwar thanks for the review and the good findings! I addressed your comments. Please have another look! |
🥳 CI Workflow Results🟩 Finished in 2h 30m: Pass: 100%/342 | Total: 14d 00h | Max: 2h 29m | Hits: 26%/1408254See results here. |
This change is going to cause a tiny regression (benchmarks in #8805, important ones repeated below). However, it:
thrust::transform(and any other Thrust call usingDeviceTransform, because we got rid of the index type dispatchDeviceTransformtestsDeviceTransformDeviceTransformI am gladly eating a small regression for these benefits. Here are the regressions:
A100 (1/200 workloads regressed):
H200 (1/200 workloads regressed):
B200 (4/200 workloads regressed):
Let me know if we need more benchmarks, like on non-data-center-grade GPUs.
Fixes: #8805