Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on Mac M1/M2 chip when using MPS support #55

Closed
liangcl0928 opened this issue Jun 13, 2023 · 3 comments
Closed

Crash on Mac M1/M2 chip when using MPS support #55

liangcl0928 opened this issue Jun 13, 2023 · 3 comments

Comments

@liangcl0928
Copy link

My environment:
Mac OS 13.2.1 with M2 Pro
Python 3.9.16
pytorch: 2.0.1
vector_quantize_pytorch: 1.6.11

site-packages/vector_quantize_pytorch/vector_quantize_pytorch.py:444: UserWarning: The operator 'aten::lerp.Scalar_out' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/runner/work/temp/anaconda/conda-bld/pytorch_1682343673238/work/aten/src/ATen/mps/MPSFallback.mm:11.)
self.cluster_size.data.lerp
(cluster_size, 1 - self.decay)
libc++abi: terminating with uncaught exception of type c10::TypeError: Trying to convert ComplexFloat to the MPS backend but it does not have support for that dtype.
Exception raised from getMPSScalarType at /Users/runner/work/_temp/anaconda/conda-bld/pytorch_1682343673238/work/aten/src/ATen/native/mps/OperationUtils.mm:91 (most recent call first):
frame #0: at::native::mps::getMPSScalarType(c10::ScalarType) + 180 (0x1369364ac in libtorch_cpu.dylib)
frame #1: at::native::mps::mpsGraphRankedPlaceHolder(MPSGraph*, at::Tensor const&) + 96 (0x136938654 in libtorch_cpu.dylib)
frame #2: invocation function for block in at::native::mps::unary_op(at::Tensor const&, at::Tensor const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, MPSGraphTensor* (MPSGraph*, MPSGraphTensor*) block_pointer, std::__1::function<bool (at::Tensor const&)>) + 104 (0x136a00504 in libtorch_cpu.dylib)
frame #3: invocation function for block in at::native::mps::MPSGraphCache::CreateCachedGraph(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, at::native::mps::MPSCachedGraph* () block_pointer) + 216 (0x13694c58c in libtorch_cpu.dylib)
frame #4: _dispatch_client_callout + 20 (0x199392504 in libdispatch.dylib)
frame #5: _dispatch_lane_barrier_sync_invoke_and_complete + 56 (0x1993a1a9c in libdispatch.dylib)
frame #6: at::native::mps::MPSGraphCache::CreateCachedGraph(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, at::native::mps::MPSCachedGraph* () block_pointer) + 160 (0x13693a5d0 in libtorch_cpu.dylib)
frame #7: at::native::mps::unary_op(at::Tensor const&, at::Tensor const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, MPSGraphTensor* (MPSGraph*, MPSGraphTensor*) block_pointer, std::_1::function<bool (at::Tensor const&)>) + 860 (0x1369fff9c in libtorch_cpu.dylib)
frame #8: at::native::abs_out_mps(at::Tensor const&, at::Tensor&) + 124 (0x136a02bd0 in libtorch_cpu.dylib)
frame #9: at::ops::abs_out::call(at::Tensor const&, at::Tensor&) + 276 (0x1330e54a8 in libtorch_cpu.dylib)
frame #10: at::native::abs(at::Tensor const&) + 232 (0x132adba88 in libtorch_cpu.dylib)
frame #11: c10::impl::wrap_kernel_functor_unboxed
<c10::impl::detail::WrapFunctionIntoFunctor
<c10::CompileTimeFunctionPointer<at::Tensor (c10::DispatchKeySet, at::Tensor const&), &(torch::autograd::VariableType::(anonymous namespace)::abs(c10::DispatchKeySet, at::Tensor const&))>, at::Tensor, c10::guts::typelist::typelist<c10::DispatchKeySet, at::Tensor const&> >, at::Tensor (c10::DispatchKeySet, at::Tensor const&)>::call(c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&) + 920 (0x134e13950 in libtorch_cpu.dylib)
frame #12: at::_ops::abs::call(at::Tensor const&) + 264 (0x1330e4900 in libtorch_cpu.dylib)
frame #13: torch::autograd::THPVariable_abs(_object*, _object*) + 188 (0x104b006d4 in libtorch_python.dylib)
frame #14: method_vectorcall_NOARGS + 172 (0x102a964e4 in python3.9)
frame #15: call_function + 516 (0x102b793cc in python3.9)
frame #16: _PyEval_EvalFrameDefault + 26296 (0x102b75ba8 in python3.9)
frame #17: _PyEval_EvalCode + 2804 (0x102b6ee98 in python3.9)
frame #18: _PyFunction_Vectorcall + 220 (0x102a89fe4 in python3.9)
frame #19: call_function + 516 (0x102b793cc in python3.9)
frame #20: _PyEval_EvalFrameDefault + 26332 (0x102b75bcc in python3.9)
frame #21: function_code_fastcall + 116 (0x102a8a0a0 in python3.9)
frame #22: method_vectorcall + 516 (0x102a8cf24 in python3.9)
frame #23: _PyEval_EvalFrameDefault + 27140 (0x102b75ef4 in python3.9)
frame #24: _PyEval_EvalCode + 2804 (0x102b6ee98 in python3.9)
frame #25: _PyFunction_Vectorcall + 220 (0x102a89fe4 in python3.9)
frame #26: _PyObject_FastCallDictTstate + 320 (0x102a89674 in python3.9)
frame #27: _PyObject_Call_Prepend + 164 (0x102a8a464 in python3.9)
frame #28: slot_tp_call + 116 (0x102afa5b0 in python3.9)
frame #29: _PyObject_MakeTpCall + 616 (0x102a893c4 in python3.9)
frame #30: call_function + 668 (0x102b79464 in python3.9)
frame #31: _PyEval_EvalFrameDefault + 26332 (0x102b75bcc in python3.9)
frame #32: function_code_fastcall + 116 (0x102a8a0a0 in python3.9)
frame #33: method_vectorcall + 516 (0x102a8cf24 in python3.9)
frame #34: _PyEval_EvalFrameDefault + 27140 (0x102b75ef4 in python3.9)
frame #35: _PyEval_EvalCode + 2804 (0x102b6ee98 in python3.9)
frame #36: _PyFunction_Vectorcall + 220 (0x102a89fe4 in python3.9)
frame #37: _PyObject_FastCallDictTstate + 320 (0x102a89674 in python3.9)
frame #38: _PyObject_Call_Prepend + 164 (0x102a8a464 in python3.9)
frame #39: slot_tp_call + 116 (0x102afa5b0 in python3.9)
frame #40: _PyObject_MakeTpCall + 616 (0x102a893c4 in python3.9)
frame #41: call_function + 668 (0x102b79464 in python3.9)
frame #42: _PyEval_EvalFrameDefault + 26456 (0x102b75c48 in python3.9)
frame #43: _PyEval_EvalCode + 2804 (0x102b6ee98 in python3.9)
frame #44: _PyFunction_Vectorcall + 220 (0x102a89fe4 in python3.9)
frame #45: call_function + 516 (0x102b793cc in python3.9)
frame #46: _PyEval_EvalFrameDefault + 26456 (0x102b75c48 in python3.9)
frame #47: _PyEval_EvalCode + 2804 (0x102b6ee98 in python3.9)
frame #48: _PyFunction_Vectorcall + 220 (0x102a89fe4 in python3.9)
frame #49: call_function + 516 (0x102b793cc in python3.9)
frame #50: _PyEval_EvalFrameDefault + 26456 (0x102b75c48 in python3.9)
frame #51: _PyEval_EvalCode + 2804 (0x102b6ee98 in python3.9)
frame #52: _PyFunction_Vectorcall + 220 (0x102a89fe4 in python3.9)
frame #53: call_function + 516 (0x102b793cc in python3.9)
frame #54: _PyEval_EvalFrameDefault + 26456 (0x102b75c48 in python3.9)
frame #55: _PyEval_EvalCode + 2804 (0x102b6ee98 in python3.9)
frame #56: run_mod + 216 (0x102bc8bdc in python3.9)
frame #57: pyrun_file + 264 (0x102bc6728 in python3.9)
frame #58: PyRun_SimpleFileExFlags + 1332 (0x102bc5f50 in python3.9)
frame #59: Py_RunMain + 2148 (0x102be88c0 in python3.9)
frame #60: pymain_main + 1252 (0x102be9a40 in python3.9)
frame #61: main + 56 (0x102a3c770 in python3.9)
frame #62: start + 2544 (0x1991efe50 in dyld)

@lucidrains
Copy link
Owner

yea, mps doesn't have lerp yet, i'll build in some fallback later this week

lucidrains added a commit that referenced this issue Jun 14, 2023
lucidrains added a commit that referenced this issue Jun 14, 2023
@lucidrains
Copy link
Owner

@liangcl0928 do you want to try 1.6.12 and see if that fixes the issue?

@lucidrains
Copy link
Owner

@liangcl0928 just recalled that i have a Mac M1 lol, so i was able to resolve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants