pub enum PerfModel {
Polynomial,
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
Default polynomial-based model using hardcoded formulas
Interpolated
Interpolation-based model using profiler data Decode axes: (active_kv_tokens, 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 active 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 variant uses what it needs:
- Polynomial/Interpolated: uses total new tokens across the batch
(
batch_size * (isl - prefix)), modeling GPU processing total tokens in parallel - 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.
Callers always pass all parameters; each variant uses what it needs:
- Polynomial: uses (active_kv_tokens, total_kv_tokens) as utilization
- Interpolated: uses (active_kv_tokens, context_length)
- Aiconfigurator: uses (batch_size, context_length)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PerfModel
impl !UnwindSafe for PerfModel
impl Freeze for PerfModel
impl Send for PerfModel
impl Sync for PerfModel
impl Unpin for PerfModel
impl UnsafeUnpin for PerfModel
Blanket Implementations§
impl<T> BlockMetadata for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more