From a1444e68e7038035ad268b5865f21fa1a38d6061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Alfv=C3=A9n?= Date: Fri, 20 Dec 2024 11:56:45 +0100 Subject: [PATCH] MLBEDSW-10201: Fix assert for LeakyRelu - The ifm round mode patch has caused a regression when generating scaling for LeakyRelu, triggering an assert - LeakyRelu does not have ifm2 rounding so it must use ifm rounding Change-Id: I8d5e5d0411638f2f3d3a0cc1b491d873d2313fa8 Signed-off-by: Johan Alfven --- .../architecture/ethosu85/ethos_u85_register_cs_generator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ethosu/regor/architecture/ethosu85/ethos_u85_register_cs_generator.cpp b/ethosu/regor/architecture/ethosu85/ethos_u85_register_cs_generator.cpp index 654f790b..72dacd2e 100644 --- a/ethosu/regor/architecture/ethosu85/ethos_u85_register_cs_generator.cpp +++ b/ethosu/regor/architecture/ethosu85/ethos_u85_register_cs_generator.cpp @@ -775,7 +775,8 @@ void EthosU85RCSGenerator::GenerateScalingForElementwise(HLCOperation *op) if ( ifmCnt == 2 ) { assert(unsigned(input2Scale.shift) < 64); - auto ifm2RoundMode = GetIfmRoundingMode(op, 1); + // Use ifmRoundeMode since ifmCnt is forced to 2 for LeakyRelu + auto ifm2RoundMode = opType == OpType::LeakyRelu ? ifmRoundMode : GetIfmRoundingMode(op, 1); Emit(isa::npu_set_ifm2_scale_t(input2Scale.shift, ifmDoubleRound, ifm2RoundMode, input2Scale.scale)); } assert(unsigned(outScale.shift) < 64); -- GitLab