Skip to content

🔄 Auto-Sync: ml-explore/mlx-swift main (35c10b4, 3 commit(s)) - #25

Closed
github-actions[bot] wants to merge 4 commits into
mainfrom
bot/upstream-35c10b4-1ba0ad8
Closed

github-actions[bot] wants to merge 4 commits into
mainfrom
bot/upstream-35c10b4-1ba0ad8

Conversation

@github-actions

Copy link
Copy Markdown

Automated real merge of ml-explore/mlx-swift main (35c10b4, 3 commit(s) not yet in this fork) into main. Upstream changes: ml-explore/mlx-swift@2f96983...35c10b4

Merge this PR with a merge commit ("Create a merge commit"), not squash or rebase. Squashing orphans the upstream commits and the fork commits that downstream repos pin (submodule SHAs).

Upstream commits

  • 35c10b4 Fix asArray crash on zero-size arrays (#486) (Ahmed Hassan)
  • 31c03d9 Enable JACCL (#502) (Ronald Mannak)
  • f93decf Fix leak when _updateInternal replaces an array with siblings (#501) (ShankyShako)

Needs a human look

  • Fork-sensitive paths changed by this merge:
    • Package.swift
    • Source/Cmlx/mlx-conditional/jaccl_conditional.cpp

What was checked

  • Git merged cleanly (no conflicts, no -X ours/theirs); the fork's workflows were restored unchanged.
  • Size: 8 files changed, 105 insertions(+), 13 deletions(-).
  • Syntax: 5 changed Swift file(s) parsed with swiftc 6.2.
  • Not run by the bot: a build, the tests, a Metal toolchain. CI on this PR must be green before merging.

Bot disclosure

Prepared by the upstream-sync GitHub Actions workflow. The workflow never approves, reviews or merges; no human has reviewed this merge yet.

  • I have read this PR description in full and approve it as my own

ShankyShako and others added 4 commits October 16, 2026 09:42
…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>
Automated merge by the upstream-sync workflow. 3 upstream commit(s). Merge with a merge commit, not squash/rebase.
@solderzzc

Copy link
Copy Markdown
Member

Superseded by #26 (real merge of upstream through 35c10b4, with CI).

@solderzzc solderzzc closed this Oct 17, 2026
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.

3 participants