ZigZag - Deep Learning Hardware Design Space Exploration
This repository presents the novel version of our tried-and-tested hardware Architecture-Mapping Design Space Exploration (DSE) Framework for Deep Learning (DL) accelerators. ZigZag bridges the gap between algorithmic DL decisions and their acceleration cost on specialized accelerators through a fast and accurate hardware cost estimation.
MemoryHierarchy Class Reference

Class that represents a memory hierarchy as a directed networkx graph. More...

Inheritance diagram for MemoryHierarchy:
Collaboration diagram for MemoryHierarchy:

Public Member Functions

def __init__ (self, OperationalArrayABC operational_array, str name="Memory Hierarchy", **Any attr)
 Initialize the memory hierarchy graph. More...
 
None add_memory (self, MemoryInstance memory_instance, list[MemoryOperand] operands, PortAllocation port_alloc, ServedMemDimensions served_dimensions)
 Adds a memory to the memory hierarchy graph. More...
 
list[MemoryLevel] get_memory_levels (self, MemoryOperand mem_op)
 Returns a list of memories in the memory hierarchy for the memory operand. More...
 
set[MemoryOperandget_operands (self)
 Returns all the memory operands this memory hierarchy graph contains as a set. More...
 
list[MemoryLevel] get_inner_memories (self)
 Returns the inner-most memory levels for all memory operands. More...
 
list[MemoryLevel] get_outer_memories (self)
 Returns the outer-most memory levels for all memory operands. More...
 
tuple[list[MemoryLevel], int] get_top_memories (self)
 Returns the 'top'-most MemoryLevels, where 'the' level of MemoryLevel is considered to be the largest level it has across its assigned operands. More...
 
tuple[list[MemoryLevel], int] get_operator_top_level (self, MemoryOperand operand)
 Finds the highest level of memories that have the given operand assigned to it, and returns the MemoryLevel instance on this level that have the operand assigned to it. More...
 
MemoryLevel get_operand_top_level (self, MemoryOperand operand)
 Finds the highest level of memory that have the given operand assigned to, and returns the MemoryLevel. More...
 
def __jsonrepr__ (self)
 JSON Representation of this object to save it to a json file. More...
 
bool __eq__ (self, object other)
 
def has_same_performance (self, "MemoryHierarchy" other)
 
- Public Member Functions inherited from DiGraphWrapper
list[tuple[T, T]] in_edges (self, T node, Literal[False] data)
 
list[tuple[T, T, dict[str, Any]]] in_edges (self, T node, Literal[True] data)
 
list[tuple[T, T]] in_edges (self, T node)
 
list[tuple[T, T]]|list[tuple[T, T, dict[str, Any]]] in_edges (self, T node, bool data=False)
 
list[tuple[T, T, dict[str, Any]]] out_edges (self, T node, Literal[True] data)
 
list[tuple[T, T]] out_edges (self, T node, Literal[False] data)
 
list[tuple[T, T]] out_edges (self, T node)
 
list[tuple[T, T]]|list[tuple[T, T, dict[str, Any]]] out_edges (self, T node, bool data=False)
 
Iterator[tuple[T, int]] in_degree (self)
 
Iterator[tuple[T, int]] out_degree (self, Literal[None] node)
 
Iterator[tuple[T, int]] out_degree (self)
 
int out_degree (self, T node)
 
int|Iterator[tuple[T, int]] out_degree (self, T|None node=None)
 
Iterator[Tsuccessors (self, T node)
 
Iterator[Tpredecessors (self, T node)
 
Iterator[Ttopological_sort (self)
 
None add_node (self, T node)
 
None add_nodes_from (self, Sequence[T] node)
 
None remove_nodes_from (self, Iterator[T] nodes)
 
None add_edge (self, T edge_from, T edge_to)
 
None add_edges_from (self, Sequence[tuple[T, T]|tuple[T, T, Any]] edges)
 
Iterator[list[T]] all_simple_paths (self, T producer, T consumer)
 
list[Tshortest_path (self, T producer, T consumer)
 
list[Tnode_list (self)
 
T get_node_with_id (self, int node_id)
 

Public Attributes

 name
 
 operational_array
 
 memory_level_id
 
 nb_levels
 

Detailed Description

Class that represents a memory hierarchy as a directed networkx graph.

The memory hierarchy graph is directed, with the root nodes representing the lowest level in the memory hierarchy.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
OperationalArrayABC  operational_array,
str   name = "Memory Hierarchy",
**Any  attr 
)

Initialize the memory hierarchy graph.

The initialization sets the operational array this memory hierarchy will connect to. The graph nodes are the given nodes. The edges are extracted from the operands the memory levels store.

Parameters
nodesa list of MemoryLevels. Entries need to be provided from lowest to highest memory level.

Member Function Documentation

◆ __eq__()

bool __eq__ (   self,
object  other 
)

◆ __jsonrepr__()

def __jsonrepr__ (   self)

JSON Representation of this object to save it to a json file.

Here is the call graph for this function:

◆ add_memory()

None add_memory (   self,
MemoryInstance  memory_instance,
list[MemoryOperand operands,
PortAllocation  port_alloc,
ServedMemDimensions  served_dimensions 
)

Adds a memory to the memory hierarchy graph.

NOTE: memory level need to be added from bottom level (e.g., Reg) to top level (e.g., DRAM) for each operand !!!

Internally a MemoryLevel object is built, which represents the memory node.

Edges are added from all sink nodes in the graph to this node if the memory operands match

Parameters
memory_instanceThe MemoryInstance containing the different memory characteristics.
operandsThe memory operands the memory level stores.
served_dimensionsThe operational array dimensions this memory level serves. Default: no served dimensions -> unroll over
Here is the call graph for this function:

◆ get_inner_memories()

list[MemoryLevel] get_inner_memories (   self)

Returns the inner-most memory levels for all memory operands.

Here is the call graph for this function:

◆ get_memory_levels()

list[MemoryLevel] get_memory_levels (   self,
MemoryOperand  mem_op 
)

Returns a list of memories in the memory hierarchy for the memory operand.

The first entry in the returned list is the innermost memory level.

Here is the call graph for this function:

◆ get_operand_top_level()

MemoryLevel get_operand_top_level (   self,
MemoryOperand  operand 
)

Finds the highest level of memory that have the given operand assigned to, and returns the MemoryLevel.

◆ get_operands()

set[MemoryOperand] get_operands (   self)

Returns all the memory operands this memory hierarchy graph contains as a set.

◆ get_operator_top_level()

tuple[list[MemoryLevel], int] get_operator_top_level (   self,
MemoryOperand  operand 
)

Finds the highest level of memories that have the given operand assigned to it, and returns the MemoryLevel instance on this level that have the operand assigned to it.

'The' level of a MemoryLevel is considered to be the largest level it has across its assigned operands.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_outer_memories()

list[MemoryLevel] get_outer_memories (   self)

Returns the outer-most memory levels for all memory operands.

Here is the call graph for this function:

◆ get_top_memories()

tuple[list[MemoryLevel], int] get_top_memories (   self)

Returns the 'top'-most MemoryLevels, where 'the' level of MemoryLevel is considered to be the largest level it has across its assigned operands.

Returns
(list_of_memories_on_top_level, top_level)
Here is the call graph for this function:

◆ has_same_performance()

def has_same_performance (   self,
"MemoryHierarchy"  other 
)
Here is the call graph for this function:

Member Data Documentation

◆ memory_level_id

memory_level_id

◆ name

name

◆ nb_levels

nb_levels

◆ operational_array

operational_array

The documentation for this class was generated from the following file: