Replies: 2 comments 2 replies
-
|
There is definitely a bug here.. as it should never fail to compile like that. I believe the bug is related to the fact that you have the same variable as an implicit capture to two different functions you are compiling which is causing the graph to get in a bad state. We should fix it. However, I would strongly advise against compiling with captured variables like that. Here's a quick explanation: a = constant;
b = constant;
x = a + b;
auto fun = [x](array y) {
return y + x;
}In that case MLX needs to compile your function but it doesn't know that auto fun = [a, b](array y) {
return y + (a + b);
};which is usually not what you want. So instead you should just make a = constant;
b = constant;
x = a + b;
auto fun = [](array y, array x) {
return y + x;
} |
Beta Was this translation helpful? Give feedback.
-
|
For reference, here is a simple python reproduction of the bug: import mlx.core as mx
t = mx.ones((10,))
u = (1.0 - t) * 0.0 + t * 3.0
o = mx.ones((6,))
b = o[:, None] * u
c = b * mx.ones_like(u)
a = mx.ones((6,))
d = mx.compile(lambda x: x @ b)(a)
e = mx.compile(lambda x: x @ c.T)(d)
mx.eval(e)It can be fixed by either evluating |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A apologize for the size of the example but this is smallest I could make this example and still trigger the issue.
When I run this, I get an error when it gets to the line
std::cout << amnc << std::endl;I can make this crash go away if I do any of these three actions.
whereop inmake_norm.u_anglesinmake_cosuvwithmlx::core::ones_like(u_angles).mlx::core::compilefunctions and evaluate it directly.Beta Was this translation helpful? Give feedback.
All reactions