aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Alfven <johan.alfven@arm.com>2024-04-04 13:26:18 +0200
committerJohan Alfven <johan.alfven@arm.com>2024-04-04 15:37:11 +0200
commit190b63a6ae6908625dffab203a8137c27aaec5fd (patch)
treec303c02aa4a45e7c6d18e1ed4874d3516b8b6e19
parent7647b0fe74e68792963c5602a083c215ee369182 (diff)
downloadethos-u-vela-190b63a6ae6908625dffab203a8137c27aaec5fd.tar.gz
MLBEDSW-8886: Regression: Output diff on LSTM
- Fix regression caused by too strict constraints on SplitSpliceRead causing output diff for LSTM. - As long as the SplitSpliceRead shape fits within the consumer ifm shape it is ok to move the read. Change-Id: Ia6f508f99638c3aedccc7fd9f31405527bb64f87 Signed-off-by: Johan Alfven <johan.alfven@arm.com>
-rw-r--r--ethosu/vela/graph_optimiser_util.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/ethosu/vela/graph_optimiser_util.py b/ethosu/vela/graph_optimiser_util.py
index 44a08f5..46762e4 100644
--- a/ethosu/vela/graph_optimiser_util.py
+++ b/ethosu/vela/graph_optimiser_util.py
@@ -213,13 +213,18 @@ def set_ifm_ofm_op_shapes(op, arch, nng):
def check_splitsliceread_to_consumer_shape(op, cons_op):
assert op.type == Op.SplitSliceRead
- # SplitSliceRead ofm shape must match consumer ifm shape
+ # SplitSliceRead ofm shape must fit within the consumer ifm shape
if cons_op.ifm == op.ofm:
- return cons_op.ifm_shapes[0] == op.ofm_shapes[0]
+ cons_shape = cons_op.ifm_shapes[0].as_list()
+ read_shape = op.ofm_shapes[0].as_list()
elif cons_op.type.is_binary_elementwise_op() and cons_op.ifm2 == op.ofm:
- return cons_op.ifm_shapes[1] == op.ofm_shapes[0]
+ cons_shape = cons_op.ifm_shapes[1].as_list()
+ read_shape = op.ofm_shapes[0].as_list()
+ else:
+ return False
- return False
+ # All read shape values <= consumer shape values
+ return all(read_shape[idx] <= x for idx, x in enumerate(cons_shape))
def move_splitsliceread_to_consumer(op, cons_op):