pub struct PromptCacheModelIdentity { /* private fields */ }Expand description
Cache-relevant structure derived from a prepared model.
Implementations§
Source§impl PromptCacheModelIdentity
impl PromptCacheModelIdentity
Sourcepub fn new(
model_family: impl Into<String>,
effective_model_type: impl Into<String>,
architecture_fingerprint: impl Into<String>,
layer_count: usize,
global_layer_start: usize,
global_layer_end: usize,
sink_tokens: usize,
topology: PromptCacheTopology,
layer_layout: LayerSchedule<LayerCachePolicy>,
layer_prefix_offsets: Vec<i32>,
state_segments: Vec<PromptCacheStateSegment>,
) -> Result<Self, PromptCacheError>
pub fn new( model_family: impl Into<String>, effective_model_type: impl Into<String>, architecture_fingerprint: impl Into<String>, layer_count: usize, global_layer_start: usize, global_layer_end: usize, sink_tokens: usize, topology: PromptCacheTopology, layer_layout: LayerSchedule<LayerCachePolicy>, layer_prefix_offsets: Vec<i32>, state_segments: Vec<PromptCacheStateSegment>, ) -> Result<Self, PromptCacheError>
Creates and validates cache-relevant prepared-model identity.
Sourcepub fn model_family(&self) -> &str
pub fn model_family(&self) -> &str
Stable architecture family.
Sourcepub fn effective_model_type(&self) -> &str
pub fn effective_model_type(&self) -> &str
Effective normalized model type.
Sourcepub fn architecture_fingerprint(&self) -> &str
pub fn architecture_fingerprint(&self) -> &str
Cache-relevant architecture identity.
Sourcepub const fn layer_count(&self) -> usize
pub const fn layer_count(&self) -> usize
Total model layer count.
Sourcepub const fn global_layer_start(&self) -> usize
pub const fn global_layer_start(&self) -> usize
Inclusive first global layer owned locally.
Sourcepub const fn global_layer_end(&self) -> usize
pub const fn global_layer_end(&self) -> usize
Exclusive global layer boundary owned locally.
Sourcepub const fn sink_tokens(&self) -> usize
pub const fn sink_tokens(&self) -> usize
Attention sink token count.
Sourcepub const fn topology(&self) -> &PromptCacheTopology
pub const fn topology(&self) -> &PromptCacheTopology
Distributed rank-local layout.
Sourcepub const fn layer_layout(&self) -> &LayerSchedule<LayerCachePolicy>
pub const fn layer_layout(&self) -> &LayerSchedule<LayerCachePolicy>
Ordered cache layout.
Sourcepub fn layer_prefix_offsets(&self) -> &[i32]
pub fn layer_prefix_offsets(&self) -> &[i32]
Per-layer processed-token deltas.
Sourcepub fn state_segments(&self) -> &[PromptCacheStateSegment]
pub fn state_segments(&self) -> &[PromptCacheStateSegment]
Named state-layout ranges.
Sourcepub fn key_value_layouts(
sliding_windows: impl IntoIterator<Item = Option<i32>>,
num_key_value_heads: i32,
head_dim: i32,
) -> Result<LayerSchedule<LayerCachePolicy>, PromptCacheError>
pub fn key_value_layouts( sliding_windows: impl IntoIterator<Item = Option<i32>>, num_key_value_heads: i32, head_dim: i32, ) -> Result<LayerSchedule<LayerCachePolicy>, PromptCacheError>
Builds an ordered ordinary key/value layout from runtime window values.
Sourcepub fn compressed_layouts(
layer_count: usize,
latent_dim: i32,
rotary_dim: i32,
) -> Result<LayerSchedule<LayerCachePolicy>, PromptCacheError>
pub fn compressed_layouts( layer_count: usize, latent_dim: i32, rotary_dim: i32, ) -> Result<LayerSchedule<LayerCachePolicy>, PromptCacheError>
Builds a uniform compressed-latent layout.
Sourcepub fn validate(&self) -> Result<(), PromptCacheError>
pub fn validate(&self) -> Result<(), PromptCacheError>
Validates the owned layer range and every policy.
Sourcepub fn state_segment(
&self,
id: &str,
) -> Result<&PromptCacheStateSegment, PromptCacheError>
pub fn state_segment( &self, id: &str, ) -> Result<&PromptCacheStateSegment, PromptCacheError>
Returns one architecture-declared state segment by stable identity.
Sourcepub fn select_state_segment(&self, id: &str) -> Result<Self, PromptCacheError>
pub fn select_state_segment(&self, id: &str) -> Result<Self, PromptCacheError>
Selects one named state segment as a validated standalone identity.
Trait Implementations§
Source§impl Clone for PromptCacheModelIdentity
impl Clone for PromptCacheModelIdentity
Source§fn clone(&self) -> PromptCacheModelIdentity
fn clone(&self) -> PromptCacheModelIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more