Skip to main content

memory_planner

Function memory_planner 

Source
pub fn memory_planner(
    schedule: &Schedule,
    output_buffer_ids: &HashSet<u64>,
    mode: PlannerMode,
) -> MemoryPlannerResult
Expand description

Run memory planner on a schedule.

Analyzes buffer lifetimes and identifies opportunities for buffer reuse. Returns a mapping from logical buffers to physical buffers.

§Arguments

  • schedule - The execution schedule to optimize
  • output_buffer_ids - IDs of output buffers that must not be reused
  • mode - Selects the planner strategy. PlannerMode::Disabled returns an empty result without analyzing the schedule. PlannerMode::Remap runs liveness-based pool reuse. PlannerMode::Arena runs the tinygrad-style arena packing pass via [memory_plan_arena].

§Returns

MemoryPlannerResult containing buffer replacements and statistics.