コード例 #1
0
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)
コード例 #2
0
ファイル: test_compile.py プロジェクト: ziqingzeng/public
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)
コード例 #3
0
ファイル: tablasim.py プロジェクト: ziqingzeng/public
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)
コード例 #4
0
ファイル: test_instr_gen.py プロジェクト: ziqingzeng/public
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)
コード例 #5
0
ファイル: test_instr_gen.py プロジェクト: ziqingzeng/public
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)
コード例 #6
0
ファイル: test_instr_gen.py プロジェクト: ziqingzeng/public
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)
コード例 #7
0
ファイル: test_instr_gen.py プロジェクト: ziqingzeng/public
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)