From 8a70b98687789b486b72c19d1caddf0cfa6afad8 Mon Sep 17 00:00:00 2001 From: William Isaksson Date: Tue, 29 Oct 2024 21:07:45 +0100 Subject: [PATCH] MLBEDSW-10091: Add check to not add optimised ops to src table Adds check to check that already optimised ops are not added as source ops in the GraphIR pass. Change-Id: Ib966080f7ee3b5bf4e52ef9e601dcc37153dcdfe Signed-off-by: William Isaksson --- ethosu/regor/compiler/graph_optimiser.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ethosu/regor/compiler/graph_optimiser.cpp b/ethosu/regor/compiler/graph_optimiser.cpp index bca225bc..39b60490 100644 --- a/ethosu/regor/compiler/graph_optimiser.cpp +++ b/ethosu/regor/compiler/graph_optimiser.cpp @@ -1,5 +1,5 @@ // -// SPDX-FileCopyrightText: Copyright 2021-2024 Arm Limited and/or its affiliates +// SPDX-FileCopyrightText: Copyright 2021-2025 Arm Limited and/or its affiliates // // SPDX-License-Identifier: Apache-2.0 // @@ -280,10 +280,11 @@ int OptimiserDatabase::OptimisedId(const void *op) int OptimiserDatabase::SourceOp(const Operation *op, int ext_key) { - auto pos = _source.find(op); - if ( pos != _source.end() ) + // Op may be a source op or originate from optimised ops in previous graph optimisation pass + auto id = SourceId(op); + if ( id != 0 ) { - return pos->second; + return id; } _sourceId++; _source.emplace(op, _sourceId); -- GitLab