Repository: pytorch
Issue: [vulkan] Vulkan backend fails creating tensor on x86_64 Linux
Labels: triaged,module: vulkan

### 🐛 Describe the bug

I tried building PyTorch manually with the Vulkan backend enabled on an x86_64 Ubuntu 20.04 system.
However, when creating a tensor object on a Vulkan device, PyTorch always seems to fail.
When building PyTorch, I tried both using only `USE_VULKAN=1`, and also additionally `USE_VULKAN_SHADERC_RUNTIME=1` and `USE_VULKAN_WRAPPER=0`, but it seems like the error occurs in both cases.
Below you can find the code with which I was able to trigger the errors.

Set up code:

```python
import torch

cpu_device = torch.device('cpu')
vulkan_device = torch.device('vulkan:0' if torch.is_vulkan_available() else 'cpu')
print(torch.__version__)
print(torch.is_vulkan_available())
print(vulkan_device)
```

Output:

```
1.12.0a0+gitc9ccb85
True
vulkan:0
```


Test case 1:

```python
test_tensor_vulkan = torch.ones(1, dtype=torch.float32, device=vulkan_device)
```

Output:

```
Traceback (most recent call last):
  File "/home/christoph/Programming/DL/vpt_denoise_test/src/main.py", line 45, in <module>
    test_tensor_vulkan = torch.ones(1, dtype=torch.float32, device=vulkan_device)
NotImplementedError: Could not run 'aten::fill_.Scalar' with arguments from the 'Vulkan' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'aten::fill_.Scalar' is only available for these backends: [CPU, CUDA, Meta, QuantizedCPU, QuantizedCUDA, BackendSelect, Python, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradLazy, AutogradXPU, AutogradMLC, AutogradHPU, AutogradNestedTensor, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, AutocastCPU, Autocast, Batched, VmapMode, Functionalize].

CPU: registered at /home/christoph/build/pytorch/build/aten/src/ATen/RegisterCPU.cpp:21171 [kernel]
CUDA: registered at /home/christoph/build/pytorch/build/aten/src/ATen/RegisterCUDA.cpp:29903 [kernel]
Meta: registered at /home/christoph/build/pytorch/build/aten/src/ATen/RegisterMeta.cpp:15085 [kernel]
QuantizedCPU: registered at /home/christoph/build/pytorch/build/aten/src/ATen/RegisterQuantizedCPU.cpp:1270 [kernel]
QuantizedCUDA: registered at /home/christoph/build/pytorch/build/aten/src/ATen/RegisterQuantizedCUDA.cpp:466 [kernel]
BackendSelect: fallthrough registered at /home/christoph/build/pytorch/aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback]
Python: registered at /home/christoph/build/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp:47 [backend fallback]
Named: fallthrough registered at /home/christoph/build/pytorch/aten/src/ATen/core/NamedRegistrations.cpp:11 [kernel]
Conjugate: registered at /home/christoph/build/pytorch/aten/src/ATen/ConjugateFallback.cpp:18 [backend fallback]
Negative: registered at /home/christoph/build/pytorch/aten/src/ATen/native/NegateFallback.cpp:18 [backend fallback]
ZeroTensor: registered at /home/christoph/build/pytorch/aten/src/ATen/ZeroTensorFallback.cpp:86 [backend fallback]
ADInplaceOrView: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/ADInplaceOrViewType_0.cpp:2557 [kernel]
AutogradOther: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradCPU: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradCUDA: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradXLA: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradLazy: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradXPU: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradMLC: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradHPU: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradNestedTensor: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradPrivateUse1: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradPrivateUse2: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
AutogradPrivateUse3: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/VariableType_1.cpp:10665 [autograd kernel]
Tracer: registered at /home/christoph/build/pytorch/torch/csrc/autograd/generated/TraceType_0.cpp:11649 [kernel]
AutocastCPU: fallthrough registered at /home/christoph/build/pytorch/aten/src/ATen/autocast_mode.cpp:461 [backend fallback]
Autocast: fallthrough registered at /home/christoph/build/pytorch/aten/src/ATen/autocast_mode.cpp:305 [backend fallback]
Batched: registered at /home/christoph/build/pytorch/aten/src/ATen/BatchingRegistrations.cpp:1063 [kernel]
VmapMode: fallthrough registered at /home/christoph/build/pytorch/aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback]
Functionalize: registered at /home/christoph/build/pytorch/build/aten/src/ATen/RegisterFunctionalization_2.cpp:4172 [kernel]
```


Test case 2:

```python
test_tensor_cpu = torch.ones(1, dtype=torch.float32, device=cpu_device)
test_tensor_vulkan = test_tensor_cpu.to(vulkan_device)
```

Output:

```
Traceback (most recent call last):
  File "/home/christoph/Programming/DL/vpt_denoise_test/src/main.py", line 46, in <module>
    test_tensor_vulkan = test_tensor_cpu.to(vulkan_device)
RuntimeError: VkResult:-5
```


Output of `python -c  'import torch; print(torch.__config__.show())'`:

```
PyTorch built with:
  - GCC 9.3
  - C++ Version: 201402
  - Intel(R) oneAPI Math Kernel Library Version 2022.0-Product Build 20211112 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.5.2 (Git Hash a9302535553c73243c632ad3c4c80beec3d19a1e)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 11.5
  - NVCC architecture flags: -gencode;arch=compute_86,code=sm_86
  - CuDNN 8.3.1
  - Magma 2.5.2
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.5, CUDNN_VERSION=8.3.1, CXX_COMPILER=/usr/bin/c++, CXX_FLAGS= -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN -DUSE_VULKAN_API -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow, FORCE_FALLBACK_CUDA_MPI=1, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.12.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=ON, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, 
```

CMake configure log: https://gist.github.com/chrismile/9838eb47722d2ac80b0f824422d9eed3


### Versions

Collecting environment information...
PyTorch version: 1.12.0a0+gitc9ccb85
Is debug build: False
CUDA used to build PyTorch: 11.5
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.3 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: 10.0.0-4ubuntu1 
CMake version: version 3.22.1
Libc version: glibc-2.31

Python version: 3.8.12 (default, Oct 12 2021, 13:49:34)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.4.0-99-generic-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 11.5.119
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3090
Nvidia driver version: 510.47.03
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.3.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.3.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.3.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.3.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.3.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.3.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.3.1
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.1
[pip3] torch==1.12.0a0+gitc9ccb85
[conda] magma-cuda115             2.5.2                         1    pytorch
[conda] mkl                       2022.0.1           h06a4308_117  
[conda] mkl-include               2022.0.1           h06a4308_117  
[conda] numpy                     1.21.2           py38hd8d4704_0  
[conda] numpy-base                1.21.2           py38h2b8c604_0  
[conda] torch                     1.12.0a0+gitc9ccb85          pypi_0    pypi