defines
Classes
TensorLifetime
Tensor operator lifetime.
Attributes:
-
tensor_id(TensorId) –Unique identifier for the tensor
-
start_op(int) –Index of the first operator that uses/defines it
-
end_op(int) –Index of the last operator that uses it
Functions
add_op
merge
Merge another lifetime into this one.
This updates the start and end operators to encompass both lifetimes. Useful when tensors have aliases.
Parameters:
-
(otherTensorLifetime) –Another tensor lifetime to merge
TensorAllocation
Metadata for a tensor allocation.
Attributes:
-
tensor_id(TensorId) –Unique identifier for the tensor
-
memory(MemoryType) –Memory type for the allocation
-
offset(int) –Offset within the memory arena
-
size(int) –Size of the allocation in bytes
ArenaUsage
Metadata for a memory arena.
Attributes:
-
memory(MemoryType) –Memory type (e.g., DTCM, ITCM)
-
total_size(int) –Total bytes in this arena
-
used(int) –Bytes actually used
MemoryConstraint
User-defined memory constraint
Attributes:
-
name(MemoryType) –Memory type (e.g., DTCM, ITCM)
-
max_size(int | None) –Maximum size in bytes, or None for no limit
MemoryPlan
Top-level memory plan for tensors.
Attributes:
-
tensor_allocs(dict[str, TensorAllocation]) –Tensor allocations
-
arena_usages(dict[MemoryType, ArenaUsage]) –Memory arena usages
-
tensor_lifetimes(dict[TensorId, TensorLifetime]) –Tensor lifetimes
Functions
get_allocation
Get the allocation metadata for a given tensor ID.
Parameters:
-
(tensor_idstr) –The tensor ID to look up.
Raises:
-
KeyError–If the tensor ID is not found in the allocations.
Returns:
-
TensorAllocation(TensorAllocation) –The allocation metadata for the tensor.
MemoryPlannerType
TensorAttributes
This class provides the baseline set of tensor attribute rules.
Attributes:
-
memory(MemoryType) –Memory placement for tensors