From eb5a4a857cca3ae18928268adfcffe91efd48fd9 Mon Sep 17 00:00:00 2001 From: Rickard Bolin Date: Thu, 19 May 2022 12:38:27 +0000 Subject: MLBEDSW-6271: Key error when using --verbose-performance option - The print_performance function that is called when using the --verbose-performance option crashed with KeyError when no SRAM was used. Signed-off-by: Rickard Bolin Change-Id: Ib6af3193e8f4f368cb28d51e65afa0751773628a --- ethosu/vela/npu_performance.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ethosu/vela/npu_performance.py b/ethosu/vela/npu_performance.py index 0e2e3ca2..6d99dea0 100644 --- a/ethosu/vela/npu_performance.py +++ b/ethosu/vela/npu_performance.py @@ -804,12 +804,14 @@ def print_performance( src_op_name = nng_optype_to_input_op_type(src_op_type) max_macs = cycles[sched_op][PassCycles.Total] * arch.num_macs_per_cycle * arch.ncores - + peak_sram = ( + mem_usage[sched_op] / nng.memory_used[MemArea.Sram] * 100 if MemArea.Sram in nng.memory_used else 0 + ) print( f" {src_op_name:20s}" f" {sched_op.op_type:20s}" f" {mem_usage[sched_op]:10.0f}" - f" ({mem_usage[sched_op] / nng.memory_used[MemArea.Sram] * 100:6.2f}%)" + f" ({peak_sram:6.2f}%)" f" {cycles[sched_op][PassCycles.Total]:10.0f}" f" ({cycles[sched_op][PassCycles.Total] / nng.cycles[PassCycles.Total] * 100:6.2f}%)" f" [" -- cgit v1.2.1