[BUG] All_reduce over >INT_MAX elements hits RuntimeError
bugcuda
**Describe the bug**
CUDA global reductions fail when the input has more than `INT_MAX` elements.
**To Reproduce**
```python
import mlx.core as mx
a = mx.ones((32768, 32768, 2), dtype=mx.float16)
mx.eval(mx.sum(a))
```
This fails with:
`RuntimeError: cudaGraphAddKernelNode(&node, graph_, NULL, 0, ¶ms) failed: invalid argument`
**Expected behavior**
This reduction should complete and return a scalar.
**Desktop (please complete the following information):**
OS Version: Ubuntu 22.04.5 LTS
Version: mlx 0.31.1, mlx-cuda-13 0.31.1
GPU: NVIDIA RTX 6000 Ada Generation, driver 580.126.09
**Additional context**
32768 * 32768 * 2 == 2**31, which is one element past INT_MAX. Other reductions such as prod, min, max, all, and any hit the same issue.
关闭于 2026-05-31 0 条评论