@@ -18,6 +18,9 @@ public struct InputContext: Sendable {
1818 public let batchSize : Int
1919 /// Sliding window size (nil for models without sliding attention).
2020 public let slidingWindow : Int ?
21+ /// The active graph's input descriptors, keyed by input name. Lets a handler size its
22+ /// own output buffer to the running bucket. Empty for engines that don't vary by bucket.
23+ public let descriptors : [ String : NDArrayDescriptor ]
2124
2225 /// For dynamic-shape engines (Sequential, Pipelined).
2326 /// alignedStep = processedTokenCount, batchSize = tokens.count.
@@ -30,22 +33,25 @@ public struct InputContext: Sendable {
3033 processedTokenCount: processedTokenCount,
3134 alignedStep: processedTokenCount,
3235 batchSize: tokens. count,
33- slidingWindow: nil )
36+ slidingWindow: nil ,
37+ descriptors: [ : ] )
3438 }
3539
3640 /// For static-shape engines. Batch is fixed-size and aligned.
3741 public static func `static`(
3842 tokens: ArraySlice < Int32 > ,
3943 alignedStep: Int ,
4044 batchSize: Int ,
41- slidingWindow: Int ?
45+ slidingWindow: Int ? ,
46+ descriptors: [ String : NDArrayDescriptor ] = [ : ]
4247 ) -> InputContext {
4348 InputContext (
4449 tokens: tokens,
4550 processedTokenCount: alignedStep,
4651 alignedStep: alignedStep,
4752 batchSize: batchSize,
48- slidingWindow: slidingWindow)
53+ slidingWindow: slidingWindow,
54+ descriptors: descriptors)
4955 }
5056}
5157
0 commit comments