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

Class that stores inputs and runs them through the zigzag cost model. More...

Inheritance diagram for CostModelEvaluationForIMC:
Collaboration diagram for CostModelEvaluationForIMC:

Public Member Functions

def __init__ (self, Accelerator accelerator, LayerNode layer, SpatialMappingInternal spatial_mapping, SpatialMappingInternal spatial_mapping_int, TemporalMapping temporal_mapping, bool access_same_data_considered_as_no_access=True)
 
None run (self)
 Run the cost model evaluation. More...
 
def collect_area_data (self)
 
def calc_mac_energy_cost (self)
 Calculate the dynamic MAC energy Overrides superclass' method. More...
 
def calc_latency (self)
 The latency calculation is largely identical to that of the superclass, but with some modifications to fit the IMC requirement. More...
 
def update_tclk (self)
 This function calculate the Tclk for IMC (In-Memory-Computing) More...
 
def __jsonrepr__ (self)
 JSON representation used for saving this object to a json file. More...
 
def __simplejsonrepr__ (self)
 Simple JSON representation used for saving this object to a simple json file. More...
 
- Public Member Functions inherited from CostModelEvaluation
def __init__ (self, *Accelerator accelerator, LayerNode layer, SpatialMappingInternal spatial_mapping, SpatialMappingInternal spatial_mapping_int, TemporalMapping temporal_mapping, bool access_same_data_considered_as_no_access=True, float cycles_per_op=1.0)
 After initialization, the cost model evaluation is run. More...
 
None calc_memory_utilization (self)
 
None calc_memory_word_access (self)
 
None calc_energy (self)
 Calculates the energy cost of this cost model evaluation by calculating the memory reading/writing energy. More...
 
def calc_memory_energy_cost (self)
 Computes the memories reading/writing energy by converting the access patterns in self.mapping to energy breakdown using the memory hierarchy of the core on which the layer is mapped. More...
 
None calc_double_buffer_flag (self)
 This function checks the double-buffer possibility for each operand at each memory level (minimal memory BW requirement case) by comparing the physical memory size with the effective data size, taking into account the memory sharing between operands. More...
 
def calc_allowed_and_real_data_transfer_cycle_per_data_transfer_link (self)
 Construct a 4-way data transfer pattern for each unit mem, calculate {allowed_mem_updating_cycle, real_data_trans_cycle, DTL_SS_cycle} per period. More...
 
MemoryAccesses calculate_real_data_transfer_cycles (self, LayerOperand layer_op, MemoryOperand mem_op, int mem_lvl_id)
 
MemoryAccesses calculate_allowed_transfer_cycles (self, LayerOperand layer_op, int mem_lv)
 
None combine_data_transfer_rate_per_physical_port (self)
 Consider memory sharing and port sharing, combine the data transfer activity Step 1: collect port activity per memory instance per physical memory port Step 2: calculate SS combine and MUW union parameters per physical memory port. More...
 
