Repository: pytorch
Issue: Add nondeterministic alert to `.scatter_`
Labels: module: cuda,triaged,module: determinism,module: scatter & gather ops

### 🐛 Describe the bug

```python
import torch

input = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8, 9])
index = torch.tensor([0, 1, 1, 1, 2])
src = torch.tensor([11, 12, 13, 14, 15])
input.scatter_(0, index, src)
print("CPU result:")
print(input)

inputCuda = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8, 9]).cuda()
indexCuda = torch.tensor([0, 1, 1, 1, 2]).cuda()
srcCuda = torch.tensor([11, 12, 13, 14, 15]).cuda()
inputCuda.scatter_(0, indexCuda, srcCuda)
print("CUDA result:")
print(inputCuda)
```

run the code, you will get the different output:
```
CPU result:
tensor([11, 14, 15,  4,  5,  6,  7,  8,  9])
CUDA result:
tensor([11, 12, 15,  4,  5,  6,  7,  8,  9], device='cuda:0')
```
torch version is : torch==2.5.0a0+gitf5e704a
this issue is related to #88096. However, #88096 has been fixed. I can't repro their bugs. 

### Versions

<details>
<summary>click here to view the version env</summary>

```
Collecting environment information...
PyTorch version: 2.5.0a0+gitf5e704a
Is debug build: False
CUDA used to build PyTorch: 12.5
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Clang version: 16.0.1
CMake version: version 3.26.0
Libc version: glibc-2.31

Python version: 3.10.14 (main, May  6 2024, 19:42:50) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.4.0-192-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 12.5.82
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: Tesla V100-SXM2-32GB
GPU 1: Tesla V100-SXM2-32GB
GPU 2: Tesla V100-SXM2-32GB
GPU 3: Tesla V100-SXM2-32GB

Nvidia driver version: 555.42.06
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.9.3.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.3.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.3.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.3.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.3.0
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.3.0
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.3.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.3.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Byte Order:                         Little Endian
Address sizes:                      40 bits physical, 48 bits virtual
CPU(s):                             20
On-line CPU(s) list:                0-19
Thread(s) per core:                 1
Core(s) per socket:                 20
Socket(s):                          1
NUMA node(s):                       1
Vendor ID:                          GenuineIntel
CPU family:                         6
Model:                              85
Model name:                         Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz
Stepping:                           7
CPU MHz:                            2499.998
BogoMIPS:                           4999.99
Hypervisor vendor:                  KVM
Virtualization type:                full
L1d cache:                          640 KiB
L1i cache:                          640 KiB
L2 cache:                           80 MiB
L3 cache:                           16 MiB
NUMA node0 CPU(s):                  0-19
Vulnerability Gather data sampling: Unknown: Dependent on hypervisor status
Vulnerability Itlb multihit:        KVM: Vulnerable
Vulnerability L1tf:                 Mitigation; PTE Inversion
Vulnerability Mds:                  Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown:             Mitigation; PTI
Vulnerability Mmio stale data:      Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Retbleed:             Mitigation; IBRS
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; IBRS; IBPB conditional; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Vulnerable, KVM SW loop
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch topoext cpuid_fault invpcid_single pti ssbd ibrs ibpb fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat umip pku ospke avx512_vnni

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] optree==0.12.1
[pip3] torch==2.5.0a0+gitf5e704a
[pip3] triton==2.3.1
[conda] blas                      1.0                         mkl    defaults
[conda] cudatoolkit               11.8.0               h6a678d5_0    defaults
[conda] magma-cuda124             2.6.1                         1    pytorch
[conda] mkl                       2023.1.0         h213fc3f_46344    defaults
[conda] mkl-include               2024.2.1                 pypi_0    pypi
[conda] mkl-service               2.4.0           py310h5eee18b_1    defaults
[conda] mkl-static                2024.2.1                 pypi_0    pypi
[conda] mkl_fft                   1.3.8           py310h5eee18b_0    defaults
[conda] mkl_random                1.2.4           py310hdb19cb5_0    defaults
[conda] numpy                     1.26.4          py310h5f9d8c6_0    defaults
[conda] numpy-base                1.26.4          py310hb5e798b_0    defaults
[conda] optree                    0.12.1                   pypi_0    pypi
[conda] torch                     2.5.0a0+gitf5e704a           dev_0    <develop>
[conda] triton                    2.3.1                    pypi_0    pypi
```
</details>

cc @ptrblck @msaroufim @mruberry @kurtamohler