Skip to content

Drop compile(shapeless:) shadows now that mlx-swift ships @Sendable overloads - #89

Merged
solderzzc merged 1 commit into
mainfrom
fix/drop-compile-shadows
Oct 26, 2026
Merged

solderzzc merged 1 commit into
mainfrom
fix/drop-compile-shadows

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Why

SharpAI/mlx-swift#28 merges upstream 26d685a, which gives the stateless compile(shapeless:_:) overloads a @Sendable body for the [MLXArray], 1-, 2- and 3-input shapes. The four shadows in CompiledTrace.swift then duplicate them, and the umbrella build (Downstream Integration Test on mlx-swift#28) fails:

  • GPTOSS.swift:96: ambiguous use of compile(shapeless:_:)
  • Gemma4Text.swift:32, :38: same

What

  • Remove the four compile(shapeless:_:) shadows from CompiledTrace.swift; CompiledTrace itself is unchanged.
  • CompiledTraceTests.testPlainCompileFreezesCapturedWeights built its unguarded baseline with MLX.compile { capture }, which the @Sendable overload rejects. It now uses MLX.compile(inputs: [], outputs: []), which takes a non-@Sendable body on both the current fork main and fix(Gemma4): add pad token (ID=0) to eosTokenIds to prevent infinite … #28.

Verified

Note

Against the current fork main (before #28), the 1-, 2- and [MLXArray] shapes of compile(shapeless:) lose the @Sendable guard, because fork main only has it on the 3-input shape. #28 restores it for all four.

🤖 Generated with Claude Code

…verloads

mlx-swift upstream 26d685a (ml-explore/mlx-swift#469) gives the stateless
compile(shapeless:_:) overloads a @sendable body for the [MLXArray], 1-, 2- and
3-input shapes. The four shadows in CompiledTrace.swift then duplicate them,
and GPTOSS.swift:96 and Gemma4Text.swift:32/38 fail with "ambiguous use of
compile(shapeless:_:)" (SharpAI/mlx-swift#28, Downstream Integration Test).

CompiledTraceTests built its unguarded baseline with MLX.compile { capture },
which the @sendable overload now rejects. It uses the inputs:/outputs: form
with no declared state instead; that form takes a non-@sendable body on both
the current fork main and #28.

Verified: swift build --build-tests against mlx-swift 9ab0a45 (#28 head),
Xcode 26.3, exit 0. CompiledTraceTests need a Metal toolchain and are left to CI.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@solderzzc
solderzzc merged commit e2d15c7 into main Oct 26, 2026
9 of 10 checks passed
@solderzzc
solderzzc deleted the fix/drop-compile-shadows branch November 4, 2026 05:33
ximyro pushed a commit to ximyro/SwiftLM that referenced this pull request Nov 17, 2026
Moves the mlx-swift-lm pin from 87232e7 to e2d15c7, the merge of
SharpAI/mlx-swift-lm#89. It removes the compile(shapeless:) shadows in
CompiledTrace.swift so the Downstream Integration Test on
SharpAI/mlx-swift#28 no longer fails with "ambiguous use of compile(shapeless:_:)".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.

1 participant