Skip to content

Commit 5619cac

Browse files
committed
Fix Swift format
1 parent 78f1d53 commit 5619cac

6 files changed

Lines changed: 500 additions & 11 deletions

File tree

swift/Sources/CoreAILanguageModels/Handlers/StateHandler+NDArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public struct GrowingNDArrayState: SyncStateHandler {
176176
// MARK: - Shared Utilities
177177

178178
/// Zero-initialize an NDArray, dispatching on scalar type.
179-
fileprivate func zeroFillNDArray(_ array: inout NDArray) {
179+
private func zeroFillNDArray(_ array: inout NDArray) {
180180
let count = array.shape.reduce(1, *)
181181
switch array.scalarType {
182182
case .float16, .bfloat16:

swift/Sources/CoreAILanguageModels/Handlers/StateHandlerFactory.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ struct SyncStateHandlerSet {
3333
/// 2. Shape-based heuristic — dynamic dim → kvCache, static + "cache" in name → slidingCache, else → fixed
3434
/// 3. Legacy (2 states) — both kvCache, no warning
3535
enum StateHandlerFactory {
36-
3736
/// Classify states using metadata or heuristic fallback.
3837
static func classifyStates(
3938
descriptor: InferenceFunctionDescriptor,
@@ -67,11 +66,13 @@ enum StateHandlerFactory {
6766
guard case .ndArray(let desc) = descriptor.stateDescriptor(of: name) else { continue }
6867
let shapeStr = desc.shape.map { $0 < 0 ? "?" : "\($0)" }.joined(separator: "×")
6968
let growth = desc.shape.contains(where: { $0 < 0 }) ? "GROWING" : "FIXED"
70-
CLILogger.log(" \(name): \(growth) \(kind.rawValue) (\(shapeStr))",
71-
component: "StateHandlerFactory")
69+
CLILogger.log(
70+
" \(name): \(growth) \(kind.rawValue) (\(shapeStr))",
71+
component: "StateHandlerFactory")
7272
}
73-
CLILogger.log(" Add \"states\" to metadata.json for explicit control.",
74-
component: "StateHandlerFactory")
73+
CLILogger.log(
74+
" Add \"states\" to metadata.json for explicit control.",
75+
component: "StateHandlerFactory")
7576
}
7677
if !verbose && names.count > 2 {
7778
CLILogger.log(

swift/Sources/CoreAILanguageModels/InferenceEngines/CoreAIPipelinedEngine.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,8 @@ private struct EngineImpl: ~Copyable {
515515
let valueCacheName = growingNames[1]
516516

517517
// Fixed states: everything that isn't the primary growing KV pair
518-
let fixedNames = classified
518+
let fixedNames =
519+
classified
519520
.filter { $0.kind == .slidingCache || $0.kind == .fixed }
520521
.map(\.name)
521522
// Additional growing states beyond the primary pair
@@ -619,7 +620,8 @@ private struct EngineImpl: ~Copyable {
619620
"Cannot get descriptor for persistent state '\(name)'")
620621
}
621622
// Resolve dynamic dims to max for any extra growing states
622-
let resolved = desc.shape.contains(where: { $0 < 0 })
623+
let resolved =
624+
desc.shape.contains(where: { $0 < 0 })
623625
? desc.resolvingDynamicDimensions(desc.shape.map { $0 < 0 ? config.maxContextLength : $0 })
624626
: desc
625627
extraStates.append((name, resolved))

swift/Sources/CoreAILanguageModels/InferenceEngines/CoreAISequentialEngine.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ public final class CoreAISequentialEngine: InferenceEngine, @unchecked Sendable
474474
CLILogger.log("CoreAI clean engine cleanup complete")
475475
cleanupSpan.end()
476476
}
477-
478477
}
479478

480479
extension CoreAISequentialEngine {

0 commit comments

Comments
 (0)