greedy_memory_planner
GreedyMemoryPlanner API
The GreedyMemoryPlanner
class implements a greedy algorithm for memory allocation in the context of AOT (Ahead-Of-Time) compilation for machine learning models.
It is designed to optimize memory usage by reusing gaps from tensors whose lifetimes have ended.
Classes:
-
GreedyMemoryPlanner
–Implements a greedy memory allocation strategy for tensors in a shared buffer.
Copyright 2025 Ambiq. All Rights Reserved.
Classes
GreedyMemoryPlanner
Functions
plan_memory
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: