pub enum PerfModel {
Polynomial,
Fixed {
prefill_ms: f64,
decode_ms: f64,
},
Interpolated {
prefill_interp: Arc<dyn PrefillInterpolator>,
decode_interp: Arc<dyn DecodeInterpolator>,
},
Aiconfigurator {
callback: Arc<dyn AicCallback>,
},
}Expand description
Performance model for predicting prefill and decode timing
Variants§
Polynomial
Select the built-in AISimulate polynomial timing model.
Fixed
Constant per-pass latencies owned by the AISimulate engine.
Interpolated
Interpolation-based model using profiler data Decode axes: (scheduled logical KV tokens, mean context length)
Aiconfigurator
AI Configurator SDK calls through the configured callback. Passes the reduced prefill inputs (batch_size, effective_isl, prefix).
Fields
callback: Arc<dyn AicCallback>Implementations§
Source§impl PerfModel
impl PerfModel
Sourcepub fn from_npz(path: &Path) -> Result<Self>
pub fn from_npz(path: &Path) -> Result<Self>
Load performance model from NPZ file
Expected arrays in NPZ file:
- prefill_isl: 1D array of input sequence lengths
- prefill_ttft_ms: 1D array of time to first token in milliseconds
- decode_active_kv_tokens: 1D array of scheduled logical KV token counts
- decode_context_length: 1D array of context lengths
- decode_itl: 2D array of inter-token latencies in milliseconds
Sourcepub fn from_aic_callback(callback: Arc<dyn AicCallback>) -> Self
pub fn from_aic_callback(callback: Arc<dyn AicCallback>) -> Self
Create an Aiconfigurator perf model from a callback.
Sourcepub fn predict_prefill_time(
&self,
batch_size: usize,
isl: usize,
prefix: usize,
) -> Result<f64>
pub fn predict_prefill_time( &self, batch_size: usize, isl: usize, prefix: usize, ) -> Result<f64>
Predict prefill time in milliseconds.
Callers always pass all parameters; each external variant uses what it needs:
- Interpolated uses total new tokens across the batch
(
batch_size * (isl - prefix)). - Aiconfigurator: passes (batch_size, isl - prefix, prefix) to the AIC SDK
Sourcepub fn predict_decode_time(
&self,
batch_size: usize,
active_kv_tokens: usize,
context_length: usize,
_total_kv_tokens: usize,
) -> Result<f64>
pub fn predict_decode_time( &self, batch_size: usize, active_kv_tokens: usize, context_length: usize, _total_kv_tokens: usize, ) -> Result<f64>
Predict decode time in milliseconds.
active_kv_tokens is the sum of logical context lengths in the scheduled
batch, not the number of distinct physically resident tokens.
Callers always pass all parameters; each variant uses what it needs:
- Interpolated: uses (active_kv_tokens, context_length)
- Aiconfigurator: uses (batch_size, context_length)