You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] When dealing with Irreversible matrix, mx.linalg.invwill cause core dumped. #2106
This is a tricky one to fix, but it would be good to work towards being able to catch errors from another thread.
I think one thing we could think about is to have an error flag on the cpu command encoder and set that flag when an op fails. Then have the main thread check the flag at certain points. But we also need to be careful to leave the eval in a valid state to make this work.
I notice that in /mlx/mlx/backend/cpu/inverse.cpp, in the func general_inv, current src code simply judge the info!=0, maybe adding an extra judgement if (info > 0) can solve this problem.
My understanding of the source code of MLX is still limited, so it might be a wrong idea. I attempted to modify the source code for some development, but encountered a build issue and am still trying to solve it
It's weird, i'm not getting the core dump error but this instead, which i think is pretty explicit that it is failing to invert an invertible matrix.libc++abi: terminating due to uncaught exception of type std::runtime_error: [Inverse::eval_cpu] LU factorization failed with error code 2
Activity
awni commentedon Apr 22, 2025
This is a tricky one to fix, but it would be good to work towards being able to catch errors from another thread.
I think one thing we could think about is to have an error flag on the cpu command encoder and set that flag when an op fails. Then have the main thread check the flag at certain points. But we also need to be careful to leave the eval in a valid state to make this work.
Redempt1onzzZZ commentedon Apr 23, 2025
I notice that in
/mlx/mlx/backend/cpu/inverse.cpp, in the funcgeneral_inv, current src code simply judge the info!=0, maybe adding an extra judgement if (info > 0) can solve this problem.My understanding of the source code of MLX is still limited, so it might be a wrong idea. I attempted to modify the source code for some development, but encountered a build issue and am still trying to solve it
mihirneal commentedon Apr 23, 2025
It's weird, i'm not getting the core dump error but this instead, which i think is pretty explicit that it is failing to invert an invertible matrix.
libc++abi: terminating due to uncaught exception of type std::runtime_error: [Inverse::eval_cpu] LU factorization failed with error code 2zcbenz commentedon Mar 18, 2026
Closing as a duplicate of #2670.