list[PortBeginOrEndActivitycalc_loading_single_port_period_count_1 (self, MemoryPort port, list[tuple[MemoryOperand, int, DataDirection]] mem_op_level_direction_combs, float total_req_bw_aver_computation)
 Calculate the loading activities for the memory port movement directions with period count of 1. More...
 
list[PortBeginOrEndActivitycalc_loading_single_port_period_count_greater_than_1 (self, MemoryPort port, list[tuple[MemoryOperand, int, DataDirection]] mem_op_level_direction_combs)
 Calculate the loading and offloading activities with mem port movement directions period > 1. More...
 
def calc_loading_single_port (self, MemoryPort port)
 Calculate the loading and offloading activities for a single memory port. More...
 
def calc_onloading_combined (self)
 
def calc_offloading_combined (self)
 
tuple[float, float] calc_borrowed_loading_cycles_and_bandwidth (self)
 Calculate the amount of cycles and bandwidth that are borrowed from the computation phase. More...
 
def calc_data_loading_latency (self)
 Calculate the number of data onloading/offloading cycles. More...
 
None calc_overall_latency (self)
 This function integrates the previous calculated SScomb, data loading and off-loading cycle to get the overall latency. More...
 
FourWayDataMoving[int] get_inst_bandwidth (self, MemoryLevel memory_level, MemoryOperand memory_operand, float scaling=1)
 Given a memory level and a memory operand, compute the memory's instantaneous bandwidth required for the memory operand during computation. More...
 
FourWayDataMoving[int] get_total_inst_bandwidth (self, MemoryLevel memory_level, float scaling=1)
 Given a cost model evaluation and a memory level, compute the memory's total instantaneous bandwidth required throughout the execution of the layer that corresponds to this CME. More...
 
def __str__ (self)
 
def __repr__ (self)
 
- Public Member Functions inherited from CostModelEvaluationABC
None __init__ (self)
 
def core (self)
 
"CumulativeCME" __add__ (self, "CostModelEvaluationABC" other)
 
def __mul__ (self, int number)
 

Public Attributes

 is_imc
 
 imc_area_breakdown
 
 imc_area
 
 mem_area
 
 area_total
 
 mac_energy_breakdown
 
 mac_energy
 
 tclk
 
 tclk_breakdown
 
- Public Attributes inherited from CostModelEvaluation
 accelerator
 
 spatial_mapping
 
 spatial_mapping_int
 
 temporal_mapping
 
 access_same_data_considered_as_no_access
 
 mem_level_list
 
 mem_hierarchy_dict
 
 mem_size_dict
 
 mem_sharing_tuple
 
 memory_operand_links
 
 spatial_mapping_dict_int
 
 mapping
 
 mapping_int
 
 active_mem_level
 
 cycles_per_op
 
 mem_utili_individual
 
 mem_utili_shared
 
 effective_mem_utili_individual
 
 effective_mem_utili_shared
 
 memory_word_access
 
 mac_energy
 
 mem_energy_breakdown
 
 mem_energy_breakdown_further
 
 mem_energy
 
 double_buffer_true
 
 allowed_mem_update_cycle
 
 real_data_trans_cycle
 
 port_activity_collect
 
 mem_updating_window_union_collect
 
 stall_slack_comb_collect
 
 stall_slack_comb
 
 data_loading_cc_pair_combined_per_op
 
 data_loading_individual_part
 
 data_loading_half_shared_part
 
 data_loading_shared_part
 
 data_offloading_cc_pair_combined
 
 data_onloading_cycle
 
 data_offloading_cycle
 
 loading_offloading_cycles_borrowed_from_computation
 
 loading_offloading_bandwidth_borrowed_from_computation
 
 ideal_cycle
 
 ideal_temporal_cycle
 
 mac_spatial_utilization
 
 latency_total0
 
 latency_total1
 
 latency_total2
 
 mac_utilization0
 
 mac_utilization1
 
 mac_utilization2
 

Additional Inherited Members

- Static Public Member Functions inherited from CostModelEvaluation
tuple[list[float], list[float]] reduce_balanced (list[float] c_list, list[float] m_list, float s)
 Balance c_list towards minimums m_list with a total maximum reduction of s. More...
 

Detailed Description

Class that stores inputs and runs them through the zigzag cost model.

Initialize the cost model evaluation with the following inputs:

  • accelerator: the accelerator that includes the core on which to run the layer
  • layer: the layer to run
  • spatial_mapping: the spatial mapping
  • temporal_mapping: the temporal mapping

From these parameters, the following attributes are computed:

  • core: The core on which the layer is ran. This should be specified in the LayerNode attributes.
  • mapping: The combined spatial and temporal mapping object where access patterns are computed.

The following cost model attributes are also initialized:

  • mem_energy_breakdown: The energy breakdown for all operands
  • energy: The total energy

After initialization, the cost model evaluation is run.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
Accelerator  accelerator,
LayerNode  layer,
SpatialMappingInternal  spatial_mapping,
SpatialMappingInternal  spatial_mapping_int,
TemporalMapping  temporal_mapping,
bool   access_same_data_considered_as_no_access = True 
)

Member Function Documentation

◆ __jsonrepr__()

def __jsonrepr__ (   self)

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

Reimplemented from CostModelEvaluationABC.

Here is the call graph for this function:

◆ __simplejsonrepr__()

def __simplejsonrepr__ (   self)

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

Reimplemented from CostModelEvaluationABC.

◆ calc_latency()

def calc_latency (   self)

The latency calculation is largely identical to that of the superclass, but with some modifications to fit the IMC requirement.

Reimplemented from CostModelEvaluation.

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

◆ calc_mac_energy_cost()

def calc_mac_energy_cost (   self)

Calculate the dynamic MAC energy Overrides superclass' method.

Reimplemented from CostModelEvaluation.

Here is the caller graph for this function:

◆ collect_area_data()

def collect_area_data (   self)
Here is the caller graph for this function:

◆ run()

None run (   self)

Run the cost model evaluation.

Reimplemented from CostModelEvaluation.

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

◆ update_tclk()

def update_tclk (   self)

This function calculate the Tclk for IMC (In-Memory-Computing)

Here is the caller graph for this function:

Member Data Documentation

◆ area_total

area_total

◆ imc_area

imc_area

◆ imc_area_breakdown

imc_area_breakdown

◆ is_imc

is_imc

◆ mac_energy

mac_energy

◆ mac_energy_breakdown

mac_energy_breakdown

◆ mem_area

mem_area

◆ tclk

tclk

◆ tclk_breakdown

tclk_breakdown

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