freenode
AI & ML

PyTorch CUDA upsampler reads past its input on extreme scales

A sanitizer run on PyTorch 2.13 found out-of-bounds global reads in trilinear 3D upsampling when a tiny volume is paired with a negative scale.

PyTorch's CUDA path for trilinear 3D upsampling can read past the tensor it was given when the input is a small five-dimensional volume filled with extreme values and one of the scale factors is negative.

The call that surfaces the bug is upsample_trilinear3d on a tensor of shape (1, 3, 9, 1, 8), filled with values around 4.14e+16, asking for an output of size (2, 4, 2) with scales that include -65504 and a second factor on the order of 1e+12. NVIDIA's compute-sanitizer reported an invalid 4-byte global read, attributed to the CUDA implementation of that op, on PyTorch 2.13.0 built with CUDA 12.6. The run was on Ubuntu with an RTX 3090.

Out-of-bounds device reads are a memory-safety failure: the kernel is supposed to stay inside the input allocation for every combination the front end accepts. The report says the index math does not, and that the library should either clamp those indices to the input extents or reject the combination with a clean error instead of touching neighboring GPU memory. No fix and no CVE are attached to the report.