From 8d353840d63b5b1133974e8b010e5299dd9b9d95 Mon Sep 17 00:00:00 2001 From: Max Bergfelt Date: Fri, 16 May 2025 17:16:12 +0200 Subject: [PATCH] MLBEDSW-10273: Reverse support for Ethos-U55/U65 Change-Id: I195c5a3b1c03ebf4e060f10aff15174127d7e404 Signed-off-by: Max Bergfelt --- ethosu/regor/architecture/ethosu55/ethos_u55.cpp | 2 +- .../regor/architecture/ethosu55/ethos_u55_constraints.cpp | 6 ++++++ ethosu/regor/tflite/tflite_supported_operators_u55.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ethosu/regor/architecture/ethosu55/ethos_u55.cpp b/ethosu/regor/architecture/ethosu55/ethos_u55.cpp index f9d30105..d92b74e7 100644 --- a/ethosu/regor/architecture/ethosu55/ethos_u55.cpp +++ b/ethosu/regor/architecture/ethosu55/ethos_u55.cpp @@ -275,7 +275,7 @@ Flags ArchEthosU55::SupportedWeightFormat(OpType) bool ArchEthosU55::UseAvgPoolNop(OpType type) { - return IsActivation(type) || type == OpType::Quantize || type == OpType::MemoryCopy; + return IsActivation(type) || type == OpType::Quantize || type == OpType::MemoryCopy || type == OpType::Reverse; } static bool ChooseKernelMethod(const Shape &ifmShape, int ifmBits, const Kernel *kernel) diff --git a/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp b/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp index 5849e0be..47817262 100644 --- a/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp +++ b/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp @@ -258,6 +258,12 @@ bool EthosU55Constraints::SupportedDtypes(OpType opType, DataType ifmType, DataT } } break; + case OpType::Reverse: + { + validIfmTypes = {DataType::UInt8, DataType::Int8, DataType::Int16}; + validOfmTypes = {DataType::UInt8, DataType::Int8, DataType::Int16}; + } + break; default: assert(false && "Unkown elementwise type"); break; diff --git a/ethosu/regor/tflite/tflite_supported_operators_u55.cpp b/ethosu/regor/tflite/tflite_supported_operators_u55.cpp index 1c9fdc3c..56a53d08 100644 --- a/ethosu/regor/tflite/tflite_supported_operators_u55.cpp +++ b/ethosu/regor/tflite/tflite_supported_operators_u55.cpp @@ -216,7 +216,7 @@ bool TfLiteSupportedOperatorsU55::ConstraintResize(const Operation *op) bool TfLiteSupportedOperatorsU55::ConstraintReverse(const Operation *op) { - if ( op->Type() != OpType::Reverse && op->Type() != OpType::ReverseV2 ) + if ( op->Type() != OpType::ReverseV2 ) { return true; } -- GitLab