From eb82844ef074173a43ef05f3ca33c10daffa00af Mon Sep 17 00:00:00 2001 From: Alexander Bengtsson Date: Fri, 10 Jan 2025 15:27:16 +0100 Subject: [PATCH] MLBEDSW-10227: Fix Ethos-U55 rescale fusing for 32-bit operations - Ethos-U55 rescales 32-bit operations with shift-only this needs to be accounted for when performing rescale fusing. Change-Id: I71755c8aa7c6ac23e85858655c1659cb0899d3b2 Signed-off-by: Alexander Bengtsson --- ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp b/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp index e44f5a76..435e5de7 100644 --- a/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp +++ b/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp @@ -102,9 +102,10 @@ bool EthosU55Constraints::SupportsFusedRescale( else if ( npuOp == EthosU55NpuOp::Elementwise && globalScale ) { bool fromTypeSupported = (IsInteger(fromType) && (fromBits == 8 || fromBits == 16)) || fromType == DataType::Int32; - if ( opType == OpType::Mul && fromType == DataType::Int32 ) + if ( fromType == DataType::Int32 ) { - return quantization.scales.front().scale == 1; // Only shift supported for MUL int32 + // For 32-bit operations scale is not applied but shift is + return quantization.scales.front().scale == 1; } if ( opType == OpType::Minimum || opType == OpType::Maximum || opType == OpType::Asr || opType == OpType::SHL || opType == OpType::CLZ || opType == OpType::LeakyRelu ) -- GitLab