diff options
author | Jacob Bohlin <jacob.bohlin@arm.com> | 2020-06-23 12:12:56 +0200 |
---|---|---|
committer | Jacob Bohlin <jacob.bohlin@arm.com> | 2020-07-07 09:13:42 +0200 |
commit | e843d3311b8945baa32654af0dccb229b6861438 (patch) | |
tree | 335db03df5745da1ed68b62e24424f7ae3a32294 /ethosu/vela/graph_optimiser.py | |
parent | 42e4189689a7ded7e2a804f6263a7c588fbb66cd (diff) | |
download | ethos-u-vela-e843d3311b8945baa32654af0dccb229b6861438.tar.gz |
MLBEDSW-2548: Fix for Double Buffer size estimate
This will give a worst case estimate of the Double Buffer size in the
Scheduler and it will no longer be able to choose strategies that end
up with a buffer that doesn't fit in SRAM.
Signed-off-by: Jacob Bohlin <jacob.bohlin@arm.com>
Change-Id: I763731f63c7672679f3b8cd6db65dad03b946ae5
Diffstat (limited to 'ethosu/vela/graph_optimiser.py')
-rw-r--r-- | ethosu/vela/graph_optimiser.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ethosu/vela/graph_optimiser.py b/ethosu/vela/graph_optimiser.py index cd4ac63e..dbf2b7b9 100644 --- a/ethosu/vela/graph_optimiser.py +++ b/ethosu/vela/graph_optimiser.py @@ -435,6 +435,18 @@ def convert_depthwise_to_conv(op, arch): return op +def reorder_depthwise_weights(op, arch): + if "DepthwiseConv2d" in op.type: + weight_tensor = op.inputs[1] + weight_tensor.quant_values = np.transpose(weight_tensor.quant_values, (0, 1, 3, 2)) + weight_tensor.shape = weight_tensor.storage_shape = weight_tensor.bandwidth_shape = list( + weight_tensor.quant_values.shape + ) + weight_tensor.weight_transpose_depthwise = True + + return op + + # Reorder activation op if it's after the memory only operations def fixup_act_reorder(op, arch): if op.type in activation_ops: @@ -589,6 +601,7 @@ def optimise_graph_a(nng, arch, verbose_graph=False): add_padding_fields, mark_npu_block_type, fixup_elementwise_with_scalars, + reorder_depthwise_weights, # convert_mul_max_to_abs_or_lrelu # TODO: enable optimisation once quantisation issues are resolved ] |