Repository: pytorch
Issue: torch.linalg.eigh crashe for matrices of size 2895×2895 or larger on eigen and M1
Labels: module: crash,triaged,module: linear algebra,module: m1

### 🐛 Describe the bug

### From python

```python
>>> import torch as t
>>> t.linalg.eigh(t.randn([2895, 2895]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: false INTERNAL ASSERT FAILED at "/var/tmp/portage/sci-libs/caffe2-1.12.0/work/pytorch-1.12.0/aten/src/ATen/native/LinearAlgebraUtils.h":288, please report a bug to PyTorch. torch.linalg.eigh: Argument 8 has illegal value. Most certainly there is a bug in the implementation calling the backend library.

>>> t.linalg.eigh(t.randn([2894, 2894]))
torch.return_types.linalg_eigh(
eigenvalues=tensor([-107.5161, -107.0879, -106.6525,  ...,  106.2521,  106.6649,
         107.0642]),
eigenvectors=tensor([[ 0.0078, -0.0312,  0.0016,  ..., -0.0169,  0.0231, -0.0228],
        [-0.0116, -0.0156, -0.0480,  ..., -0.0078, -0.0399, -0.0170],
        [-0.0112,  0.0034,  0.0137,  ...,  0.0073,  0.0098,  0.0088],
        ...,
        [ 0.0109, -0.0148,  0.0302,  ...,  0.0077, -0.0162,  0.0146],
        [-0.0004, -0.0294,  0.0220,  ..., -0.0102, -0.0062,  0.0327],
        [-0.0262,  0.0164, -0.0376,  ...,  0.0289, -0.0080, -0.0037]]))

>>> 2 ** 11.5
2896.309375740099
```

### From C++ interface

Can't get a backtrace with gdb, since `bt` says the program already exited. So it's just a mysterious undebuggable crash, until narrowing it down to a `torch::linalg::eigh` call.

```
 ** On entry to SSYEVD parameter number  8 had an illegal value
```

### See also?

Possibly related to #68291 / #51720?

### Versions

1.12

```
$ wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
--2022-08-21 09:45:24--  https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
Resolving raw.githubusercontent.com... 185.199.110.133, 185.199.108.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16906 (17K) [text/plain]
Saving to: ‘collect_env.py’

collect_env.py                                       100%[====================================================================================================================>]  16.51K  --.-KB/s    in 0.02s   

2022-08-21 09:45:24 (1009 KB/s) - ‘collect_env.py’ saved [16906/16906]

$ python collect_env.py 
Collecting environment information...
Traceback (most recent call last):
  File "~/collect_env.py", line 492, in <module>
    main()
  File "~/collect_env.py", line 475, in main
    output = get_pretty_env_info()
  File "~/collect_env.py", line 470, in get_pretty_env_info
    return pretty_str(get_env_info())
  File "~/collect_env.py", line 319, in get_env_info
    pip_version, pip_list_output = get_pip_packages(run_lambda)
  File "~/collect_env.py", line 301, in get_pip_packages
    out = run_with_pip(sys.executable + ' -mpip')
  File "~/collect_env.py", line 289, in run_with_pip
    for line in out.splitlines()
AttributeError: 'NoneType' object has no attribute 'splitlines'
```

cc @jianyuh @nikitaved @pearu @mruberry @walterddr @IvanYashchuk @xwang233 @Lezcano