Repository navigation
test(models): take mlx_test_guard in every batched-decode harness test - #3573
Merged
Merged
Conversation
This was referenced Nov 30, 2026
inureyes
force-pushed
the
test/3567-mlx-test-guard-batched-decode
branch
from
November 30, 2026 01:03
4d7715b to
2b287f4
Compare
inureyes
added a commit
that referenced
this pull request
Nov 30, 2026
Add the shared MLX serialization guard to the 87 tests that drive batched_decode_harness without it, and replace the private mutex in the popular-dense contract macro with the shared guard. Add tests/mlx_test_guard_coverage.rs, a dependency-free source scan that fails with the list of unguarded callers. Closes #3567
inureyes
force-pushed
the
test/3567-mlx-test-guard-batched-decode
branch
from
November 30, 2026 01:20
3611f77 to
001c8bb
Compare
inureyes
marked this pull request as ready for review
November 30, 2026 01:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every lib test that drives
batched_decode_harnessnow takesmlx_test_guard()as its first statement, so the model-owned multistep and native batched-decode tests no longer run in parallel and abort incudaStreamEndCapture. The guard stays out of the harness because it is a non-reentrantMutex.The re-run sweep found 87 unguarded tests, not the 54 in the issue. The extra 33 are:
fn $name) inllama_runtime_tests.rs(tensor-parallel Llama) andpopular_dense_batched_decode_tests.rs.cohere2_tests.rsandcohere2_moe_tests.rsnow take the shared guard before their local lock, and the popular-dense macro uses the shared guard in place of its private one.#[ignore]attribute between#[test]andfn.Helpers that already take the guard internally were left alone, so nothing takes it twice.
New test
tests/mlx_test_guard_coverage.rsis a dependency-free text scan ofsrc/. It flags any#[test]that calls a harness function (qualified or imported), directly or through a same-file helper that does not take the guard, and lists the offenders. A second test checks the scanner on small fixtures.Verification
src/restored to main, the scan fails and lists 87 tests; with this change it passes.cargo clippy --lib --tests --features cuda -- -D warningsclean,cargo fmt --all -- --checkclean, the five CI contract scripts pass.cargo test --profile test-fast --features cuda --bin mlxcel: 363 passed.gpu-lock: 65 passed, 0 failed, 8 ignored (popular_dense, cohere2, afmoe, inkling tiny, wrapper_batched_decode, mixed_cache, mixtral_style).cudaStreamEndCaptureinsideaudio::tests that do not use the harness (audio::fastconformeraborts 6 of 6 parallel runs on its own). That is a wider pre-existing problem, now test(cuda): parallel lib tests abort in cudaStreamEndCapture #3574, so the issue's third acceptance criterion moves there (see the comment on test(models): take mlx_test_guard in every batched-decode harness test #3567). Metal was not available on this host.--bin mlxcel(363 passed) and the selectors popular_dense_batched, cohere2 and oxr pass.Closes #3567