def test_memory_instruction_generator(): Component.reset_ids() cwd = Path(f"{__file__}").parent # base_path = f"{cwd}/../benchmarks/dfgs/tabla_generated" base_path = f"{cwd}/test_dfgs" # dfg_name = "linear_784.json" dfg_name = "pm_linear3.json" file_path = f"{base_path}/{dfg_name}" with open("config.json") as config_file: data = json.load(config_file) new_arch = TablaTemplate(data) test_sched = Schedule() test_sched.load_dfg(file_path) new_arch = test_sched.schedule_graph(new_arch) data = [ edge for edge in test_sched._dfg_edges if edge.is_src_edge and edge.dtype == "input" ] n_axi = 4 n_lanes = 16 pes_per_lane = 4 meminst_gen = MemoryInstructionGenerator(data, n_axi, n_lanes, pes_per_lane, new_arch) meminst_gen.gen_inst(base_path) meminst_gen.gen_binary(base_path)
def test_depth_order(): Component.reset_ids() base_path = Path(f"{__file__}").parent package_name = "linear54" dfg_file = f"{package_name}.json" dfg_file_path = f"{base_path}/../{dfg_file}" sched = Schedule() sched.load_dfg(dfg_file_path, sort_type="custom") check_graph_order(sched)
def main(args): with open(args.config_file) as config_file: config = json.load(config_file) # Sorting algorithm used internally in scheduler sort_alg = "custom" # Instantiate an architecture for scheduling arch_scheduled = TablaTemplate(config) sched = Schedule() sched.load_dfg(args.dfg_file, sort_type=sort_alg) arch_scheduled = sched.schedule_graph(arch_scheduled) # Second architecture is instantiated by simulator simulator = TablaSim(arch_scheduled, config, sched, args.interactive_mode) simulator.run(args.weight_file, args.input_data_file, args.meta_file)
def test_linear_dfg(): Component.reset_ids() cwd = Path(f"{__file__}").parent base_path = f"{cwd}/test_dfgs" dfg_name = "linear_dfg.json" file_path = f"{base_path}/{dfg_name}" with open(f'{cwd}/config.json') as config_file: data = json.load(config_file) new_arch = TablaTemplate(data) test_sched = Schedule() test_sched.load_dfg(file_path) test_sched.schedule_graph(new_arch) validate_instructions(new_arch)
def test_class(): Component.reset_ids() base_path = "./test_dfgs" package_name = "class_dfg" dfg_name = f"{package_name}.json" file_path = f"{base_path}/{dfg_name}" with open('config.json') as config_file: data = json.load(config_file) new_arch = TablaTemplate(data) test_sched = Schedule() test_sched.load_dfg(file_path) test_sched.schedule_graph(new_arch) validate_instructions(new_arch) generate_pe_instructions(test_sched, new_arch, package_name)
def test_benchmark_logistic(): Component.reset_ids() package_name = "pm_linear55" cwd = Path(f"{__file__}").parent # base_path = f"{cwd}/../benchmarks/dfgs/tabla_generated" base_path = f"{cwd}/test_dfgs" # dfg_name = "linear_784.json" dfg_name = f"{package_name}.json" file_path = f"{base_path}/{dfg_name}" with open(f'{cwd}/config.json') as config_file: data = json.load(config_file) new_arch = TablaTemplate(data) test_sched = Schedule(optimize=True) test_sched.load_dfg(file_path) test_sched.schedule_graph(new_arch) test_sched.print_schedule_graph(f"{cwd}/test_outputs/schedule_{dfg_name}") # pprint.pprint(new_arch.namespace_utilization()) generate_pe_instructions(test_sched, new_arch, package_name)
def test_reco(): Component.reset_ids() cwd = Path(f"{__file__}").parent base_path = f"{cwd}/test_dfgs" package_name = "reco_dfg" dfg_name = f"{package_name}.json" file_path = f"{base_path}/{dfg_name}" with open(f'{cwd}/config.json') as config_file: data = json.load(config_file) new_arch = TablaTemplate(data) test_sched = Schedule(optimize=False) test_sched.load_dfg(file_path) test_sched.schedule_graph(new_arch) validate_instructions(new_arch) generate_pe_instructions(test_sched, new_arch, package_name)