planner
AotMemoryPlanner API
This class is the base class for all memory planners in the heliaAOT framework.
Classes:
-
AotMemoryPlanner–Base class for memory planners
Functions:
Copyright 2025 Ambiq. All Rights Reserved.
Classes
AirMemoryPlanner
Functions
fill_memory_constraints
fill_memory_constraints(_model: AirModel, constraints: list[MemoryConstraint] | None = None) -> dict[MemoryType, MemoryConstraint]
Resolve memory constraints, filling defaults from the target when max_size is None.
fill_tensor_constraints
fill_tensor_constraints(model: AirModel, attributes: list[AttributeRuleset] | None = None) -> dict[TensorId, TensorAttributes]
Resolve per-tensor placement constraints from attribute rules.
merge_alias_lifetimes_to_fixed_point
merge_alias_lifetimes_to_fixed_point(model: AirModel, tensor_lifetimes: dict[TensorId, TensorLifetime]) -> None
Merge alias-linked tensor lifetimes until no live range changes remain.
populate_alias_allocations
populate_alias_allocations(model: AirModel, plan: MemoryPlan, sorted_tensors: list[tuple[TensorId, TensorLifetime]]) -> None
Populate allocation entries for alias tensors by reusing root allocations.
plan
plan(model: AirModel, memory_constraints: list[MemoryConstraint] | None = None, tensor_constraints: list[AttributeRuleset] | None = None) -> MemoryPlan
Plan tensor memory allocation for the model.
Every tensor is bound to an arena slot. Persistent tensors
live in their own per-bank persistent arenas; constant tensors
live in per-destination-memory constant arenas (cold by
default — the arena buffer is the read-only blob in source
memory; staged when a per-tensor
constant_destination_memory differs from memory, in
which case the arena buffer is a writable runtime copy and a
separate source blob lives in the source memory).
Parameters:
-
(modelAirModel) –The target model.
-
(memory_constraintslist[MemoryConstraint] | None, default:None) –Memory constraints (per-platform writable budget).
-
(tensor_constraintslist[AttributeRuleset] | None, default:None) –Per-tensor attribute rules (memory placement,
constant_destination_memoryoverride, etc.).
Returns:
-
MemoryPlan(MemoryPlan) –The memory plan containing offsets and total
-
MemoryPlan–size.
Functions
register_memory_planner
Class decorator: register each memory planner by its NAME.