We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df5d5c7 commit 1f1f922Copy full SHA for 1f1f922
Source/MLX/Transforms+Compile.swift
@@ -9,6 +9,8 @@ final class CompiledFunction: @unchecked (Sendable) {
9
/// unique (for the lifetime of the object) identifier for the compiled function
10
private var id: UInt!
11
12
+ let lock = NSLock()
13
+
14
/// the function to compile
15
let f: ([MLXArray]) -> [MLXArray]
16
@@ -35,6 +37,12 @@ final class CompiledFunction: @unchecked (Sendable) {
35
37
}
36
38
39
func call(_ arguments: [MLXArray]) -> [MLXArray] {
40
+ lock.withLock {
41
+ innerCall(arguments)
42
+ }
43
44
45
+ func innerCall(_ arguments: [MLXArray]) -> [MLXArray] {
46
let stateInputs = inputs.flatMap { $0.innerState() }
47
let argumentsCount = arguments.count
48
0 commit comments