Skip to content

Keep CompiledTrace's compiled function non-Sendable (fixes Sendable mlx-swift compile) - #87

Merged
solderzzc merged 1 commit into
mainfrom
fix/compiledtrace-return-type
Oct 21, 2026
Merged

solderzzc merged 1 commit into
mainfrom
fix/compiledtrace-return-type

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Follow-up to #86. #86 boxed the captured owner, but the build failure is on the return type: MLX.compile(inputs:) returns a plain function, and CompiledTrace.compiled(_:) was declared to return @Sendable. That conversion is what fails under Swift 6 against mlx-swift main (CompiledTrace.swift:162 on SharpAI/mlx-swift#28).

This PR drops @Sendable on the returned and stored function and restores the original [unowned owner] capture. Behavior is unchanged.

Verification: a minimal Swift repro with the same overload shapes typechecks with this shape and fails with the old one. CI on this repo runs against its own mlx-swift, so the real check is the umbrella job on SharpAI/mlx-swift#28 after SwiftLM bumps to this commit.

🤖 Generated with Claude Code

MLX.compile(inputs:) returns a plain function. CompiledTrace declared its stored
and returned function @sendable, so converting that result fails under Swift 6
(CompiledTrace.swift:162, "converting non-Sendable function value to
'@sendable ([MLXArray]) -> [MLXArray]'"). The previous change only boxed the
captured owner and did not touch the return type. Drop the @sendable on the
returned and stored function and restore the original unowned capture.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@solderzzc
solderzzc merged commit 0573f02 into main Oct 21, 2026
7 checks passed
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