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.
LayerNode Class Reference

Represents a single layer in a workload. More...

Inheritance diagram for LayerNode:
Collaboration diagram for LayerNode:

Public Member Functions

def __init__ (self, int layer_id, str node_name, LayerNodeAttributes node_attr, MappingAttributes mapping_attr)
 To construct each layer node, algorithm equation/dimension/indirect relation are parsed. More...
 
LayerOperand get_act_layer_op (self)
 Return the I LayerOperand: either the non-constant operand or one of the input operands if none are constant. More...
 
LayerOperand get_weight_layer_op (self)
 Return the W LayerOperand: either the constant operand or one of the input operands if none are constant. More...
 
tuple[PrLoop, LoopList, PrScalingFactors] build_pr_funcs (self)
 
def __str__ (self)
 
def __jsonrepr__ (self)
 JSON representation used for saving this object to a json file. More...
 
float calc_tensor_size (self, LayerOperand layer_op, LayerDimSizes layer_dim_sizes)
 Calculates the tensor size (nb of elements) for the given operand layer_op with the given loop dimension sizes layer_dim_sizes. More...
 
def calc_tensor_dim (self, LayerDim dim, LayerDimSizes layer_dim_sizes)
 
dict[LayerDim, UnrollFactor] calc_tensor_dims (self, LayerOperand layer_op, LayerDimSizes layer_dim_sizes)
 
int calc_pr_dimension_size_total (self, LayerDim dim)
 Compute the total pr dimension size of this node, taking padding into account. More...
 
def extract_layer_info (self)
 This function extract basic information for each layer node. More...
 
list[LayerDimget_operand_irrelevant_layer_dims (self, LayerOperand layer_op)
 Return the irrelevant dimensions of layer operand 'layer_op'. More...
 
LayerNodeAttributes extract_node_attr (self)
 Pack this layer node's attributes in a LayerNodeAttributes instance. More...
 
MappingAttributes extract_mapping_attr (self)
 
- Public Member Functions inherited from LayerNodeABC
def __init__ (self, int node_id, str node_name)
 
str __repr__ (self)
 

Static Public Member Functions

def calc_pr_dimension_size (int sa, int a, int sb, int b)
 Calculates the number of unique indices c generated by iterating through the indices a in range(0,A,1) and b in range(0,B,1) according to the equation c = sa * a + sb * b. More...
 

Public Attributes

 type
 
 equation
 
 layer_dim_sizes
 
 operand_precision
 
 dimension_relations
 
 padding
 
 constant_operands
 
 input_operand_source
 
 spatial_mapping
 
 spatial_mapping_hint
 
 memory_operand_links
 
 temporal_ordering
 
 layer_operands
 
 output_operand
 
 input_operands
 
 layer_dims
 
 pr_scaling_factors
 
 pr_layer_dim_sizes
 
 loop_relevancy_info
 
 pr_decoupled_relevancy_info
 
 total_mac_count
 
 operand_size_bit
 
 operand_data_reuse
 
- Public Attributes inherited from LayerNodeABC
 id
 
 name
 

Detailed Description

Represents a single layer in a workload.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
int  layer_id,
str  node_name,
LayerNodeAttributes  node_attr,
MappingAttributes  mapping_attr 
)

To construct each layer node, algorithm equation/dimension/indirect relation are parsed.

This parser collects information of operand, loop dimension, and loop relevance. Equal-to-1 loop dimensions are eliminated.

Parameters
layer_idThe identifier (key) of the layer, as defined in the workload
node_namean optional name for the Node. E.g. the node's name from the onnx model.

Member Function Documentation

◆ __jsonrepr__()

def __jsonrepr__ (   self)

JSON representation used for saving this object to a json file.

Reimplemented from LayerNodeABC.

Here is the call graph for this function:

◆ __str__()

def __str__ (   self)

Reimplemented from LayerNodeABC.

Here is the call graph for this function:

◆ build_pr_funcs()

tuple[PrLoop, LoopList, PrScalingFactors] build_pr_funcs (   self)

TODO requires documentation

◆ calc_pr_dimension_size()

def calc_pr_dimension_size ( int  sa,
int  a,
int  sb,
int  b 
)
static

Calculates the number of unique indices c generated by iterating through the indices a in range(0,A,1) and b in range(0,B,1) according to the equation c = sa * a + sb * b.

sa and sb thus represent the scaling of a, resp. b.

Here is the caller graph for this function:

◆ calc_pr_dimension_size_total()

int calc_pr_dimension_size_total (   self,
LayerDim  dim 
)

Compute the total pr dimension size of this node, taking padding into account.

Parameters
dim(str): The partially relevant dimension, e.g. 'IX'.
Returns
int: The total partially relevant dimension size
Here is the call graph for this function:

◆ calc_tensor_dim()

def calc_tensor_dim (   self,
LayerDim  dim,
LayerDimSizes  layer_dim_sizes 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_tensor_dims()

dict[LayerDim, UnrollFactor] calc_tensor_dims (   self,
LayerOperand  layer_op,
LayerDimSizes  layer_dim_sizes 
)

TODO requires documentation

Here is the call graph for this function:

◆ calc_tensor_size()

float calc_tensor_size (   self,
LayerOperand  layer_op,
LayerDimSizes  layer_dim_sizes 
)

Calculates the tensor size (nb of elements) for the given operand layer_op with the given loop dimension sizes layer_dim_sizes.

Here is the call graph for this function:

◆ extract_layer_info()

def extract_layer_info (   self)

This function extract basic information for each layer node.

◆ extract_mapping_attr()

MappingAttributes extract_mapping_attr (   self)

◆ extract_node_attr()

LayerNodeAttributes extract_node_attr (   self)

Pack this layer node's attributes in a LayerNodeAttributes instance.

Useful for instantiating new layer nodes (used in Stream)

◆ get_act_layer_op()

LayerOperand get_act_layer_op (   self)

Return the I LayerOperand: either the non-constant operand or one of the input operands if none are constant.

Here is the caller graph for this function:

◆ get_operand_irrelevant_layer_dims()

list[LayerDim] get_operand_irrelevant_layer_dims (   self,
LayerOperand  layer_op 
)

Return the irrelevant dimensions of layer operand 'layer_op'.

◆ get_weight_layer_op()

LayerOperand get_weight_layer_op (   self)

Return the W LayerOperand: either the constant operand or one of the input operands if none are constant.

Here is the call graph for this function:

Member Data Documentation

◆ constant_operands

constant_operands

◆ dimension_relations

dimension_relations

◆ equation

equation

◆ input_operand_source

input_operand_source

◆ input_operands

input_operands

◆ layer_dim_sizes

layer_dim_sizes

◆ layer_dims

layer_dims

◆ layer_operands

layer_operands

◆ loop_relevancy_info

loop_relevancy_info

◆ memory_operand_links

memory_operand_links

◆ operand_data_reuse

operand_data_reuse

◆ operand_precision

operand_precision

◆ operand_size_bit

operand_size_bit

◆ output_operand

output_operand

◆ padding

padding

◆ pr_decoupled_relevancy_info

pr_decoupled_relevancy_info

◆ pr_layer_dim_sizes

pr_layer_dim_sizes

◆ pr_scaling_factors

pr_scaling_factors

◆ spatial_mapping

spatial_mapping

◆ spatial_mapping_hint

spatial_mapping_hint

◆ temporal_ordering

temporal_ordering

◆ total_mac_count

total_mac_count

◆ type

type

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