You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I implemented the iterator unpacking in a branch and made DeviceReduce and DeviceTransform use it. the results are
Contiguous adaptor unwrap: integer types
Vectorized loads of a cuda::transform_iterator over a device pointer, compared with the same algorithm on a raw pointer. The new path unwraps the base pointer, vector-loads that storage, and rebases the adaptor so the functor still runs. A raw pointer uses the same load and is retargeted onto the staged values.
Types are the CCCL integer list: int8_t, int16_t, int32_t, int64_t, and __int128_t (int128_t). The load path depends on the storage size, not the sign, so each unsigned type matches the signed type of the same width.
DeviceReduce vectorizes only when the stored element is at most 8 bytes, so __int128_t stays on the scalar load. DeviceTransform takes the new vector load only when sizeof(T) * VecSize is a power of two and at most 32 bytes. With the default vector width of 4 elements, __int128_t is 64 bytes and stays on the scalar loop.
Setup
Algorithms: cub::DeviceReduce::Sum and cub::DeviceTransform::Transform
Input: raw pointer, or cuda::transform_iterator of that pointer with a same-type + 1 functor. DeviceTransform applies + 1 either in the algorithm (pointer) or in the iterator (adaptor), so both sides do one add
Sizes: 2^24 (16,777,216) and 2^28 (268,435,456) elements
nvbench cold samples, 6 second timeout per configuration, clocks unlocked
Change is (before - after) / before. Positive means the new load is faster. Noise is the larger of the two relative standard deviations
GPUs:
NVIDIA RTX A6000, sm_86, 768 GB/s bus
NVIDIA RTX PRO 6000 Blackwell, sm_120, 1792 GB/s bus
Findings
The win is DeviceReduce of a transform iterator on Blackwell, and it shrinks as the element gets wider. __int128_t is unchanged because it is not vectorized.
Type
2^24
2^28
After matches the pointer
int8_t
+17.0%
+9.4%
yes (1024 and 1436 GB/s)
int16_t
+7.0%
+4.6%
yes (1259 and 1512 GB/s)
int32_t
+0.1%
+2.6%
yes at 2^28 (1566 GB/s)
int64_t
+0.0%
+0.0%
already matched (1589 GB/s)
__int128_t
−0.0%
−0.0%
already matched (1607 GB/s)
The 2^24 int8_t sample has 5.0% noise; 17% is still outside it. The other Blackwell reduction gains above are outside their noise (0.2% to 1.1%).
On the A6000, only the large int8_t reduction is above noise: +2.8% at 2^28 (noise 1.9%), from 666 GB/s to 686 GB/s, matching the pointer. Wider reductions, including __int128_t, were already at the pointer time (about 710 GB/s at 2^28).
DeviceTransform does not close a gap for 1- to 8-byte types. Pointer and transform iterator were already within noise of each other on both GPUs, except two A6000 slowdowns:
int64_t: −1.6% at 2^24 (noise 0.3%) and −1.4% at 2^28 (noise 1.0%)
__int128_t: −1.2% at 2^24 (noise 0.7%) and −1.1% at 2^28 (noise 0.7%)
__int128_tDeviceTransform of a transform iterator is also far below the pointer on both GPUs, and this change does not move it. On the A6000 it is about 360 GB/s against a pointer at 681 GB/s. On Blackwell it is about 1100 GB/s against a pointer at 1465 GB/s.
Raw-pointer times do not change on either GPU, for either algorithm.
DeviceReduce
Bandwidth counts the input bytes only.
DeviceReduce measurements
A6000, raw pointer
Type
Elements
Before (µs)
After (µs)
Change
Noise
Before (GB/s)
After (GB/s)
int8_t
2^24
35.79
35.80
−0.0%
1.57%
468.7
468.6
int8_t
2^28
391.20
391.24
−0.0%
1.88%
686.2
686.1
int16_t
2^24
59.76
59.73
+0.1%
0.88%
561.5
561.7
int16_t
2^28
767.73
767.85
−0.0%
1.31%
699.3
699.2
int32_t
2^24
106.79
106.81
−0.0%
0.48%
628.4
628.3
int32_t
2^28
1520.83
1520.85
−0.0%
0.98%
706.0
706.0
int64_t
2^24
200.98
200.96
+0.0%
0.56%
667.8
667.9
int64_t
2^28
3028.31
3028.36
−0.0%
0.69%
709.1
709.1
__int128_t
2^24
390.31
390.32
−0.0%
0.14%
687.8
687.7
__int128_t
2^28
6041.65
6041.79
−0.0%
0.61%
710.9
710.9
A6000, transform iterator
Type
Elements
Before (µs)
After (µs)
Change
Noise
Before (GB/s)
After (GB/s)
int8_t
2^24
36.12
35.67
+1.2%
1.55%
464.5
470.3
int8_t
2^28
402.97
391.62
+2.8%
1.86%
666.1
685.5
int16_t
2^24
59.72
59.58
+0.2%
0.91%
561.9
563.2
int16_t
2^28
770.21
768.10
+0.3%
1.40%
697.0
699.0
int32_t
2^24
106.66
106.62
+0.0%
0.51%
629.2
629.4
int32_t
2^28
1522.95
1521.01
+0.1%
1.01%
705.0
705.9
int64_t
2^24
200.87
201.07
−0.1%
0.28%
668.2
667.5
int64_t
2^28
3029.83
3029.44
+0.0%
0.86%
708.8
708.9
__int128_t
2^24
390.30
390.38
−0.0%
0.15%
687.8
687.6
__int128_t
2^28
6047.03
6047.72
−0.0%
1.01%
710.3
710.2
Blackwell, raw pointer
Type
Elements
Before (µs)
After (µs)
Change
Noise
Before (GB/s)
After (GB/s)
int8_t
2^24
16.39
16.39
+0.0%
0.46%
1023.8
1023.9
int8_t
2^28
186.69
186.72
−0.0%
0.59%
1437.9
1437.6
int16_t
2^24
26.64
26.64
+0.0%
0.76%
1259.4
1259.5
int16_t
2^28
355.16
355.12
+0.0%
0.29%
1511.7
1511.8
int32_t
2^24
49.16
49.16
−0.0%
0.26%
1365.2
1365.1
int32_t
2^28
686.73
686.72
+0.0%
0.15%
1563.6
1563.6
int64_t
2^24
93.26
93.25
+0.0%
1.13%
1439.1
1439.3
int64_t
2^28
1351.24
1351.41
−0.0%
0.12%
1589.3
1589.1
__int128_t
2^24
182.50
182.50
+0.0%
0.38%
1470.9
1470.9
__int128_t
2^28
2672.19
2672.13
+0.0%
0.05%
1607.3
1607.3
Blackwell, transform iterator
Type
Elements
Before (µs)
After (µs)
Change
Noise
Before (GB/s)
After (GB/s)
int8_t
2^24
19.73
16.38
+17.0%
5.01%
850.3
1024.0
int8_t
2^28
206.37
186.92
+9.4%
0.64%
1300.7
1436.1
int16_t
2^24
28.68
26.66
+7.0%
1.06%
1170.1
1258.8
int16_t
2^28
372.16
355.04
+4.6%
0.47%
1442.6
1512.1
int32_t
2^24
49.25
49.19
+0.1%
0.87%
1362.7
1364.2
int32_t
2^28
703.92
685.62
+2.6%
0.19%
1525.4
1566.1
int64_t
2^24
93.88
93.84
+0.0%
0.87%
1429.7
1430.3
int64_t
2^28
1351.07
1350.99
+0.0%
0.13%
1589.5
1589.6
__int128_t
2^24
182.19
182.20
−0.0%
0.35%
1473.4
1473.3
__int128_t
2^28
2671.85
2671.97
−0.0%
0.05%
1607.5
1607.4
DeviceTransform
Bandwidth counts the input bytes plus the output bytes.
The tables above keep the vectorized load for a transform iterator. This run selects ublockcopy for that iterator on the Blackwell GPU. A raw pointer was already on ublockcopy, so its column is a rerun of the same path. Positive means this run is faster. Same sizes, cold GPU time, 6 second timeout, clocks unlocked. The stopping rule is nvbench's entropy criterion.
The __int128_t transform iterator is the change. It now matches the pointer. The other outside-noise movements are the noisy int16_t 2^24 samples (pointer +5.4%, iterator −4.2%, noise about 3%) and a few 2^28 samples under 0.5%.
Same cold-sample setup as the example in #11840: entropy stopping, 6 second timeout, clocks unlocked. Sizes are 2^20, 2^24, 2^28, and 2^31. Bandwidth is the bytes that configuration actually moves. For int8_t that is 2 bytes per element on both sides, so the time gap is the comparison. For wider T the iterator side reads the symbol and writes uint8_t, and the time gap is the extra traffic. A positive gap means the iterator scan was faster. Noise is the larger relative standard deviation of the two GPU times. A 2^20 run is launch overhead on both GPUs.
Performance analysis
The int8_t case is the direct comparison with issue 11840 because both paths move one input byte and one output byte per element. On Blackwell, the original fancy-iterator path was slower than the pointer path by 34.4% at 2^24, 8.0% at 2^28, and 3.4% at 2^31. After enabling lookahead for the adaptors, those gaps are 5.6%, 0.04%, and 0.04%, respectively. The 2^28 and 2^31 iterator times now match the pointer within noise. The remaining 2^24 difference is slightly outside noise (5.6% versus 4.3%); it is much smaller than the original gap but is not fully closed.
The absolute Blackwell iterator time improves against the original issue measurement from 32.36 to 24.67 µs at 2^24 (23.8%), from 392.18 to 363.57 µs at 2^28 (7.3%), and from 2.996 to 2.898 ms at 2^31 (3.3%). The pointer measurements at 2^28 and 2^31 are effectively unchanged, so the convergence comes from accelerating the iterator path rather than slowing the baseline. The 2^20 result is launch-bound and does not show a useful change.
For wider input types, elapsed time alone is not an iterator-overhead comparison: the pointer baseline always transfers 2 bytes per element, while the iterator transfers sizeof(T) + 1. If both paths have the same memory efficiency, their expected time ratios are therefore 1.5× for int16_t, 2.5× for int32_t, 4.5× for int64_t, and 8.5× for __int128_t.
At 2^31 on Blackwell, the measured ratios are 1.46×, 2.37×, 4.62×, and 8.94×. Equivalently, iterator bandwidth is 103%, 106%, 97%, and 95% of pointer bandwidth. This is close to traffic scaling across all widths: rebasing and applying the input/output functors adds little cost once the scan is bandwidth-bound. __int128_t has the largest residual, about 5%, after the lookahead tile is reduced to fit its 16-byte input storage in shared memory.
The A6000 uses classic lookback rather than the new lookahead adaptor path. Its int8_t pointer and iterator times remain equal within noise, confirming that iterator dispatch itself has no material penalty there. Wider iterator cases report 1.20× to 1.39× the pointer bandwidth at 2^31. That does not make them faster in elapsed time: the wider cases still transfer 1.5× to 8.5× more data. It shows that the 1-byte pointer scan underutilizes memory bandwidth and that wider accesses amortize the lookback scan's fixed per-item work more effectively.
Activity
miscco commentedon Oct 9, 2026
I implemented the iterator unpacking in a branch and made DeviceReduce and DeviceTransform use it. the results are
Contiguous adaptor unwrap: integer types
Vectorized loads of a
cuda::transform_iteratorover a device pointer, compared with the same algorithm on a raw pointer. The new path unwraps the base pointer, vector-loads that storage, and rebases the adaptor so the functor still runs. A raw pointer uses the same load and is retargeted onto the staged values.Types are the CCCL integer list:
int8_t,int16_t,int32_t,int64_t, and__int128_t(int128_t). The load path depends on the storage size, not the sign, so each unsigned type matches the signed type of the same width.DeviceReducevectorizes only when the stored element is at most 8 bytes, so__int128_tstays on the scalar load.DeviceTransformtakes the new vector load only whensizeof(T) * VecSizeis a power of two and at most 32 bytes. With the default vector width of 4 elements,__int128_tis 64 bytes and stays on the scalar loop.Setup
cub::DeviceReduce::Sumandcub::DeviceTransform::Transformcuda::transform_iteratorof that pointer with a same-type+ 1functor.DeviceTransformapplies+ 1either in the algorithm (pointer) or in the iterator (adaptor), so both sides do one add(before - after) / before. Positive means the new load is faster. Noise is the larger of the two relative standard deviationsFindings
The win is
DeviceReduceof a transform iterator on Blackwell, and it shrinks as the element gets wider.__int128_tis unchanged because it is not vectorized.int8_tint16_tint32_tint64_t__int128_tThe 2^24
int8_tsample has 5.0% noise; 17% is still outside it. The other Blackwell reduction gains above are outside their noise (0.2% to 1.1%).On the A6000, only the large
int8_treduction is above noise: +2.8% at 2^28 (noise 1.9%), from 666 GB/s to 686 GB/s, matching the pointer. Wider reductions, including__int128_t, were already at the pointer time (about 710 GB/s at 2^28).DeviceTransformdoes not close a gap for 1- to 8-byte types. Pointer and transform iterator were already within noise of each other on both GPUs, except two A6000 slowdowns:int64_t: −1.6% at 2^24 (noise 0.3%) and −1.4% at 2^28 (noise 1.0%)__int128_t: −1.2% at 2^24 (noise 0.7%) and −1.1% at 2^28 (noise 0.7%)__int128_tDeviceTransformof a transform iterator is also far below the pointer on both GPUs, and this change does not move it. On the A6000 it is about 360 GB/s against a pointer at 681 GB/s. On Blackwell it is about 1100 GB/s against a pointer at 1465 GB/s.Raw-pointer times do not change on either GPU, for either algorithm.
DeviceReduce
Bandwidth counts the input bytes only.
DeviceReduce measurements
A6000, raw pointer
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tA6000, transform iterator
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tBlackwell, raw pointer
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tBlackwell, transform iterator
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tDeviceTransform
Bandwidth counts the input bytes plus the output bytes.
DeviceTransform measurements
A6000, raw pointer
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tA6000, transform iterator
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tBlackwell, raw pointer
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tBlackwell, transform iterator
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tmiscco commentedon Oct 9, 2026
Blackwell DeviceTransform with ublockcopy
The tables above keep the vectorized load for a transform iterator. This run selects ublockcopy for that iterator on the Blackwell GPU. A raw pointer was already on ublockcopy, so its column is a rerun of the same path. Positive means this run is faster. Same sizes, cold GPU time, 6 second timeout, clocks unlocked. The stopping rule is nvbench's entropy criterion.
The
__int128_ttransform iterator is the change. It now matches the pointer. The other outside-noise movements are the noisyint16_t2^24 samples (pointer +5.4%, iterator −4.2%, noise about 3%) and a few 2^28 samples under 0.5%.Blackwell ublockcopy measurements
Raw pointer
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tTransform iterator
int8_tint8_tint16_tint16_tint32_tint32_tint64_tint64_t__int128_t__int128_tmiscco commentedon Oct 9, 2026
DeviceScan segment reset
Same cold-sample setup as the example in #11840: entropy stopping, 6 second timeout, clocks unlocked. Sizes are 2^20, 2^24, 2^28, and 2^31. Bandwidth is the bytes that configuration actually moves. For
int8_tthat is 2 bytes per element on both sides, so the time gap is the comparison. For widerTthe iterator side reads the symbol and writesuint8_t, and the time gap is the extra traffic. A positive gap means the iterator scan was faster. Noise is the larger relative standard deviation of the two GPU times. A 2^20 run is launch overhead on both GPUs.Performance analysis
The
int8_tcase is the direct comparison with issue 11840 because both paths move one input byte and one output byte per element. On Blackwell, the original fancy-iterator path was slower than the pointer path by 34.4% at 2^24, 8.0% at 2^28, and 3.4% at 2^31. After enabling lookahead for the adaptors, those gaps are 5.6%, 0.04%, and 0.04%, respectively. The 2^28 and 2^31 iterator times now match the pointer within noise. The remaining 2^24 difference is slightly outside noise (5.6% versus 4.3%); it is much smaller than the original gap but is not fully closed.The absolute Blackwell iterator time improves against the original issue measurement from 32.36 to 24.67 µs at 2^24 (23.8%), from 392.18 to 363.57 µs at 2^28 (7.3%), and from 2.996 to 2.898 ms at 2^31 (3.3%). The pointer measurements at 2^28 and 2^31 are effectively unchanged, so the convergence comes from accelerating the iterator path rather than slowing the baseline. The 2^20 result is launch-bound and does not show a useful change.
For wider input types, elapsed time alone is not an iterator-overhead comparison: the pointer baseline always transfers 2 bytes per element, while the iterator transfers
sizeof(T) + 1. If both paths have the same memory efficiency, their expected time ratios are therefore 1.5× forint16_t, 2.5× forint32_t, 4.5× forint64_t, and 8.5× for__int128_t.At 2^31 on Blackwell, the measured ratios are 1.46×, 2.37×, 4.62×, and 8.94×. Equivalently, iterator bandwidth is 103%, 106%, 97%, and 95% of pointer bandwidth. This is close to traffic scaling across all widths: rebasing and applying the input/output functors adds little cost once the scan is bandwidth-bound.
__int128_thas the largest residual, about 5%, after the lookahead tile is reduced to fit its 16-byte input storage in shared memory.The A6000 uses classic lookback rather than the new lookahead adaptor path. Its
int8_tpointer and iterator times remain equal within noise, confirming that iterator dispatch itself has no material penalty there. Wider iterator cases report 1.20× to 1.39× the pointer bandwidth at 2^31. That does not make them faster in elapsed time: the wider cases still transfer 1.5× to 8.5× more data. It shows that the 1-byte pointer scan underutilizes memory bandwidth and that wider accesses amortize the lookback scan's fixed per-item work more effectively.DeviceScan measurements
Blackwell, lookahead
int8_tint8_tint8_tint8_tint16_tint16_tint16_tint16_tint32_tint32_tint32_tint32_tint64_tint64_tint64_tint64_t__int128_t__int128_t__int128_t__int128_tA6000, classic lookback
int8_tint8_tint8_tint8_tint16_tint16_tint16_tint16_tint32_tint32_tint32_tint32_tint64_tint64_tint64_tint64_t__int128_t__int128_t__int128_t__int128_tbernhardmgruber commentedon Nov 3, 2026
I don't think, we will need that. We just unpack and rebase iterators, where these operations for contiguous iterators are just identity operations.