Skip to content

[staging CI] unslothai/unsloth_zoo#1128 - #182

Closed
danielhanchen wants to merge 4 commits into
mainfrom
pr-1128-xplat-ci
Closed

danielhanchen wants to merge 4 commits into
mainfrom
pr-1128-xplat-ci

Conversation

@danielhanchen

Copy link
Copy Markdown
Owner

Disposable CI run for unslothai#1128. Do not merge; closed after CI.

Lyxot and others added 4 commits August 28, 2026 17:42
…n burst

`_generation_cache_hygiene` cleared MLX's buffer pool on entry and again in its `finally` without first draining submitted GPU work. mlx-lm's batched generation submits the next step with `mx.async_eval` before yielding, and the stop-string scanner breaks out of that loop early, so a clear can run while command buffers are still in flight.

MLX keeps buffers that an in-flight command buffer reads alive through that command buffer's completion handler, but it does not pin an output array dropped mid-flight. Draining first keeps the release independent of that. `mx.synchronize()` costs ~33us and runs twice per burst, never per token.

The warning raised when cleanup fails while an exception is active now names both calls, since the `try` covers the synchronize as well.
test_missing_clear_cache_is_rejected_before_any_work failed on every
non-Apple host. monkeypatch.delattr("mlx.core.clear_cache") does not make
the attribute missing under tests/mlx_simulation: the shim synthesises a
trampoline for any name it does not implement, so getattr() still returns
something callable, the "clear_cache missing" guard never fires, and the
shim raises its own not-implemented error instead.

Measured on this branch: tests/test_mlx_generate.py is 51 passed at the
merge base and 2 failed, 54 passed at the head, both failures being the
new parametrized case. The file only executes on the mlx-labelled macOS
job, so upstream CI never showed it, but the command this PR gives as its
own validation step reproduces it directly on Linux.

Setting the attribute to None is what the guard actually tests for, and it
reads the same on real MLX and on the shim.
@danielhanchen
danielhanchen deleted the pr-1128-xplat-ci branch September 1, 2026 08:50
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

Successfully merging this pull request may close these issues.

2 participants