Repository navigation
Sync upstream ml-explore/mlx-swift main (35c10b4) - #26
Merged
Merged
Conversation
…lore#501) Fix leak when `_updateInternal` replaces an array with siblings `_updateInternal` assigned the new array with `mlx_array_set`, a C++ copy assignment that skips `array::~array()`. That destructor breaks the cycle between sibling outputs of a multi-output primitive. As a result, `Module.update(parameters:)` orphaned the init graph on every model load. This happened, for example, with a freshly built `QuantizedLinear` whose unevaluated random init weight is an output of `Quantize`. Now the code copies into a new handle and then frees the old one, so the destructor runs. Copying before freeing also keeps the contents intact when an array is passed to itself (`a._updateInternal(a)`), which the sharding path reaches. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Fix asArray crash on zero-size arrays An array with a logical size of 0 (e.g. an empty slice like a[128...] on a shorter axis) has no backing data pointer, so asArray() crashed by dereferencing nil. physicalSize now returns 0 for empty arrays, so asArray, asData and asDataCopy all return empty results from one place. The strided copy and the two no-copy asData paths also skip the nil pointer, which a transposed empty array or noCopy access would otherwise unwrap. This matches Python's tolist() behaviour. Adds tests for the empty-slice, empty-constructed, and scalar cases. Fixes ml-explore#480 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Brings in ml-explore#501 (leak when _updateInternal replaces an array with siblings), ml-explore#502 (enable JACCL) and ml-explore#486 (asArray crash on zero-size arrays). No conflicts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 17, 2026
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.
Real merge of upstream main (3 commits: ml-explore#501, ml-explore#502, ml-explore#486); no conflicts. Same content as the bot PR #25, but from a branch that runs CI.
🤖 Generated with Claude Code