Repository navigation
test(provider): evaluate the Qwen4 paging fixture's weights (release shard SIGBUS root cause) - #1753
Merged
Merged
Conversation
The tiny Qwen4ExpTextModel in Qwen4PagingPrefixIntegrationTests kept its random initial weights unevaluated. Its first forward runs the compiled hyper-connection decode closure, which captures those weights as constants, and MLX's compile_dfs recurses through every unevaluated input. Each random weight's graph reaches the process-global MLXRandom key, a lazy split chain that every earlier unevaluated draw in the test process lengthens. After the managed Nemotron Super slot tests (whose fixtures build random-init models and then replace the weights), the chain is deep enough that the recursion overflows the Swift Testing cooperative thread's stack. The guard page fault is EXC_BAD_ACCESS code=2, reported as signal 10, in release qualification shard 2 of dev b4800a5 and 70b2f6d. Evaluate the model after construction, as a loaded model's weights are and as the other tiny-model tests (Qwen4LayerSubmissionStateProbeTests, NemotronPagingPrefixIntegrationTests) already do. MLX eval is iterative, so evaluating the chain is safe and detaches it from the weights. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
Verification run 41716846257 passed. It used this commit cherry-picked onto failing dev 70b2f6d, with the release SDK 27 qualification build:
In the full selection, NemotronSuperManagedSlotTests ran first (25.4 s), then the Qwen4 suite (15.6 s), in the same process. |
14 of 17 tasks
This branch had an error being deployed
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
Fixes the cause of the dev release qualification crash. #1750 unblocked the release by restoring the old placement; this PR removes the crash itself.
Qwen4PagingPrefixIntegrationTestsnow evaluates its tiny model's random weights right after construction. The same change is already inQwen4LayerSubmissionStateProbeTestsandNemotronPagingPrefixIntegrationTests.Root cause
EXC_BAD_ACCESS (code=2, address=0x1700bfff8)on the Swift Testing cooperative thread. That address is the stack guard page, just below the live frames. macOS reports a guard-page fault as SIGBUS.mlx::core::detail::compile_dfsrecursion.compilegoes so deep.Qwen4Exp's compiled hyper-connection decode closure (compile(inputs: [], outputs: [])aroundprojectCanonical). That closure captures the module weights as constants.compile_dfs(mlx/compile.cpp) recurses throughstd::functioninto the inputs of every unevaluated array.MLXRandom.globalState. EachRandomState.next()replaces the key with a lazysplitand nothing evaluates it, so the key is a chain that grows with every unevaluated random draw in the process.NemotronSuperManagedSlotTestsfixtures build random-init models and then replace their weights, so the chain grows long. CI: Blacksmith-only macOS jobs, PR cache saves only on a cold restore, eight provider shards #1733's shard weights put that suite before the Qwen4 suite in release shard 2. The bisect showed this pair alone is enough:The effect is cumulative. The crash always comes 3–6 ms after
affineQmm first-miss, at the first forward.evalis iterative (an explicitstd::stack), so evaluating a long key chain cannot overflow. The global key chain is still unbounded lazy state in any process that discards random-init weights. That is a candidate hardening for mlx-swift-lm or the fixtures, not part of this PR.Before
MLXRandom.globalStatelonger.Qwen4ExpTextModeland leaves its weights unevaluated.compile_dfsrecurses through the captured weights into the whole key chain.After
eval(model)after construction. The iterativeevalcomputes the weights and detaches their graph.compile_dfsstops at the evaluated weights.Validation
Refactor pass
An independent refactor subagent reviewed the change and made no changes. Its notes: the change is the smallest behavior-preserving fix, it matches the existing
eval(model)pattern, it compiles with the file's current imports, and the comment is accurate.Limitations
🤖 Generated with Claude Code