From 299cecc396d611fe6be5ac8289a42edabac05ee7 Mon Sep 17 00:00:00 2001 From: Max Bergfelt Date: Thu, 19 Jun 2025 10:02:53 +0200 Subject: [PATCH] MLBEDSW-10901: Reworked SupportedDtypes check for elementwise operators. Removed the check for all IFM tensors of binary elementwise operators to have the same type in the SupportedDtypes function. This check blocked operators such us And/AndNot that can have mixed input types, which are promoted to full width integers either way. Change-Id: Ie4f8304ac67ad06d9c113c5dbd1183a3209ca498 Signed-off-by: Max Bergfelt --- .../architecture/ethosu85/ethos_u85_constraints.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ethosu/regor/architecture/ethosu85/ethos_u85_constraints.cpp b/ethosu/regor/architecture/ethosu85/ethos_u85_constraints.cpp index 631a7eb1..11768bf9 100644 --- a/ethosu/regor/architecture/ethosu85/ethos_u85_constraints.cpp +++ b/ethosu/regor/architecture/ethosu85/ethos_u85_constraints.cpp @@ -271,6 +271,7 @@ bool EthosU85Constraints::SupportedDtypes(OpType opType, DataType ifmType, DataT else { readonly_span_t ifmTypes = s_defaultAllTypes; + readonly_span_t ifm2Types = s_defaultAllTypes; ofmTypes = s_defaultAllTypes; if ( !std::any_of(ifmTypes.begin(), ifmTypes.end(), [&](auto t) { return t == ifmType; }) ) @@ -278,10 +279,14 @@ bool EthosU85Constraints::SupportedDtypes(OpType opType, DataType ifmType, DataT // Unsupported ifm data type return false; } - if ( IsBinaryElementwise(opType) && ifm2Type != ifmType ) + + if ( IsBinaryElementwise(opType) ) { - // ifm2 data type must match ifm data type - return false; + if ( !std::any_of(ifm2Types.begin(), ifm2Types.end(), [&](auto t) { return t == ifm2Type; }) ) + { + // Unsupported ifm2 data type + return false; + } } } -- GitLab