From b7ce613873a88a8349b95e041ec4983971d7affb Mon Sep 17 00:00:00 2001 From: Rickard Bolin Date: Tue, 25 Feb 2025 16:54:23 +0000 Subject: [PATCH] MLBEDSW-10240: Prohibit fusing on DMA ops Also prohibit fusing on Ethos-U55 Transpose operators Change-Id: I6ab104659e7b5ae3706a1b8d18c97a564e060e39 Signed-off-by: Rickard Bolin --- ethosu/regor/architecture/ethosu55/ethos_u55.cpp | 10 +++++++++- ethosu/regor/architecture/ethosu85/ethos_u85.cpp | 6 ++++++ ethosu/regor/architecture/ethosu85/ethos_u85.hpp | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ethosu/regor/architecture/ethosu55/ethos_u55.cpp b/ethosu/regor/architecture/ethosu55/ethos_u55.cpp index 3fea9e9f..39c81120 100644 --- a/ethosu/regor/architecture/ethosu55/ethos_u55.cpp +++ b/ethosu/regor/architecture/ethosu55/ethos_u55.cpp @@ -727,12 +727,20 @@ void ArchEthosU55::Call(std::function callBack) int EthosU55OpGroup::Add(const ArchitectureOpGroupQuery &op, const std::vector &dependsOn) { LOG_TRACE1("Trying to add op {}\n", OpTypeToString(op.type)); - if ( _opsCount >= 2 ) { // Can only fuse 2 ops return 0; } + else if ( _opsCount == 1 ) + { + // Can not fuse to DMA or Compound operators + auto hwOp = ArchEthosU55::GetHWOp(_ops[0].type); + if ( hwOp == EthosU55NpuOp::Dma || hwOp == EthosU55NpuOp::Compound ) + { + return 0; + } + } if ( !CanRunOnNPU(op) ) { diff --git a/ethosu/regor/architecture/ethosu85/ethos_u85.cpp b/ethosu/regor/architecture/ethosu85/ethos_u85.cpp index 45e15874..5ff35454 100644 --- a/ethosu/regor/architecture/ethosu85/ethos_u85.cpp +++ b/ethosu/regor/architecture/ethosu85/ethos_u85.cpp @@ -1419,6 +1419,11 @@ int EthosU85OpGroup::ExternalIfms(const ArchitectureOpGroupQuery &op) bool EthosU85OpGroup::Fuse(const ArchitectureOpGroupQuery &op, const std::vector &dependsOn) { assert(_opsCount > 0); + if ( !_supportsFusing ) + { + return false; + } + if ( _chainLength > 1 ) { // TODO MLBEDSW-9142: support fusing on chained ops @@ -1584,6 +1589,7 @@ int EthosU85OpGroup::Add(const ArchitectureOpGroupQuery &op, const std::vector