Skip to content

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
add_op(op_idx: int)

Add an operator index to the lifetime.

Parameters:

  • op_idx
    (int) –

    Operator index to add

merge
merge(other: TensorLifetime)

Merge another lifetime into this one.

This updates the start and end operators to encompass both lifetimes. Useful when tensors have aliases.

Parameters:

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

Functions

allocate
allocate(size: int) -> int

Allocate a segment of the arena and return its offset

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:

Functions

get_allocation
get_allocation(tensor_id: str) -> TensorAllocation

Get the allocation metadata for a given tensor ID.

Parameters:

  • tensor_id
    (str) –

    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

Memory planner type

Attributes:

  • greedy (str) –

    Greedy memory planner

TensorAttributes

This class provides the baseline set of tensor attribute rules.

Attributes:

  • memory (MemoryType) –

    Memory placement for tensors

MemoryFreeBlock

Metadata for a free memory block.

Attributes:

  • offset (int) –

    Offset of the free block

  • size (int) –

    Size of the free block

MemoryActiveBlock

Metadata for an active memory block.

Attributes:

  • end_time (int) –

    End time of the active block

  • offset (int) –

    Offset of the active block

  • size (int) –

    Size of the active block