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
{{ message }}
Repository navigation
Reductions along dims=2 drop to ~250 GB/s for 3072–4096 rows and fewer than ~2700 columns, slower than GPUArrays 11 #174
sum(x; dims=2) of a Float32 matrix runs at 1–1.26 TB/s for most shapes on an RTX 5090, but at 230–290 GB/s for some shapes with 3072–4096 rows and fewer than ~2700 columns. There it is slower than GPUArrays 11's own kernel was.
using CUDA, Printf
const FLUSH = CUDA.zeros(UInt8, 256*2^20) # larger than the L2 cachebench(f; n=30) = (f(); CUDA.synchronize(); minimum(1e6* (fill!(FLUSH, 0x00); CUDA.@elapsedf()) for _ in1:n)) # µsfor (M, N) in ((2048, 4096), (3072, 2730), (4096, 1024), (4096, 2048), (4096, 4096), (8192, 1024))
x = CUDA.randn(Float32, M, N)
t =bench(() ->sum(x; dims=2))
@printf("%5d × %-5d %6.1f µs %5.0f GB/s\n", M, N, t, 4M * N / t /1e3)
end
sum(x; dims=2), Float32, µs (GB/s read):
M × N
GPUArrays 11.5.16
GPUArrays 12.1.1
512 × 16384
92.2 (364)
26.6 (1262)
1024 × 8192
90.1 (372)
26.6 (1262)
2048 × 4096
86.0 (390)
26.6 (1260)
3072 × 2730
94.2 (356)
147.5 (227)
4096 × 1024
51.2 (328)
63.5 (264)
4096 × 2048
90.1 (372)
116.7 (288)
4096 × 4096
163.8 (410)
67.6 (993)
6144 × 1365
100.4 (334)
83.9 (400)
8192 × 1024
96.2 (349)
67.6 (497)
16384 × 512
104.4 (321)
43.0 (781)
32768 × 256
98.3 (341)
32.8 (1024)
The slow shapes sit between fast ones: 4096 × 2048 takes longer than 4096 × 4096, which reads twice as much. So it looks like the launch shape chosen for these sizes rather than a bandwidth limit. BFloat16 input and maximum behave the same (4096 × 2048: 112.6 and 114.7 µs).
Follow-up to JuliaGPU/CUDA.jl#3446, whose shapes are on the fast side. AcceleratedKernels 0.5.8, GPUArrays 12.1.1, CUDA.jl main (a9e28c0), against CUDA.jl 6.4.2 with GPUArrays 11.5.16; Julia 1.13.2, RTX 5090.
Activity
christiangnrd commentedon Oct 23, 2026
This might be a tuning thing since I'm not seeing this on my 3060:
maleadt commentedon Oct 25, 2026
Fixes by #176