PyTorch CUDA cumsum reads past buffer past 2^30 elements
A ones-tensor repro shows an out-of-bounds global load in the GPU prefix-sum path once the length exceeds roughly a billion floats.
PyTorch can issue an illegal CUDA memory read when computing a cumulative sum on a tensor longer than 2^30 elements.
A minimal reproducer allocates a float32 ones tensor of length 2^30 + 1 on the GPU, runs torch.cumsum along the sole dimension, then synchronizes. NVIDIA's compute-sanitizer reports an invalid four-byte global read in the device scan kernel that implements the parallel prefix sum: the faulting address sits one byte past a multi-gigabyte allocation, hit by thread (0,0,0) in block (0,0,0).
The failure is an edge case of large-extent scan tiling and indexing, not a routine small-tensor path. Workloads that build multi-gigabyte prefix sums on CUDA (running totals, exclusive scans, and similar reductions) are the ones at risk. Without a sanitizer build the same bug may surface only as wrong tail values or a later opaque device error rather than a clean diagnostic.
The report was filed against pytorch/pytorch by kokol16.