Repository: pytorch
Issue: sparse.mm(coo, dense) produces wrong results on T4/V100 GPUs
Labels: module: sparse,triaged

### 🐛 Describe the bug

`sparse.mm(coo, dense)` produces wrong results on T4 GPUs.

```python
In [1]: import torch
   ...:
   ...: a = torch.sparse_coo_tensor(
   ...:     indices=torch.tensor([[1],
   ...:                           [2]]),
   ...:     values=torch.tensor([0.1940]),
   ...:     size=(2, 7))
   ...: b = torch.tensor([[ 0.1391, -0.1082, -0.7174,  0.7566,  0.3715, -1.0049,  0.0083,  0.3277,  0.2829, -0.8926],
   ...:                   [-0.1626, -0.8062, -0.1168, -1.6124, -0.1541, -0.0646, -0.5324,  0.0533, -0.0314, -0.7431],
   ...:                   [-1.1582, -0.0249, -0.7584, -0.4157,  0.6389, -0.2545, -1.2304, -1.5822,  0.6431,  0.9715],
   ...:                   [-1.3249, -1.0006, -0.4556,  0.4031, -0.7707, -1.1757, -0.1555, -0.6527,  0.2520,  0.4590],
   ...:                   [ 1.8932,  0.1633, -0.2634, -1.1079,  0.7673, -1.1230,  0.3047,  0.3896, -0.2520, -1.0066],
   ...:                   [ 0.2927, -1.1003,  1.9016, -1.5185,  1.6850, -1.3713,  0.2893,  0.3939,  0.6529, -0.5519],
   ...:                   [ 0.7724,  0.9300,  0.0463,  0.3486,  1.0300,  0.0132,  0.5492,  0.3500, -0.3119, -0.0407]])

# correct results on CPU
In [2]: torch.sparse.mm(a, b)
Out[2]:
tensor([[ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,
          0.0000,  0.0000],
        [-0.2247, -0.0048, -0.1471, -0.0806,  0.1239, -0.0494, -0.2387, -0.3069,
          0.1248,  0.1885]])

In [3]: device = torch.device("cuda:0")

# incorrect results on GPU
In [4]: torch.sparse.mm(a.to(device), b.to(device))
Out[4]:
tensor([[ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,  0.0000,
          0.0000,  0.0000],
        [-1.0377, -4.0358, -0.7311, -8.1426, -0.6466, -0.3724, -2.9007, -0.0404,
         -0.0322, -3.5270]], device='cuda:0')
```

The wrong results occur on T4/V100 + PyTorch 1.13.0/1.13.1. It disappears on T4/V100 + PyTorch 1.12.1 or A100 + PyTorch 1.13.0/1.13.1.


### Versions

```bash
PyTorch version: 1.13.0
Is debug build: False
CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.10.2
Libc version: glibc-2.27

Python version: 3.9.12 (main, Jun  1 2022, 11:38:51)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.15.0-163-generic-x86_64-with-glibc2.27
Is CUDA available: True
CUDA runtime version: 12.0.0
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: Tesla T4
Nvidia driver version: 525.60.13
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.22.3
[pip3] torch==1.13.0
[pip3] torchmetrics==0.9.2
[conda] blas                      1.0                         mkl
[conda] cudatoolkit               11.6.0               habf752d_9    nvidia
[conda] mkl                       2021.4.0           h06a4308_640
[conda] mkl-service               2.4.0            py39h7f8727e_0
[conda] mkl_fft                   1.3.1            py39hd3c417c_0
[conda] mkl_random                1.2.2            py39h51133e4_0
[conda] numpy                     1.22.3           py39he7a7128_0
[conda] numpy-base                1.22.3           py39hf524024_0
[conda] pytorch                   1.13.0          py3.9_cuda11.6_cudnn8.3.2_0    pytorch
[conda] pytorch-cuda              11.6                 h867d48c_1    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torchmetrics              0.9.2                    pypi_0    pypi
```

cc @nikitaved @pearu @cpuhrsch @amjames @bhosmer