aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/cascade_builder.py
diff options
context:
space:
mode:
authorFredrik Svedberg <fredrik.svedberg@arm.com>2022-09-27 14:13:01 +0200
committerFredrik Svedberg <fredrik.svedberg@arm.com>2022-10-04 09:20:33 +0000
commit4a434cba156cdfb2613b7ebe4d4a4ec9f85ba616 (patch)
tree47ebce38221b92b8eeb34e8b5f558223dcd4d3e3 /ethosu/vela/cascade_builder.py
parentdda4caed56d2cd3a9d5927bf405859c1777ac909 (diff)
downloadethos-u-vela-4a434cba156cdfb2613b7ebe4d4a4ec9f85ba616.tar.gz
MLBEDSW-6969 Remove RescaleAdd and RescaleMul operators
Removed RescaleAdd and RescaleMul operators in favour of Operation.explicit_scale and removed Operation.rescale. Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com> Change-Id: Idccd8851731d4bb8d4e84970e0fd6b409d7d4e45
Diffstat (limited to 'ethosu/vela/cascade_builder.py')
-rw-r--r--ethosu/vela/cascade_builder.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/ethosu/vela/cascade_builder.py b/ethosu/vela/cascade_builder.py
index 3c105374..1f5dc504 100644
--- a/ethosu/vela/cascade_builder.py
+++ b/ethosu/vela/cascade_builder.py
@@ -18,6 +18,7 @@
# Groups Operators in a schedule together to form Cascades.
from collections import namedtuple
+from .high_level_command_to_npu_op import ifm_ifm2_correct_order
from .numeric_util import round_up
from .operation import NpuBlockType
from .operation import Op
@@ -169,17 +170,14 @@ class CascadeBuilder:
@staticmethod
def element_wise_cascading_conformity(sched_op):
"""Check the inputs of the op to see if it's a candidate for cascading."""
- # Cascading sub-operators of Softmax results in a crash when handling Sub and RescaleAdd ops
ifm = sched_op.parent_op.ifm
ifm2 = sched_op.parent_op.ifm2
- if sched_op.op_type in [Op.RescaleAdd]:
- return False
-
+ # 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
- return Op.Const in (ifm.ops[0], ifm2.ops[0])
+ return Op.Const in (ifm.ops[0].type, ifm2.ops[0].type) and ifm_ifm2_correct_order(ifm.shape, ifm2.shape)
else:
# Either one IFM is not variable or it is not a binary elementwise op - we cannot rule out cascadability
return True