Skip to content
fn

evaluate_pending

int evaluate_pending()

Evaluate every GPU array still waiting to run, and return how many.

Lucid's Metal path is lazy: an op records a graph node and returns, and nothing runs until a value is read. lucid.metal.synchronize() promises the queued work is done, but MLX keeps no list of unevaluated arrays, so wrap_mlx_array notes each one it wraps (as a weak reference that never keeps it alive) and this runs whichever are still alive and unevaluated.

Raises

LucidError
When an array cannot be evaluated (an allocation past the device's buffer limit, a kernel that refuses its arguments). The others still run first; then the first failure is raised, its message prefixed with the count of failures. A LucidError subclass keeps its class, MLX's std::invalid_argument becomes InvalidArgument, and any other std::exception a LucidError.