Skip to content

Commit fa64cf6

Browse files
author
Aegis AI Assistant
committed
chore: fix Sendable violations, deprecations, and unused variables for CI stabilization
1 parent 52c158e commit fa64cf6

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

Libraries/MLXLLM/Models/Qwen35.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// Port of https://github.com/ml-explore/mlx-lm/blob/main/mlx_lm/models/qwen3_5.py
88
//
99

10+
@preconcurrency import AVFoundation
11+
@preconcurrency import CoreImage.CIFilterBuiltins
1012
import Foundation
1113
import MLX
1214
import MLXLMCommon
@@ -550,7 +552,7 @@ final class Qwen35DecoderLayer: Module {
550552
// (blocking the CPU). Ensuring the previous GPU work is committed and completed
551553
// means the expert GEMM executes on an isolated, empty Metal Command Buffer.
552554
// ─────────────────────────────────────────────────────────────────────
553-
if let moeBlock = self.mlp as? Qwen35SparseMoeBlock {
555+
if let _ = self.mlp as? Qwen35SparseMoeBlock {
554556
if let cacheState = cache {
555557
eval([h] + cacheState.innerState())
556558
} else {
@@ -561,7 +563,7 @@ final class Qwen35DecoderLayer: Module {
561563

562564
let mlpOutput = (self.mlp as! UnaryLayer)(postAttentionLayerNorm(h))
563565
let finalH = h + mlpOutput
564-
if let moeBlock = self.mlp as? Qwen35SparseMoeBlock {
566+
if let _ = self.mlp as? Qwen35SparseMoeBlock {
565567
eval(finalH)
566568
Stream.gpu.synchronize()
567569
}

Libraries/MLXLMCommon/LayerPartitioning.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public func partitionedLayerCall<T>(
152152
}
153153

154154
// 2. Clear MLX's internal Metal buffer pool.
155-
GPU.clearCache()
155+
Memory.clearCache()
156156
}
157157

158158
return result

Libraries/MLXLMCommon/SwitchLayers.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import Foundation
2-
import MLX
1+
@preconcurrency import MLX
32
import MLXNN
43

54
// Port of https://github.com/ml-explore/mlx-examples/blob/main/llms/mlx_lm/models/switch_layers.py
@@ -27,15 +26,15 @@ public func scatterUnsort(x: MLXArray, invOrder: MLXArray, shape: [Int]? = nil)
2726

2827

2928
// Shared struct for expert range tracking across projections
30-
public struct ExpertRange {
29+
public struct ExpertRange: Sendable {
3130
public let id: Int
3231
public let start: Int
3332
public let end: Int
3433
}
3534

3635
// MARK: - SwitchGLU
3736

38-
public class SwitchGLU: Module {
37+
public class SwitchGLU: Module, @unchecked Sendable {
3938
@ModuleInfo(key: "gate_proj") public var gateProj: SwitchLinear
4039
@ModuleInfo(key: "up_proj") public var upProj: SwitchLinear
4140
@ModuleInfo(key: "down_proj") public var downProj: SwitchLinear
@@ -654,9 +653,8 @@ public class QuantizedSwitchLinear: SwitchLinear, Quantized {
654653
outShape[outShape.count - 1] = self.outputDims
655654
return MLXArray.zeros(outShape).asType(.float16)
656655
}
657-
658656
// PAPPS Heuristic: Prefetch exactly these experts so they are in cache for the N+1 token.
659-
if let info = ssdInfo {
657+
if let _ = ssdInfo {
660658
let uniqueIndices = Set(cpuIndices)
661659
for _ in uniqueIndices {
662660
// MLXFast.pappsPrefetch(
@@ -804,8 +802,8 @@ public final class SSDStreamMetrics: @unchecked Sendable {
804802
let now = DispatchTime.now().uptimeNanoseconds
805803
if now - lastLogTimeNs >= 1_000_000_000 {
806804
let count = readCount
807-
let bytes = totalBytes
808-
let ns = totalTimeNs
805+
_ = totalBytes
806+
_ = totalTimeNs
809807

810808
self.readCount = 0
811809
self.totalBytes = 0

Libraries/MLXVLM/MediaProcessing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright © 2024 Apple Inc.
22

33
@preconcurrency import AVFoundation
4-
import CoreImage.CIFilterBuiltins
4+
@preconcurrency import CoreImage.CIFilterBuiltins
55
import MLX
66
import MLXLMCommon
77

0 commit comments

Comments
 (0)