From e4d2f218fbdba4aa58380e9dfc42688330a70512 Mon Sep 17 00:00:00 2001 From: William Isaksson Date: Sat, 10 Feb 2024 15:54:44 +0100 Subject: MLBEDSW-8672: Add ext_key tracking - Add ext_key tracking. - Fix debug db cmd offsets being off by 4. Change-Id: Ib109a15a0a2c44d08021c3b1bc3bcc067240ac5c Signed-off-by: William Isaksson --- ethosu/vela/debug_database.py | 4 ++-- ethosu/vela/register_command_stream_generator.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ethosu/vela/debug_database.py b/ethosu/vela/debug_database.py index ac4ef170..597f8410 100644 --- a/ethosu/vela/debug_database.py +++ b/ethosu/vela/debug_database.py @@ -34,7 +34,7 @@ class DebugDatabase: SOURCE_TABLE = "source" _sourceUID: Dict[Any, int] = {} - _sourceHeaders = ["id", "operator", "kernel_w", "kernel_h", "ofm_w", "ofm_h", "ofm_d"] + _sourceHeaders = ["id", "operator", "kernel_w", "kernel_h", "ofm_w", "ofm_h", "ofm_d", "ext_key"] _sourceTable: List[List[Union[float, int, str]]] = [] OPTIMISED_TABLE = "optimised" @@ -58,7 +58,7 @@ class DebugDatabase: cls._sourceUID[op] = uid ofm_shape = numeric_util.full_shape(3, op.outputs[0].shape, 1) cls._sourceTable.append( - [uid, str(op.type), op.kernel.width, op.kernel.height, ofm_shape[-2], ofm_shape[-3], ofm_shape[-1]] + [uid, str(op.type), op.kernel.width, op.kernel.height, ofm_shape[-2], ofm_shape[-3], ofm_shape[-1], op.op_index] ) # Ops are added when their type changes, and after optimisation. If an op was already diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py index e208e8d0..01654697 100644 --- a/ethosu/vela/register_command_stream_generator.py +++ b/ethosu/vela/register_command_stream_generator.py @@ -1095,7 +1095,9 @@ def generate_command_stream( # Generate the actual NPU_OP command generate_operation_code(emit, npu_op) if add_to_debug_db is not None: - add_to_debug_db(npu_op, emit.offset) + if not isinstance(npu_op, NpuDmaOperation): + # Subtraction by 4 is to account for that offsets are pre-incremented. + add_to_debug_db(npu_op, emit.offset - 4) # Fill in final part of command stream: emit.cmd_do_operation(cmd0.NPU_OP_STOP, param=0xFFFF) res = emit.to_list() -- cgit v1.2.1