aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/cascade_builder.py
diff options
context:
space:
mode:
Diffstat (limited to 'ethosu/vela/cascade_builder.py')
-rw-r--r--ethosu/vela/cascade_builder.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ethosu/vela/cascade_builder.py b/ethosu/vela/cascade_builder.py
index b4a4f876..ebe2f133 100644
--- a/ethosu/vela/cascade_builder.py
+++ b/ethosu/vela/cascade_builder.py
@@ -175,11 +175,12 @@ class CascadeBuilder:
ifm = sched_op.parent_op.ifm
ifm2 = sched_op.parent_op.ifm2
- # Cascading elementwise operations with reverse operand order is not handled
if sched_op.parent_op.type.is_binary_elementwise_op() and ifm and ifm2:
# We cannot rule out cascadability if at least one IFM is constant
+ ifm_const = ifm.ops != [] and ifm.ops[0].type == Op.Const
ifm2_const = ifm2.ops != [] and ifm2.ops[0].type == Op.Const
- return ifm_ifm2_correct_order(ifm.shape, ifm2.shape) and ifm2_const
+ correct_order = ifm_ifm2_correct_order(ifm.shape, ifm2.shape)
+ return (ifm_const and (ifm.shape == ifm2.shape or not correct_order)) or (ifm2_const and correct_order)
else:
# Either one IFM is not variable or it is not a binary elementwise op - we cannot rule out cascadability
return True