trunk/9186b190a054d20bb060de831eb04008f55c61fd: [CUDA] Fix arange overflow for N >= 2**32 (#197713)
- PyTorch: 1363 events in the last 90 days
- PyTorch: 1346th Release in the last 90 days
- Previous: earlier the same day · trunk/41d371030d5075f7da60831759bfff8041395f21
What happened
Fixes #197673 block_work_size * blockIdx.x in elementwise_kernel_with_index is int * unsigned int , so it's computed in 32 bits and wraps before widening to index_t . For N >= 2**32, threads meant for index 2**32 + k write to index k instead, and the tail is never written. The fix casts to index_t before multiplying. This affects arange, range, linspace and logspace, since they share this helper. Test: the >2**32 ca…
Summary assembled by rule from the sources below