Exemple #1
0
     release_platform_name = vitis_platform
 else:
     vitis_platform = None
     # for Zynq, use the board name as the release name
     # e.g. ZCU104
     release_platform_name = platform_name
 platform_dir = "release/%s" % release_platform_name
 os.makedirs(platform_dir, exist_ok=True)
 for model_name in models:
     # set up the build configuration for this model
     cfg = build_cfg.DataflowBuildConfig(
         output_dir="output_%s_%s" % (model_name, release_platform_name),
         folding_config_file="folding_config/%s_folding_config.json" %
         model_name,
         synth_clk_period_ns=10.0,
         board=platform_name,
         shell_flow_type=shell_flow_type,
         vitis_platform=vitis_platform,
         generate_outputs=[build_cfg.DataflowOutputType.BITFILE],
         save_intermediate_models=True,
     )
     model_file = "models/%s.onnx" % model_name
     # launch FINN compiler to build
     build.build_dataflow_cfg(model_file, cfg)
     # copy bitfiles into release dir if found
     bitfile_gen_dir = cfg.output_dir + "/bitfile"
     files_to_check_and_copy = [
         "finn-accel.bit",
         "finn-accel.hwh",
         "finn-accel.xclbin",
     ]
Exemple #2
0
    "step_hls_ipgen",
    "step_set_fifo_depths",
    "step_create_stitched_ip",
    "step_make_pynq_driver",
    "step_synthesize_bitfile",
    "step_deployment_package",
]


cfg = build_cfg.DataflowBuildConfig(
    steps=mobilenet_build_steps,
    output_dir="output_%s_%s" % (model_name, board),
    folding_config_file="folding_config/%s_folding_config.json" % board,
    synth_clk_period_ns=synth_clk_period_ns,
    board=board,
    shell_flow_type=build_cfg.ShellFlowType.VITIS_ALVEO,
    # folding config comes with FIFO depths already
    auto_fifo_depths=False,
    vitis_platform=vitis_platform,
    # enable extra performance optimizations (physopt)
    vitis_opt_strategy=build_cfg.VitisOptStrategyCfg.PERFORMANCE_BEST,
    generate_outputs=[
        build_cfg.DataflowOutputType.PYNQ_DRIVER,
        build_cfg.DataflowOutputType.ESTIMATE_REPORTS,
        build_cfg.DataflowOutputType.BITFILE,
        build_cfg.DataflowOutputType.DEPLOYMENT_PACKAGE,
    ],
)
model_file = "models/%s_pre_post_tidy.onnx" % model_name
build.build_dataflow_cfg(model_file, cfg)
Exemple #3
0
    print("DoublePackedConv detected")
except:
    warn(
        " FINN Experimental not available. Using non-packed folded down convolution. This is 16 times slower per MHz "
    )
    folding_config_file = "folding_config/U250_folding_config_no_doublepack_pe_folded_16.json"

cfg = build_cfg.DataflowBuildConfig(
    steps=resnet50_build_steps,
    output_dir="output_%s_%s" % (model_name, board),
    synth_clk_period_ns=synth_clk_period_ns,
    board=board,
    shell_flow_type=build_cfg.ShellFlowType.VITIS_ALVEO,
    vitis_platform=vitis_platform,
    # throughput parameters (auto-folding)
    mvau_wwidth_max=24,
    target_fps=target_fps,
    folding_config_file=folding_config_file,
    # enable extra performance optimizations (physopt)
    vitis_opt_strategy=build_cfg.VitisOptStrategyCfg.PERFORMANCE_BEST,
    generate_outputs=[
        build_cfg.DataflowOutputType.PYNQ_DRIVER,
        build_cfg.DataflowOutputType.ESTIMATE_REPORTS,
        build_cfg.DataflowOutputType.BITFILE,
        build_cfg.DataflowOutputType.DEPLOYMENT_PACKAGE,
    ],
)

model_file = "models/%s_exported.onnx" % model_name
build.build_dataflow_cfg(model_file, cfg)
Exemple #4
0
model = ModelWrapper(model_file)
model.model.opset_import[0].version = 11
model_file = model_file.replace(".onnx", "_opset-11.onnx")
model.save(model_file)

platform_name = "Pynq-Z1"
output_dir = f"{time.time():.2f}_output_{model_name.replace('/','_')}_{platform_name}"

# Configure build
cfg = build_cfg.DataflowBuildConfig(
    # steps=estimate_steps, generate_outputs=estimate_outputs,
    verify_steps=verification_steps,
    steps=build_steps,
    generate_outputs=build_outputs,
    output_dir=output_dir,
    target_fps=200000,
    synth_clk_period_ns=10.0,
    board=platform_name,
    shell_flow_type=build_cfg.ShellFlowType.VIVADO_ZYNQ,
    save_intermediate_models=True,
    stitched_ip_gen_dcp=True,
    verify_save_full_context=True,
)
# Build the model
build.build_dataflow_cfg(model_file, cfg)

# Save Build config
config_json_path = f"{output_dir}/DataflowBuildConfig.json"
with open(config_json_path, "w") as f:
    f.write(cfg.to_json())
print(f"Saved DataflowBuildConfig to: {config_json_path}")
Exemple #5
0
        release_platform_name = platform_name
    platform_dir = "release/%s" % release_platform_name
    os.makedirs(platform_dir, exist_ok=True)

    cfg = build_cfg.DataflowBuildConfig(
        steps=select_build_steps(platform_name),
        output_dir="output_%s_%s" % (model_name, release_platform_name),
        synth_clk_period_ns=select_clk_period(platform_name),
        board=platform_name,
        shell_flow_type=shell_flow_type,
        vitis_platform=vitis_platform,
        folding_config_file="folding_config/%s_folding_config.json" %
        platform_name,
        auto_fifo_depths=True,
        standalone_thresholds=False,
        # enable extra performance optimizations (physopt)
        vitis_opt_strategy=build_cfg.VitisOptStrategyCfg.PERFORMANCE_BEST,
        generate_outputs=[
            build_cfg.DataflowOutputType.ESTIMATE_REPORTS,
            build_cfg.DataflowOutputType.STITCHED_IP,
            # build_cfg.DataflowOutputType.OOC_SYNTH,
            # build_cfg.DataflowOutputType.RTLSIM_PERFORMANCE,
            build_cfg.DataflowOutputType.BITFILE,
            build_cfg.DataflowOutputType.DEPLOYMENT_PACKAGE,
            build_cfg.DataflowOutputType.PYNQ_DRIVER,
        ],
    )
    model_file = "models/%s.onnx" % model_name
    build.build_dataflow_cfg(model_file, cfg)

    # copy bitfiles and runtime weights into release dir if found
Exemple #6
0
     # e.g. ZCU104
     release_platform_name = platform_name
 platform_dir = "release/%s" % release_platform_name
 os.makedirs(platform_dir, exist_ok=True)
 for model_name in models:
     # set up the build configuration for this model
     cfg = build_cfg.DataflowBuildConfig(
         output_dir="output_%s_%s" % (model_name, release_platform_name),
         synth_clk_period_ns=5.0,
         target_fps=10000000,
         board=platform_name,
         shell_flow_type=shell_flow_type,
         vitis_platform=vitis_platform,
         enable_build_pdb_debug=True,
         generate_outputs=[
             build_cfg.DataflowOutputType.ESTIMATE_REPORTS,
             build_cfg.DataflowOutputType.BITFILE,
             # build_cfg.DataflowOutputType.STITCHED_IP,
             # build_cfg.DataflowOutputType.RTLSIM_PERFORMANCE,
             # build_cfg.DataflowOutputType.OOC_SYNTH,
             build_cfg.DataflowOutputType.PYNQ_DRIVER,
             build_cfg.DataflowOutputType.DEPLOYMENT_PACKAGE,
         ],
         save_intermediate_models=True,
     )
     # cfg = build_cfg.DataflowBuildConfig(
     #     output_dir="output_%s_%s" % (model_name, release_platform_name),
     #     folding_config_file=None,
     #     synth_clk_period_ns=1.0,
     #     hls_clk_period_ns=1.0,
     #     target_fps=10000000,