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

Pipeline stage that converts the spatial mapping from a user-provided spatial mapping across operational array dimensions to the internal spatial mapping representation used in the cost model. More...

Inheritance diagram for SpatialMappingConversionStage:
Collaboration diagram for SpatialMappingConversionStage:

Public Member Functions

def __init__ (self, list[StageCallable] list_of_callables, *Accelerator accelerator, LayerNode layer, **Any kwargs)
 Initialize the accelerator and layer attributes. More...
 
def run (self)
 
tuple[SpatialMappingInternal, SpatialMappingInternalconvert_user_spatial_mapping (self, SpatialMapping user_spatial_mapping)
 Convert the SpatialMapping instance in user-defined format (spatial mapping across operational array dimensions) to the SpatialMappingInternal representation. More...
 
None|tuple[LayerDim, UnrollFactor] generate_limited_user_spatial_mapping (self, LayerDimSizes layer_dim_sizes, OADimension oa_dim, tuple[LayerDim, UnrollFactor] spatial_loop, SpatialMapping user_spatial_mapping, SpatialMapping limited_user_spatial_mapping, bool allow_decimal_sm_loop_size=True)
 
SpatialMappingPerMemLvl generate_mapping_per_mem_lvl (self, SpatialMapping user_spatial_mapping)
 This function is to convert spatial mapping to mapping_per_mem_lvl, which attaches spatial mapping to different memory levels. More...
 
def check_if_oa_dim_mapping_is_first_max (self, OADimension oa_dim, LayerDim loop_dim_unrolled, SpatialMapping user_spatial_mapping)
 For the case when there is layer dimension that is mapped on multiple oa dimensions. More...
 
UnrollFactor calc_unrolled_loop_size_on_early_oa_dims (self, OADimension oa_dim, LayerDim loop_dim_unrolled, SpatialMapping user_spatial_mapping)
 
- Public Member Functions inherited from Stage
def __init__ (self, list["StageCallable"] list_of_callables, **Any kwargs)
 
def __iter__ (self)
 
bool is_leaf (self)
 

Public Attributes

 layer
 
 accelerator
 
 memory_operand_links
 
 user_spatial_mapping
 
- Public Attributes inherited from Stage
 kwargs
 
 list_of_callables
 

Detailed Description

Pipeline stage that converts the spatial mapping from a user-provided spatial mapping across operational array dimensions to the internal spatial mapping representation used in the cost model.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
list[StageCallable list_of_callables,
*Accelerator  accelerator,
LayerNode  layer,
**Any  kwargs 
)

Initialize the accelerator and layer attributes.

Member Function Documentation

◆ calc_unrolled_loop_size_on_early_oa_dims()

UnrollFactor calc_unrolled_loop_size_on_early_oa_dims (   self,
OADimension  oa_dim,
LayerDim  loop_dim_unrolled,
SpatialMapping  user_spatial_mapping 
)
Here is the caller graph for this function:

◆ check_if_oa_dim_mapping_is_first_max()

def check_if_oa_dim_mapping_is_first_max (   self,
OADimension  oa_dim,
LayerDim  loop_dim_unrolled,
SpatialMapping  user_spatial_mapping 
)

For the case when there is layer dimension that is mapped on multiple oa dimensions.

We need to decide on which oa dimension to adjust the unrolling if the total unrolling size is not a multiple of the layer dimension size. In this case, we decide to only adjust the unrolling size of the first oa dimension with the largest unrolling. This function is to check if the given oa_dim has the largest unrolling for the given loop_dim_unrolled.

Here is the caller graph for this function:

◆ convert_user_spatial_mapping()

tuple[SpatialMappingInternal, SpatialMappingInternal] convert_user_spatial_mapping (   self,
SpatialMapping   user_spatial_mapping 
)

Convert the SpatialMapping instance in user-defined format (spatial mapping across operational array dimensions) to the SpatialMappingInternal representation.

For this conversion we need to know:

  • the user defined spatial mapping
  • the core (i.e. operational array) on which the unrolling happens,and the memory hierarchy that is connected to that operational array.
    Parameters
    user_spatial_mappingThe SpatialMapping in user-defined format to be converted.
    Returns
    : A SpatialMappingInternal object with the converted spatial mapping.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_limited_user_spatial_mapping()

None | tuple[LayerDim, UnrollFactor] generate_limited_user_spatial_mapping (   self,
LayerDimSizes  layer_dim_sizes,
OADimension  oa_dim,
tuple[LayerDim, UnrollFactor]  spatial_loop,
SpatialMapping  user_spatial_mapping,
SpatialMapping  limited_user_spatial_mapping,
bool   allow_decimal_sm_loop_size = True 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_mapping_per_mem_lvl()

SpatialMappingPerMemLvl generate_mapping_per_mem_lvl (   self,
SpatialMapping  user_spatial_mapping 
)

This function is to convert spatial mapping to mapping_per_mem_lvl, which attaches spatial mapping to different memory levels.

TODO This should be a class

Here is the caller graph for this function:

◆ run()

def run (   self)

Reimplemented from Stage.

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

Member Data Documentation

◆ accelerator

accelerator

◆ layer

layer

◆ memory_operand_links

memory_operand_links

◆ user_spatial_mapping

user_spatial_mapping

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