def set_params(self, config_obj=cfg(), ifmap_op_mat=np.zeros((1, 1)), ofmap_op_mat=np.zeros((1, 1)), filter_op_mat=np.zeros((1, 1))): self.config = config_obj self.ifmap_op_mat = ifmap_op_mat self.filter_op_mat = filter_op_mat self.ofmap_op_mat = ofmap_op_mat ifmap_col = self.ifmap_op_mat.shape[1] filter_row = self.filter_op_mat.shape[0] assert ifmap_col == filter_row, "Dimension mismatch between operands" self.ifmap_op_mat_trans = np.transpose(self.ifmap_op_mat) self.Sr = self.ifmap_op_mat.shape[0] self.Sc = self.filter_op_mat.shape[1] self.T = self.ifmap_op_mat.shape[1] self.arr_row, self.arr_col = self.config.get_array_dims() self.row_fold = math.ceil(self.Sr / self.arr_row) self.col_fold = math.ceil(self.Sc / self.arr_col) self.params_set_flag = True
def __init__(self): # Objects from outer container classes self.config = cfg() self.topoutil = topoutil() # Layer hyper parameters self.layer_id = 0 self.ifmap_rows, self.ifmap_cols = 1, 1 self.filter_rows, self.filter_cols = 1, 1 self.num_input_channels, self.num_filters = 1, 1 self.row_stride, self.col_stride = 1, 1 self.batch_size = 1 # Derived hyper parameters self.ofmap_px_per_filt, self.conv_window_size = 1, 1 self.ofmap_rows, self.ofmap_cols = 1, 1 # Offsets self.ifmap_offset, self.filter_offset, self.ofmap_offset = 0, 10000000, 20000000 self.matrix_offset_arr = [0, 10000000, 20000000] # Address matrices self.ifmap_addr_matrix = np.ones( (self.ofmap_px_per_filt, self.conv_window_size), dtype=np.int) self.filter_addr_matrix = np.ones( (self.conv_window_size, self.num_filters), dtype=np.int) self.ofmap_addr_matrix = np.ones( (self.ofmap_px_per_filt, self.num_filters), dtype=np.int) # Flags self.params_set_flag = False self.matrices_ready_flag = False
def set_params(self, layer_id=0, config_obj=cfg(), topology_obj=topo(), verbose=True): self.layer_id = layer_id self.config = config_obj self.topo = topology_obj self.op_mat_obj.set_params(layer_id=self.layer_id, config_obj=self.config, topoutil_obj=self.topo, ) self.dataflow = self.config.get_dataflow() if self.dataflow == 'os': self.compute_system = systolic_compute_os() elif self.dataflow == 'ws': self.compute_system = systolic_compute_ws() elif self.dataflow == 'is': self.compute_system = systolic_compute_is() arr_dims =self.config.get_array_dims() self.num_mac_unit = arr_dims[0] * arr_dims[1] self.verbose=verbose self.params_set_flag = True
def __init__(self): self.layer_id = 0 self.topo = topo() self.config = cfg() self.op_mat_obj = opmat() self.compute_system = systolic_compute_os() #self.memory_system = mem_dbsp() self.memory_system = tut2mem() self.verbose = True # Report items : Compute report self.total_cycles = 0 self.stall_cycles = 0 self.num_compute = 0 self.num_mac_unit = 0 self.overall_util = 0 self.mapping_eff = 0 self.compute_util = 0 # Report items : BW report self.avg_ifmap_sram_bw = 0 self.avg_filter_sram_bw = 0 self.avg_ofmap_sram_bw = 0 self.avg_ifmap_dram_bw = 0 self.avg_filter_dram_bw = 0 self.avg_ofmap_dram_bw = 0 # Report items : Detailed Access report self.ifmap_sram_start_cycle = 0 self.ifmap_sram_stop_cycle = 0 self.ifmap_sram_reads = 0 self.filter_sram_start_cycle = 0 self.filter_sram_stop_cycle = 0 self.filter_sram_reads = 0 self.ofmap_sram_start_cycle = 0 self.ofmap_sram_stop_cycle = 0 self.ofmap_sram_writes = 0 self.ifmap_dram_start_cycle = 0 self.ifmap_dram_stop_cycle = 0 self.ifmap_dram_reads = 0 self.filter_dram_start_cycle = 0 self.filter_dram_stop_cycle = 0 self.filter_dram_reads = 0 self.ofmap_dram_start_cycle = 0 self.ofmap_dram_stop_cycle = 0 self.ofmap_dram_writes = 0 self.params_set_flag = False self.memory_system_ready_flag = False self.runs_ready = False self.report_items_ready = False
def __init__(self): self.conf = cfg() self.topo = topo() self.top_path = "./" self.verbose = True self.save_trace = True self.num_layers = 0 self.single_layer_sim_object_list = [] self.params_set_flag = False self.all_layer_run_done = False
def set_params(self, config_obj=cfg(), topo_obj=topo(), top_path="./", verbosity=True, save_trace=True): self.conf = config_obj self.topo = topo_obj self.top_path = top_path self.verbose = verbosity self.save_trace = save_trace # Calculate inferrable parameters here self.num_layers = self.topo.get_num_layers() self.params_set_flag = True
def __init__(self): # Params set by user self.config = cfg() self.ifmap_op_mat = np.zeros((1, 1)) self.ofmap_op_mat = np.zeros((1, 1)) self.filter_op_mat = np.zeros((1, 1)) # Derived parameters self.Sr = 0 self.Sc = 0 self.T = 0 self.arr_row = 0 self.arr_col = 0 self.row_fold = 1 self.col_fold = 1 # Generated matrices self.ifmap_op_mat_trans = np.zeros((1, 1)) self.ifmap_prefetch_matrix = np.zeros((1, 1)) self.filter_prefetch_matrix = np.zeros((1, 1)) self.ifmap_demand_matrix = np.zeros((1, 1)) self.ofmap_demand_matrix = np.zeros((1, 1)) self.filter_demand_matrix = np.zeros((1, 1)) # Generated metrics self.ifmap_reads = 0 self.filter_reads = 0 self.ofmap_writes = 0 self.mapping_efficiency_per_fold = [] self.compute_utility_per_fold = [] # Flags self.params_set_flag = False self.prefetch_mat_ready_flag = False self.demand_mat_ready_flag = False