pub struct PromptCacheDescriptor { /* private fields */ }Expand description
Caller-supplied identity and geometry for a reusable prefix cache.
Implementations§
Source§impl PromptCacheDescriptor
impl PromptCacheDescriptor
Sourcepub fn new(
model_family: impl Into<String>,
effective_model_type: impl Into<String>,
checkpoint_fingerprint: impl Into<String>,
prefix_content_fingerprint: impl Into<String>,
architecture_fingerprint: impl Into<String>,
layer_count: usize,
global_layer_start: usize,
global_layer_end: usize,
batch_size: usize,
layer_layout: LayerSchedule<LayerCachePolicy>,
layer_prefix_offsets: Vec<i32>,
state_segments: Vec<PromptCacheStateSegment>,
sink_tokens: usize,
topology: PromptCacheTopology,
) -> Result<Self, PromptCacheError>
pub fn new( model_family: impl Into<String>, effective_model_type: impl Into<String>, checkpoint_fingerprint: impl Into<String>, prefix_content_fingerprint: impl Into<String>, architecture_fingerprint: impl Into<String>, layer_count: usize, global_layer_start: usize, global_layer_end: usize, batch_size: usize, layer_layout: LayerSchedule<LayerCachePolicy>, layer_prefix_offsets: Vec<i32>, state_segments: Vec<PromptCacheStateSegment>, sink_tokens: usize, topology: PromptCacheTopology, ) -> Result<Self, PromptCacheError>
Creates and validates a complete reusable prefix-cache descriptor.
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 checkpoint_fingerprint(&self) -> &str
pub fn checkpoint_fingerprint(&self) -> &str
Caller-verified checkpoint identity.
Sourcepub fn prefix_content_fingerprint(&self) -> &str
pub fn prefix_content_fingerprint(&self) -> &str
Prefix-content identity.
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 stored by this rank.
Sourcepub const fn global_layer_end(&self) -> usize
pub const fn global_layer_end(&self) -> usize
Exclusive global layer boundary stored by this rank.
Sourcepub const fn batch_size(&self) -> usize
pub const fn batch_size(&self) -> usize
Prefix batch size.
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 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 fn with_topology(
self,
topology: PromptCacheTopology,
) -> Result<Self, PromptCacheError>
pub fn with_topology( self, topology: PromptCacheTopology, ) -> Result<Self, PromptCacheError>
Replaces the distributed topology and revalidates the descriptor.
Sourcepub fn with_architecture_fingerprint(
self,
architecture_fingerprint: impl Into<String>,
) -> Result<Self, PromptCacheError>
pub fn with_architecture_fingerprint( self, architecture_fingerprint: impl Into<String>, ) -> Result<Self, PromptCacheError>
Replaces the cache-relevant architecture fingerprint.
Sourcepub fn with_layer_count(
self,
layer_count: usize,
) -> Result<Self, PromptCacheError>
pub fn with_layer_count( self, layer_count: usize, ) -> Result<Self, PromptCacheError>
Replaces the total model layer count while preserving the owned range.
Sourcepub fn from_model_identity(
model: PromptCacheModelIdentity,
checkpoint_fingerprint: impl Into<String>,
prefix_content_fingerprint: impl Into<String>,
batch_size: usize,
) -> Result<Self, PromptCacheError>
pub fn from_model_identity( model: PromptCacheModelIdentity, checkpoint_fingerprint: impl Into<String>, prefix_content_fingerprint: impl Into<String>, batch_size: usize, ) -> Result<Self, PromptCacheError>
Derives every model-owned field from a prepared model identity.
The checkpoint and prefix-content fingerprints remain caller-owned because they identify the concrete weights and processed input rather than model structure.
Sourcepub fn validate(&self) -> Result<(), PromptCacheError>
pub fn validate(&self) -> Result<(), PromptCacheError>
Validates the complete portable identity and cache geometry.
Trait Implementations§
Source§impl Clone for PromptCacheDescriptor
impl Clone for PromptCacheDescriptor
Source§fn clone(&self) -> PromptCacheDescriptor
fn clone(&self) -> PromptCacheDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more