Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Libraries/MLXLMCommon/Evaluate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ private func runSynchronousGenerationLoop(
// exits the program right away, those tasks will still be executing and will
// 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.


return SynchronousGenerationLoopResult(
generatedTokenIds: generatedTokenIds,
Expand Down Expand Up @@ -2368,7 +2368,7 @@ private func generateLoopTask<
// `while let token = iterator.next()` form) allowed one extra asyncEval to be
// submitted post-cancellation, which faults if the app has backgrounded
// (kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted). The
// post-loop block below assigns `.cancelled`; Stream().synchronize() still
// post-loop block below assigns `.cancelled`; Stream.defaultStream.synchronize() still
// settles any in-flight evaluation at the end of the task body.
tokenLoop: while !Task.isCancelled {
guard let token = autoreleasepool(invoking: { iterator.next() }) else { break }
Expand Down Expand Up @@ -2463,7 +2463,7 @@ private func generateLoopTask<
_ = continuation.yield(handler.infoEvent(info))

// Synchronize with the stream to ensure tasks are completed
Stream().synchronize()
Stream.defaultStream.synchronize()

// Finalize the stream
continuation.finish()
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ let package = Package(
.default(enabledTraits: ["FoundationModelsIntegration"]),
],
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.

// 602.0.0 floor: swift.org publishes signed prebuilt swift-syntax artifacts only for
// >= 602 tags on current toolchains; a 600.x/601.x resolution falls back to the full
// source compile of swift-syntax.
Expand Down
4 changes: 2 additions & 2 deletions Tests/MLXLMTests/CancellationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class CancellationTests: XCTestCase {
}

// Stream-consumer break cancels the task via onTermination. The generation task
// must still settle (run Stream().synchronize()) before task.value returns.
// must still settle (run Stream.defaultStream.synchronize()) before task.value returns.
func testGenerateTaskSettlesAfterStreamCancellation() async throws {
let model = makeTinyModel()
let tokenizer = TestTokenizer()
Expand All @@ -44,7 +44,7 @@ final class CancellationTests: XCTestCase {
// continuation.onTermination → task.cancel().
for await _ in stream { break }

// Must complete without hanging. Failure here means Stream().synchronize()
// Must complete without hanging. Failure here means Stream.defaultStream.synchronize()
// was not reached or the task body was not allowed to run to completion.
await task.value
}
Expand Down
Loading
Loading