Repository navigation
Keep CompiledTrace's compiled function non-Sendable (fixes Sendable mlx-swift compile) - #87
Merged
Merged
Conversation
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>
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.
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, andCompiledTrace.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
@Sendableon 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