Repository: pytorch
Issue: Different Cholesky results between Windows & Linux
Labels: module: windows,triaged,module: linear algebra,module: edge cases

### 🐛 Describe the bug

Computing Cholesky on a large matrix fails on Windows. To reproduce:
```
import torch
chol = torch.linalg.cholesky(torch.eye(53248, 53248, dtype=torch.float32, device='cuda:0'))
```
On Windows with torch==2.3.0 and numpy==1.26.4 with CUDA 12.1, the result is:
```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
torch._C._LinAlgError: linalg.cholesky: The factorization could not be completed because the input is not positive-definite (the leading minor of order 40961 is not positive-definite).
```
This answer should be the identity matrix (and the input identity clearly is positive definite).

The result is the same even if I vary the torch and numpy versions up/down a few notches from the above versions (including testing the latest of each), as well as varying the Python versions (3.10 to 3.12). I am not sure if torch==2.4.0 compiles all kernels against numpy 2.x on Windows though, so I may not have fully validated numpy==2.0 in combination with torch.

The result is the same on a 24GB as well as a 48GB GPU (both should have enough VRAM to perform the operation). The result is also unchanged between a TCC mode GPU or WDDM.

In WSL, on the same hardware, the correct result is obtained. Another user independently confirmed it works in native Linux as well. In Windows, the correct result is obtained when computing on the cpu instead of GPU.

If the dimensions of the matrix are reduced to, egs., 47500 (found by randomly trying):
```
import torch
chol = torch.linalg.cholesky(torch.eye(47500, 47500, dtype=torch.float32, device='cuda:0'))
```
the result is correct on both a 24GB and 48GB GPU in Windows. But a dimension of around 48000x48000 or above produces the above error message (while not doing so in WSL/Linux).

Unsure if the issue originates with Pytorch or Numpy. This may affect more than just `torch.linalg.cholesky`, I haven't tested.

### Versions

PyTorch version: 2.3.1+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 Pro
GCC version: Could not collect
Clang version: Could not collect
CMake version: version 3.25.0-rc4
Libc version: N/A

Python version: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19045-SP0
Is CUDA available: True
CUDA runtime version: 12.1.66
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA GeForce RTX 4090
GPU 1: NVIDIA RTX 6000 Ada Generation
GPU 2: NVIDIA RTX 6000 Ada Generation
GPU 3: NVIDIA RTX 6000 Ada Generation
GPU 4: NVIDIA RTX 6000 Ada Generation
GPU 5: NVIDIA RTX 6000 Ada Generation
GPU 6: NVIDIA RTX 6000 Ada Generation
GPU 7: NVIDIA RTX 6000 Ada Generation
GPU 8: NVIDIA RTX 6000 Ada Generation
GPU 9: NVIDIA RTX 6000 Ada Generation

Nvidia driver version: 560.70
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture=9
CurrentClockSpeed=2701
DeviceID=CPU0
Family=107
L2CacheSize=32768
L2CacheSpeed=
Manufacturer=AuthenticAMD
MaxClockSpeed=2701
Name=AMD Ryzen Threadripper PRO 5995WX 64-Cores
ProcessorType=3
Revision=2050

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.26.4
[pip3] onnx==1.13.0
[pip3] onnx-graphsurgeon==0.3.12
[pip3] torch==2.3.1+cu121
[pip3] torchaudio==2.3.1+cu121
[pip3] torchvision==0.18.1+cu121
[conda] No relevant packages

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite @jianyuh @nikitaved @pearu @mruberry @walterddr @xwang233 @Lezcano