aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/npu_performance.py
diff options
context:
space:
mode:
authorDiqing Zhong <diqing.zhong@arm.com>2020-12-16 16:46:06 +0100
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2020-12-22 14:44:09 +0000
commit016b827ad722aecd4338d1d6c7b1b004760490b7 (patch)
tree7a26bfdf670e8885693bc7db531ea647e24d571b /ethosu/vela/npu_performance.py
parent3d73717f793100ba6705441fb42514f938780c1e (diff)
downloadethos-u-vela-016b827ad722aecd4338d1d6c7b1b004760490b7.tar.gz
MLBEDSW-1493: Optimise strided conv
- Reshape/rearrange IFM and weight tensor for better HW utilization - Update estimator to cover this case Change-Id: I4be70a69fa600a1951bf1c247f9973e6cc9b03f4 Signed-off-by: Diqing Zhong <diqing.zhong@arm.com>
Diffstat (limited to 'ethosu/vela/npu_performance.py')
-rw-r--r--ethosu/vela/npu_performance.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ethosu/vela/npu_performance.py b/ethosu/vela/npu_performance.py
index 4ca46831..c2418d73 100644
--- a/ethosu/vela/npu_performance.py
+++ b/ethosu/vela/npu_performance.py
@@ -422,6 +422,9 @@ def performance_metrics_for_pass(arch, ps, block_config=None, rewrite_list=None,
ifm_tensor, _, weight_tensor, ofm_tensor = ps.get_primary_op_ifm_ifm2_weights_ofm()
ifm_tensor_shape = ps.primary_op.ifm_shapes[0].clone()
ofm_tensor_shape = ps.primary_op.ofm_shapes[0].clone()
+ ofm_block.width = min(ofm_block.width, ofm_tensor_shape.width)
+ ofm_block.height = min(ofm_block.height, ofm_tensor_shape.height)
+ ofm_block.depth = min(ofm_block.depth, ofm_tensor_shape.depth)
if npu_block_type == NpuBlockType.ReduceSum:
block_traversal = TensorBlockTraversal.DepthFirst
@@ -439,6 +442,8 @@ def performance_metrics_for_pass(arch, ps, block_config=None, rewrite_list=None,
ifm_block = arch.get_ifm_block_size(
ifm_block_depth, ofm_block, primary_op.kernel, ifm_resampling_mode=ifm_tensor.resampling_mode
)
+ ifm_block.width = min(ifm_block.width, ifm_tensor_shape.width)
+ ifm_block.height = min(ifm_block.height, ifm_tensor_shape.height)
if npu_block_type in (
NpuBlockType.ConvolutionMxN,