Skip to content

aot_memory_planner

AotMemoryPlanner API

This class is the base class for all memory planners in the HeliosAOT framework.

Classes:

Functions:

Copyright 2025 Ambiq. All Rights Reserved.

Classes

AotMemoryPlanner

AotMemoryPlanner(operators: list[AotOperator], model: ModelT, subgraph: SubGraphT)

Functions

plan_memory
plan_memory() -> tuple[dict[int, int], int]

Allocate offsets for each tensor in a shared buffer using a first-fit algorithm that reuses gaps from tensors whose lifetimes have ended. This version also merges contiguous free blocks, and if the last free block aligns with the current offset, that block will be used for allocation.

Returns:

  • allocation ( dict ) –

    Mapping from tensor index -> offset (in bytes).

  • total_size ( int ) –

    Total buffer size required.

Functions

register_memory_planner

register_memory_planner(cls: Type[AotMemoryPlanner]) -> Type[AotMemoryPlanner]

Class decorator: register each memory planner by its NAME.

get_memory_planner

get_memory_planner(name: str) -> Type[AotMemoryPlanner]

Get a memory planner by its name.