aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/high_level_command_stream_generator.py
diff options
context:
space:
mode:
authorJacob Bohlin <jacob.bohlin@arm.com>2020-06-11 15:09:57 +0200
committerTim Hall <tim.hall@arm.com>2020-06-18 17:53:52 +0100
commit611fcdf8f0e33dabba4486eb78ce482c189248e5 (patch)
treef2265bb694b901d6ff6a57bd616fd0ead0ddc950 /ethosu/vela/high_level_command_stream_generator.py
parent749d92115e8ac7d0cc755ce93ea8a8c53fd6e474 (diff)
downloadethos-u-vela-611fcdf8f0e33dabba4486eb78ce482c189248e5.tar.gz
MLBEDSW-2435: Fix for cascading upscaling operators
Fixed a coordinate issue which caused the compiler to crash when cascading upscaling operators such as ResizeBilinear. Signed-off-by: Jacob Bohlin <jacob.bohlin@arm.com> Change-Id: I982863573b0e5829e6d0c255dbbc308cb332a37a
Diffstat (limited to 'ethosu/vela/high_level_command_stream_generator.py')
-rw-r--r--ethosu/vela/high_level_command_stream_generator.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/ethosu/vela/high_level_command_stream_generator.py b/ethosu/vela/high_level_command_stream_generator.py
index 0cd3ad22..ab72fbcd 100644
--- a/ethosu/vela/high_level_command_stream_generator.py
+++ b/ethosu/vela/high_level_command_stream_generator.py
@@ -75,9 +75,13 @@ def generate_high_level_command_stream_for_pass(strat, passes, block_configs, id
strides = None
skirt = None
+ upscaling = 1
if ps.primary_op is not None:
strides = ps.primary_op.attrs.get("strides", None)
skirt = ps.primary_op.attrs.get("skirt", None)
+ if ps.primary_op.type in set(("Conv2DBackpropInputSwitchedBias", "ResizeBilinear")):
+ upscaling = ofm_tensor.shape[-3] // ifm_tensor.shape[-3]
+ assert ofm_tensor.shape[-2] == (ifm_tensor.shape[-2] * upscaling)
concat_axis = 0
concat_offset = 0
@@ -113,13 +117,13 @@ def generate_high_level_command_stream_for_pass(strat, passes, block_configs, id
if ifm_tensor.shape != []:
ifm_box, _, _ = ofm_box.transform_with_strides_and_skirt(
- strides, skirt, ifm_tensor.shape, npu_block_type, concat_axis, concat_offset, split_offsets[0]
+ strides, skirt, ifm_tensor.shape, npu_block_type, concat_axis, concat_offset, split_offsets[0], upscaling
)
else:
ifm_box = Box([], [])
if ifm2_tensor is not None and ifm2_tensor.shape != []:
ifm2_box, _, _ = ofm_box.transform_with_strides_and_skirt(
- strides, skirt, ifm2_tensor.shape, npu_block_type, concat_axis, concat_offset, split_offsets[1]
+ strides, skirt, ifm2_tensor.shape, npu_block_type, concat_axis, concat_offset, split_offsets[1], upscaling
)
else:
ifm2_box = Box([], [])
@@ -127,7 +131,7 @@ def generate_high_level_command_stream_for_pass(strat, passes, block_configs, id
for intermediate in ps.intermediates:
if intermediate != None and intermediate.shape != [] and intermediate.purpose == TensorPurpose.FeatureMap:
intermediate_box, _, _ = ofm_box.transform_with_strides_and_skirt(
- strides, skirt, intermediate.shape, npu_block_type, concat_axis, concat_offset, split_offsets[0]
+ strides, skirt, intermediate.shape, npu_block_type, concat_axis, concat_offset, split_offsets[0], upscaling
)
yield from dma_if_necessary(ps, intermediate_box, intermediate)
@@ -214,13 +218,13 @@ def generate_high_level_command_stream_for_pass(strat, passes, block_configs, id
k_height = weight_tensor.shape[0]
ifm_box, pad_top, pad_bottom = ofm_box.transform_with_strides_and_skirt(
- strides, skirt, ifm_tensor.shape, npu_block_type, concat_axis, concat_offset, split_offsets[0], k_height
+ strides, skirt, ifm_tensor.shape, npu_block_type, concat_axis, concat_offset, split_offsets[0], k_height, upscaling
)
for intermediate in ps.intermediates:
if intermediate != None and intermediate.shape != [] and intermediate.purpose == TensorPurpose.FeatureMap:
intermediate_box, _, _ = ofm_box.transform_with_strides_and_skirt(
- strides, skirt, intermediate.shape, npu_block_type, concat_axis, concat_offset, split_offsets[0]
+ strides, skirt, intermediate.shape, npu_block_type, concat_axis, concat_offset, split_offsets[0], upscaling
)
yield from dma_if_necessary(ps, intermediate_box, intermediate)