Repository: pytorch
Issue: Conv2d error on M1 mac, RuntimeError: NNPACK SpatialConvolution_updateOutput failed
Labels: module: convolution,triaged,module: macos,module: arm

### 🐛 Describe the bug

I encounter a runtime error when using Conv2d with padding in the forward pass on my M1 Mac. The error is RuntimeError: NNPACK SpatialConvolution_updateOutput failed

### How to reproduce the error
On a Macbook, install anaconda `osx-arm64` version, create a conda environment with python `3.10`, and install the latest version of Pytorch (1.13.0)

```
conda create -n test python=3.10
conda activate test 
conda install pytorch torchvision torchaudio -c pytorch
```

Then in this environment, some minimal code to reproduce this error is
```python
import torch
import torch.nn as nn

model = nn.Conv2d(3, 16, kernel_size=3, padding=3)
input = torch.rand(16, 3, 60, 60)
model(input)
```

The error message is this:
```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/anaconda3/envs/test/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/anaconda3/envs/test/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 463, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/opt/anaconda3/envs/test/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 459, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
RuntimeError: NNPACK SpatialConvolution_updateOutput failed
```

### More details from my testing results
I tested this code and found this error only happens on my Macbook pro with an M1 processor; this error does not happen on Ubuntu or Windows machines.

Also, this error only happens when I am using recent PyTorch versions`1.13.0`, `1.12.1`, or `1.12.0`. This error does not appear if I am using PyTorch version `1.11.0`.

Meanwhile, this error only happens when I have `padding=3` in the `nn.Conv2d` construction function. If I delete the `padding` argument, this code will run just fine.


### Versions
```
Collecting environment information...
PyTorch version: 1.13.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 13.0.1 (arm64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.202)
CMake version: Could not collect
Libc version: N/A

Python version: 3.10.8 (main, Nov  4 2022, 08:45:25) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-13.0.1-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
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.23.4
[pip3] torch==1.13.0
[pip3] torchaudio==0.13.0
[pip3] torchvision==0.14.0
[conda] numpy                     1.23.4          py310hb93e574_0  
[conda] numpy-base                1.23.4          py310haf87e8b_0  
[conda] pytorch                   1.13.0                 py3.10_0    pytorch
[conda] torchaudio                0.13.0                py310_cpu    pytorch
[conda] torchvision               0.14.0                py310_cpu    pytorch
```

cc @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr @abhudev