Skip to content
Snippets Groups Projects
Commit d19255d8 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Build] calculate stable_throughput metric as part of step_measure_rtlsim_performance

parent 38e9d5af
No related branches found
No related tags found
No related merge requests found
......@@ -667,7 +667,6 @@ def step_measure_rtlsim_performance(model: ModelWrapper, cfg: DataflowBuildConfi
)
rtlsim_bs = int(cfg.rtlsim_batch_size)
if force_python_rtlsim:
# run with single input to get latency
orig_rtlsim_trace_depth = get_rtlsim_trace_depth()
assert rtlsim_bs > 0, "rtlsim batch size must be >0"
if cfg.verify_save_rtlsim_waveforms:
......@@ -680,9 +679,11 @@ def step_measure_rtlsim_performance(model: ModelWrapper, cfg: DataflowBuildConfi
rtlsim_model.set_metadata_prop(
"extra_verilator_args", str(["-CFLAGS", "-O3"])
)
# run with single input to get latency
rtlsim_latency_dict = throughput_test_rtlsim(rtlsim_model, 1)
# run with batch to get stable-state throughput
rtlsim_perf_dict = throughput_test_rtlsim(rtlsim_model, rtlsim_bs)
rtlsim_latency = rtlsim_perf_dict["cycles"]
rtlsim_perf_dict["latency_cycles"] = rtlsim_latency
rtlsim_perf_dict["latency_cycles"] = rtlsim_latency_dict["cycles"]
else:
rtlsim_perf_dict = verilator_fifosim(model, rtlsim_bs)
# keep keys consistent between the Python and C++-styles
......@@ -696,6 +697,19 @@ def step_measure_rtlsim_performance(model: ModelWrapper, cfg: DataflowBuildConfi
for (key, val) in rtlsim_perf_dict.items():
if "max_count" in key:
del rtlsim_perf_dict[key]
# estimate stable-state throughput based on latency+throughput
if rtlsim_bs == 1:
rtlsim_perf_dict["stable_throughput[images/s]"] = rtlsim_perf_dict[
"throughput[images/s]"
]
else:
total_cycles = rtlsim_perf_dict["cycles"]
latency_cycles = rtlsim_perf_dict["latency_cycles"]
stablestate_cycles = total_cycles - latency_cycles
clk_ns = float(model.get_metadata_prop("clk_ns"))
fclk_mhz = 1 / (clk_ns * 0.001)
runtime_s = (stablestate_cycles * clk_ns) * (10**-9)
rtlsim_perf_dict["stable_throughput[images/s]"] = rtlsim_bs / runtime_s
with open(report_dir + "/rtlsim_performance.json", "w") as f:
json.dump(rtlsim_perf_dict, f, indent=2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment