Skip to content

pick up mlx-swift 0.32.2 - #646

Merged
davidkoski merged 3 commits into
mainfrom
mlx-swift-0.32.2
Sep 28, 2026
Merged

davidkoski merged 3 commits into
mainfrom
mlx-swift-0.32.2

Conversation

@davidkoski

Copy link
Copy Markdown
Member

Proposed changes

pick up mlx-swift 0.32.2

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

AI usage

  • I have read this PR description in full and approve it as my own, and it
    accurately describes the code changes.
  • AI usage disclosure: none

// hit assertions as the mlx scheduler is torn down. Synchronize with the stream
// to make sure it is complete.
Stream().synchronize()
Stream.defaultStream.synchronize()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix deprecation warning.

Comment thread Package.swift
],
dependencies: [
.package(url: "https://github.com/ml-explore/mlx-swift", .upToNextMinor(from: "0.31.6")),
.package(url: "https://github.com/ml-explore/mlx-swift", .upToNextMinor(from: "0.32.2")),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pick up new release.

… -- it may try to read from rewritten or missing file
@@ -149,2345 +149,2380 @@ private final class ProtocolDefaultTrimmabilityCache: KVCache {
func innerState() -> [MLXArray] { [] }
}

// MARK: - Predictive trimmability
@Suite(.serialized) struct KVCacheTests {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of changes per indenting -- I just encased this in a Suite to make it easier to see the tests in the test navigator.

Comment on lines +382 to +384
// eval before overwriting file -- otherwise the lazy read picks
// up the corruption
eval(arrays)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real fix and is identical across many functions -- we need to eval the load before trying to overwrite. The load is lazy so doing this at write time may read from a truncated file.

@thechriswebb thechriswebb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

While you were updating calls to match the new syntax, did you want to update these comments too? Not absolutely necessary.

--- Libraries/MLXLMCommon/Evaluate.swift:2371
-            // post-loop block below assigns `.cancelled`; Stream().synchronize() still
+            // post-loop block below assigns `.cancelled`; Stream.defaultStream.synchronize() still

--- Tests/MLXLMTests/CancellationTests.swift:26
-    // must still settle (run Stream().synchronize()) before task.value returns.
+    // must still settle (run Stream.defaultStream.synchronize()) before task.value returns.

--- Tests/MLXLMTests/CancellationTests.swift:47
-        // Must complete without hanging. Failure here means Stream().synchronize()
+        // Must complete without hanging. Failure here means Stream.defaultStream.synchronize()

--- skills/mlx-swift-lm/references/concurrency.md:319
-Stream().synchronize()  // Wait for all pending operations
+Stream.defaultStream.synchronize()  // Wait for all pending operations

@thechriswebb thechriswebb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG2M

@davidkoski
davidkoski merged commit c043fb3 into main Sep 28, 2026
5 checks passed
@davidkoski
davidkoski deleted the mlx-swift-0.32.2 branch September 28, 2026 20:32
spokvulcan added a commit to spokvulcan/mlx-swift-lm that referenced this pull request Oct 3, 2026
Upstream ml-explore#646 moved to mlx-swift 0.32's public Stream.defaultStream. The
pinned spokvulcan/mlx-swift (0.31.6 base) keeps that task-local and
internal, so the three synchronize calls go through Stream(), the default
stream on 0.31.6. Fork-only; drops when the pin reaches mlx-swift 0.32.
wballard added a commit to swissarmyhammer/mlx-swift-lm-old that referenced this pull request Oct 3, 2026
Apply the upstream commits ee673d6..55db721 as a 3-way patch. CLAUDE.md is
excluded.

- c043fb3 pick up mlx-swift 0.32.2 (ml-explore#646)
- 0493daf Named image attachments in MLXLMCommon and the Foundation Models adapter (ml-explore#535)
- 0dcfe2f Convert the booleans in tool parameter schemas to Swift Bool values (ml-explore#653)
- 37dab60 be able to trigger workflows on main. notes about upcoming releases. (ml-explore#647)
- 390c5fd require mlx-swift-0.32.3 for SDK issue (ml-explore#657)
- 3b339ad adjustments for running tests on NAX/TF32 hardware (ml-explore#649)
- ac6f565 update documentation and skills (ml-explore#489)
- ce3950e Drop MTP weights from converted Qwen 3.5 VLM checkpoints (ml-explore#642)
- 9112fae Synchronize cross-SIMD WHT reads before shared-memory writes (ml-explore#650)
- 7e4024e NemotronH: MoE keys are optional, so dense checkpoints load (ml-explore#635)
- 1830ae4 Declare the fused GDN projection as compile state so it frees with the model (ml-explore#631)
- 6e0a0b2 Synchronize Metal before checking cached buffer memory (ml-explore#667)
- 9afc3b5 Recommend upToNextMinor in installation instructions (ml-explore#668)
- 55db721 Reduce Qwen3 reranking memory by projecting final tokens only (ml-explore#621)

Conflict resolutions:

- MLXLanguageModel.swift: keep the drain coordinator and runRespond of
  stable, and keep historyMessages. Add the upstream attachment label
  validation before resolveConfiguration. historyMessages now throws,
  because TranscriptConverter.mlxMessages now throws.
- TranscriptConverter.swift: keep the mlxMessages(for:replayReasoning:) and
  convert(entry:) form of stable. Apply the upstream changes in
  convert(entry:): it throws, an instructions entry drops its images, and
  extractImages(from:in:) applies the orientation and rejects content that
  is not an image.
- Chat.swift: keep the doc comments of stable, and add the upstream
  MessageContentLayout and contentParts(for:layout:).
- TurboQuantKernels.swift: keep stable. Stable already fixed the same
  cross-SIMD WHT race with two barriers per stage.
- KVCacheTests.swift: take the upstream file (upstream changed it to a
  suite). Delete the upstream ArraysCache.advance test, because in this fork
  advance(_:) also moves offset. Add the fork tests for advance and the
  trim-then-continue test at file scope.
- Qwen35FusedGDNProjectionTests.swift: keep the deletion of the opt-in
  benchmark (it skips unless an environment variable is set). Add the new
  upstream memory test.
- model-container.md: take upstream (llama3_2_3B_4bit and the macros are
  the real API).
- TranscriptConverterTests.swift: the replayReasoning calls now use try.

Tests: MLXGuidedGenerationTests 70, MLXFoundationModelsTests 349,
CXGrammarTests 7, MLXHuggingFaceMacrosTests 5 pass. MLXLMTests: 1287 Swift
Testing tests pass, and 699 of 700 XCTest tests pass. The failure is the
wall-clock limit of EvalTests
testVarianceNormalizedKVCache32KIngestAndDecodePeakMetalMemorySmoke (0.29 s,
limit 0.25 s) in the full run. The test passes alone two times, and this
merge does not change EvalTests.swift.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
spokvulcan added a commit to spokvulcan/mlx-swift-lm that referenced this pull request Oct 27, 2026
Upstream ml-explore#646 moved to mlx-swift 0.32's public Stream.defaultStream. The
pinned spokvulcan/mlx-swift (0.31.6 base) keeps that task-local and
internal, so the three synchronize calls go through Stream(), the default
stream on 0.31.6. Fork-only; drops when the pin reaches mlx-swift 0.32.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants