Skip to content

Commit 3a84a57

Browse files
committed
Change log level
1 parent 9710dff commit 3a84a57

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

src/finn/benchmarking/bench_base.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import shutil
55
import subprocess
6+
import yaml
67
from shutil import copy as shcopy
78
from shutil import copytree
89

@@ -18,8 +19,6 @@
1819
from finn.builder.build_dataflow_config import DataflowBuildConfig
1920
from finn.util.basic import alveo_default_platform, alveo_part_map, part_map
2021

21-
# TODO: merge this file into bench.py once most functionality has been moved to builder
22-
2322

2423
def start_test_batch_fast(results_path, project_path, run_target, pairs):
2524
# Prepare tcl script
@@ -109,7 +108,7 @@ def __init__(self, params, task_id, run_id, work_dir, artifacts_dir, save_dir, d
109108
# TODO: coordinate with new builder loggin setup
110109

111110
# Setup some basic global default configuration
112-
# TODO: are these class members even used anymore?
111+
# TODO: clean up or remove these attributes
113112
if "synth_clk_period_ns" in params:
114113
self.clock_period_ns = params["synth_clk_period_ns"]
115114
else:
@@ -136,6 +135,23 @@ def __init__(self, params, task_id, run_id, work_dir, artifacts_dir, save_dir, d
136135
else:
137136
self.params["shell_flow_type"] = build_cfg.ShellFlowType.VIVADO_ZYNQ
138137

138+
# Load custom (= non build_dataflow_config) parameters from topology-specific .yml
139+
custom_params = [
140+
"model_dir", # used to setup onnx/npy input
141+
"model_path", # used to setup onnx/npy input
142+
# model-gen parameters, such as seed, simd, pe, etc.
143+
# TODO: separate these more cleanly from builder options
144+
]
145+
146+
dut_yaml_name = self.params["dut"] + ".yml"
147+
dut_path = os.path.join(os.path.dirname(__file__), "dut", dut_yaml_name)
148+
if os.path.isfile(dut_path):
149+
with open(dut_path, "r") as f:
150+
dut_cfg = yaml.load(f, Loader=yaml.SafeLoader)
151+
for key in dut_cfg:
152+
if key in custom_params:
153+
self.params[key] = dut_cfg[key]
154+
139155
# Clear FINN tmp build dir before every run
140156
print("Clearing FINN BUILD DIR ahead of run")
141157
delete_dir_contents(os.environ["FINN_BUILD_DIR"])
@@ -244,15 +260,6 @@ def step_parse_builder_output(self, build_dir):
244260

245261
def steps_full_build_flow(self):
246262
# Default step sequence for benchmarking a full FINN builder flow
247-
248-
# LIST OF ADDITIONAL YAML OPTIONS (beyond DataflowBuildConfig)
249-
custom_params = [
250-
"model_dir", # used to setup onnx/npy input
251-
"model_path", # used to setup onnx/npy input
252-
# model-gen parameters, such as seed, simd, pe, etc.
253-
# TODO: separate these from builder options
254-
]
255-
256263
# MODEL CREATION/IMPORT
257264
# TODO: track fixed input onnx models with DVC
258265
if "model_dir" in self.params:
@@ -281,7 +288,8 @@ def steps_full_build_flow(self):
281288
# enable extra performance optimizations (physopt)
282289
# TODO: check OMX synth strategy again!
283290
cfg.vitis_opt_strategy = build_cfg.VitisOptStrategy.PERFORMANCE_BEST
284-
cfg.verbose = False
291+
cfg.verbose = True
292+
cfg.console_log_level = "ERROR"
285293
cfg.enable_build_pdb_debug = False
286294
# cfg.stitched_ip_gen_dcp = False # only needed for further manual integration
287295
cfg.force_python_rtlsim = False
@@ -294,14 +302,10 @@ def steps_full_build_flow(self):
294302
# cfg.large_fifo_mem_style
295303

296304
# Overwrite build config settings with run-specific YAML build definition
305+
# TODO: warn/error if there are unrecognized options set?
297306
for key in self.params:
298307
if hasattr(cfg, key):
299308
setattr(cfg, key, self.params[key])
300-
else:
301-
if key not in custom_params:
302-
pass
303-
# TODO: be more strict? support custom extra options like MetaFi uses?
304-
# raise Exception("Unrecognized builder config defined in YAML: %s" % key)
305309

306310
# Default of 1M cycles is insufficient for MetaFi (6M) and RN-50 (2.5M)
307311
# TODO: make configurable or set on pipeline level?

0 commit comments

Comments
 (0)