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.
|
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...
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, 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. 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) |
![]() | |
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 | |
![]() | |
kwargs | |
list_of_callables | |
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.
def __init__ | ( | self, | |
list[StageCallable] | list_of_callables, | ||
*Accelerator | accelerator, | ||
LayerNode | layer, | ||
**Any | kwargs | ||
) |
Initialize the accelerator and layer attributes.
UnrollFactor calc_unrolled_loop_size_on_early_oa_dims | ( | self, | |
OADimension | oa_dim, | ||
LayerDim | loop_dim_unrolled, | ||
SpatialMapping | user_spatial_mapping | ||
) |
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.
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:
user_spatial_mapping | The SpatialMapping in user-defined format to be converted. |
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.
def run | ( | self | ) |
Reimplemented from Stage.
accelerator |
layer |
memory_operand_links |
user_spatial_mapping |