utils
Memory Planners Utilities API
The utils
module provides utility functions for memory planning in the AOT compilation process.
Functions:
-
compute_tensor_lifetimes
–Computes the lifetimes of tensors based on the operators.
-
compute_tensor_sizes
–Computes the size of each tensor in bytes.
-
merge_free_list
–Merges contiguous free blocks in memory.
Copyright 2025 Ambiq. All Rights Reserved.
Classes
Functions
compute_tensor_lifetimes
Compute the lifetimes of tensors based on the operators.
For each tensor (by buffer index), compute its lifetime as a tuple (first, last) based on the operator order. The lifetime is defined by the first operator that uses or produces the tensor and the last operator that uses it.
Parameters:
-
operators
list
) –List of AotOperator objects.
Returns:
-
lifetimes
(dict
) –Mapping from tensor buffer index to a tuple (first, last).