pub struct MemoryPlanOptions {
pub allocate_params: bool,
pub allocate_inputs: bool,
pub allocate_constants: bool,
pub arena_no_reuse: bool,
pub pin_output_ancestors: bool,
}Expand description
Assign buffers using a greedy best-fit algorithm.
Sorts buffers by size (largest first), then for each buffer finds the smallest free gap in the arena during its live interval. This is a simplified version of XLA’s GlobalDecreasingSizeBestFitHeap. Controls which graph boundaries receive arena slots during planning.
Inference graphs use Self::inference (all boundaries allocated).
Backward graphs in a training pair use Self::backward_activations_only:
parameters borrow offsets from the forward plan via SharedWeightLayout
so weights are not stored twice in the activation arena.
Fields§
§allocate_params: bool§allocate_inputs: bool§allocate_constants: bool§arena_no_reuse: boolWhen true (or env RLX_ARENA_NO_REUSE=1), every tensor gets a unique arena slot.
pin_output_ancestors: boolWhen true (default), pin the entire transitive ancestor DAG of the graph outputs to the final step. That’s a conservative guard for out-of-order execution, but it destroys slot reuse on deep feed-forward graphs (the HiFi-GAN decoder hit a 5 GB arena). In-order executors (CPU, wgpu) can set this false: only the output nodes are pinned (read-back protection), which is sufficient and keeps the arena small.
Implementations§
Source§impl MemoryPlanOptions
impl MemoryPlanOptions
pub fn inference() -> Self
Sourcepub fn backward_activations_only() -> Self
pub fn backward_activations_only() -> Self
Activations + inputs/constants only; params bound via SharedWeightLayout.
Trait Implementations§
Source§impl Clone for MemoryPlanOptions
impl Clone for MemoryPlanOptions
Source§fn clone(&self) -> MemoryPlanOptions
fn clone(&self) -> MemoryPlanOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more