Incorrect image upscaling on MPS backend
Labels: triaged, module: mps

### 🐛 Describe the bug

Upscaling images via [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) works on-CPU, but produces visually-incorrect output using MPS backend on M1 Max.

Using PyTorch nightly build, `1.13.0.dev20220610`.

# Setup

I've made an [mps-repro](https://github.com/Birch-san/mps-repro) repository for this.  
[`repro.py` here](https://github.com/Birch-san/mps-repro/blob/main/repro.py).

```bash
git clone https://github.com/Birch-san/mps-repro.git
cd mps-repro

python3 -m venv venv
source ./venv/bin/activate
python3 -m pip install --upgrade pip

#--install Real-ESRGAN
git submodule update --init --recursive
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P Real-ESRGAN/experiments/pretrained_models
# GFPGAN is unnecessarily pinned to an old numpy, for which there is no M1 macOS release. my fork fixes this
pip install basicsr facexlib git+https://github.com/Birch-san/GFPGAN.git@newer-numpy
cd Real-ESRGAN
pip install -r requirements.txt
python setup.py develop
cd ..
#--done installing Real-ESRGAN

# our torch nightly probably got nuked by the above, but we do need it for GPU support on macOS
pip install --pre "torch==1.13.0.dev20220610" "torchvision==0.14.0.dev20220609" --extra-index-url https://download.pytorch.org/whl/nightly/
```

# Run

```bash
python repro.py --half_precision_float false --backend_type mps
python repro.py --half_precision_float true --backend_type mps
python repro.py --half_precision_float false --backend_type cpu
# --half_precision_float true on-CPU is unsupported, but that problem's not important.
```

# Results

Attempt to upscale this input image:

![Fruit hypothesized by imagen-pytorch](https://github.com/Birch-san/mps-repro/raw/main/in.jpg)

Fruit hypothesized by [imagen-pytorch](https://github.com/cene555/Imagen-pytorch).

## CPU

### Half-precision float

[Unsupported](https://github.com/pytorch/pytorch/issues/74625) (`"slow_conv2d_cpu" not implemented for 'Half'`), but that's not what our repro is investigating.

### Single-precision float

![Perfectly 2x upsampled fruit](https://github.com/Birch-san/mps-repro/raw/main/out_cpu_half_False.jpg)

Perfectly 2x upsampled fruit.

## MPS

### Half-precision float

![Overexposed, white-and-green, high-frequency formless mess](https://github.com/Birch-san/mps-repro/raw/main/out_mps_half_True.jpg)

Overexposed, white-and-green, high-frequency formless mess.

### Single-precision float

![Andy Warhol-esque desaturated tiled fruit](https://github.com/Birch-san/mps-repro/raw/main/out_mps_half_False.jpg)

Andy Warhol-esque desaturated fruit, tiled in tiles 2/3rd the width of the original image.

### Versions

```
PyTorch version: 1.13.0.dev20220610
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.4 (arm64)
GCC version: Could not collect
Clang version: 13.0.0 (clang-1300.0.29.30)
CMake version: version 3.22.1
Libc version: N/A

Python version: 3.9.12 (main, Jun  1 2022, 06:34:44)  [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-12.4-arm64-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.22.4
[pip3] torch==1.13.0.dev20220610
[pip3] torchvision==0.14.0.dev20220609
[conda] numpy                     1.23.0rc2                pypi_0    pypi
[conda] torch                     1.13.0.dev20220606          pypi_0    pypi
[conda] torchaudio                0.14.0.dev20220603          pypi_0    pypi
[conda] torchvision               0.14.0a0+f9f721d          pypi_0    pypi
```

cc @kulinseth @albanD