Repository: pytorch
Issue: AssertionError: Device mps not supported
Labels: triaged,module: mps,oncall: pt2,module: inductor

### 🐛 Describe the bug

I'm not sure if MPS is meant to be supported or not at this stage, but I'm trying to `torch.compile` on my M1 macbook pro and Pytorch is throwing:


```
torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
AssertionError: Device mps not supported
```

It seems fairly likely that MPS just isn't supported, but I'm opening this ticket in case it is (: I'd really love it if I could compile the model, and will try to get a reproduction if it turns out that this is actually a bug and not just unimplemented code. Thanks for your hard work!

### Error logs

It's a biggie:
```
Traceback (most recent call last):
  File "/Users/<MY_USERNAME>/projects/quick-ideas/diffusion-delusions.py", line 750, in <module>
    output = pipe(
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/diffusion-delusions.py", line 362, in __call__
    noise_pred = self.unet(
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 451, in _fn
    return fn(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
    return forward_call(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 921, in catch_errors
    return callback(frame, cache_entry, hooks, frame_state, skip=1)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 400, in _convert_frame_assert
    return _compile(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 676, in _compile
    guarded_code = compile_inner(code, one_graph, hooks, transform)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 535, in compile_inner
    out_code = transform_code_object(code, transform)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py", line 1036, in transform_code_object
    transformations(instructions, code_options)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 165, in _fn
    return fn(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 500, in transform
    tracer.run()
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 2149, in run
    super().run()
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 810, in run
    and self.step()
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 773, in step
    getattr(self, inst.opname)(inst)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 2268, in RETURN_VALUE
    self.output.compile_subgraph(
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 991, in compile_subgraph
    self.compile_and_call_fx_graph(tx, pass2.graph_output_vars(), root)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 1168, in compile_and_call_fx_graph
    compiled_fn = self.call_user_compiler(gm)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 1241, in call_user_compiler
    raise BackendCompilerFailed(self.compiler_fn, e).with_traceback(
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 1222, in call_user_compiler
    compiled_fn = compiler_fn(gm, self.example_inputs())
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/repro/after_dynamo.py", line 117, in debug_wrapper
    compiled_gm = compiler_fn(gm, example_inputs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/repro/after_dynamo.py", line 117, in debug_wrapper
    compiled_gm = compiler_fn(gm, example_inputs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/__init__.py", line 1729, in __call__
    return compile_fx(model_, inputs_, config_patches=self.config)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1102, in compile_fx
    return compile_fx(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1330, in compile_fx
    return aot_autograd(
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/backends/common.py", line 58, in compiler_fn
    cg = aot_module_simplified(gm, example_inputs, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 903, in aot_module_simplified
    compiled_fn = create_aot_dispatcher_function(
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_functorch/aot_autograd.py", line 628, in create_aot_dispatcher_function
    compiled_fn = compiler_fn(flat_fn, fake_flat_args, aot_config, fw_metadata=fw_metadata)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py", line 443, in aot_wrapper_dedupe
    return compiler_fn(flat_fn, leaf_flat_args, aot_config, fw_metadata=fw_metadata)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py", line 648, in aot_wrapper_synthetic_base
    return compiler_fn(flat_fn, flat_args, aot_config, fw_metadata=fw_metadata)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/jit_compile_runtime_wrappers.py", line 119, in aot_dispatch_base
    compiled_fw = compiler(fw_module, updated_flat_args)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 1257, in fw_compiler_base
    return inner_compile(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/repro/after_aot.py", line 83, in debug_wrapper
    inner_compiled_fn = compiler_fn(gm, example_inputs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/debug.py", line 304, in inner
    return fn(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 438, in compile_fx_inner
    compiled_graph = fx_codegen_and_compile(
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/compile_fx.py", line 714, in fx_codegen_and_compile
    compiled_fn = graph.compile_to_fn()
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 1307, in compile_to_fn
    return self.compile_to_module().call
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 1250, in compile_to_module
    self.codegen_with_cpp_wrapper() if self.cpp_wrapper else self.codegen()
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 1203, in codegen
    self.init_wrapper_code()
  File "/Users/<MY_USERNAME>/projects/quick-ideas/.venv/lib/python3.10/site-packages/torch/_inductor/graph.py", line 1133, in init_wrapper_code
    assert (
torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
AssertionError: Device mps not supported

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information


You can suppress this exception and fall back to eager by setting:
    import torch._dynamo
    torch._dynamo.config.suppress_errors = True
```

### Minified repro

if it turns out that this is actually a bug and not just unimplemented code then I'll add a reproduction (:

### Versions

Collecting environment information...
PyTorch version: 2.3.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 14.3.1 (arm64)
GCC version: Could not collect
Clang version: 12.0.1
CMake version: version 3.29.0
Libc version: N/A

Python version: 3.10.5 (v3.10.5:f377153967, Jun  6 2022, 12:36:10) [Clang 13.0.0 (clang-1300.0.29.30)] (64-bit runtime)
Python platform: macOS-14.3.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

CPU:
Apple M1 Pro

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.3.0
[pip3] torchaudio==2.2.2
[conda] Could not collect


cc @kulinseth @albanD @malfet @DenisVieriu97 @jhavukainen @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire