aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/weight_compressor.py
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2020-06-25 16:55:02 +0100
committerTim Hall <tim.hall@arm.com>2020-06-25 16:55:02 +0100
commit6231676d1751caa353a51f9bdfc50642930f4802 (patch)
tree60952c5d4593aa640e676f7d408a8ef7bf8d3521 /ethosu/vela/weight_compressor.py
parentf7e810a695c1426799d945d61671126543efc123 (diff)
downloadethos-u-vela-6231676d1751caa353a51f9bdfc50642930f4802.tar.gz
MLBEDSW-2556: Odd core/block depth weight interleaving update
- If blockdepth or core count resulted in empty or non-existent substreams, the command generator generated an error. This commit changes the command stream generator to only program cores that have streams and are enabled for the configuration. Change-Id: I4e724b19de14d3a12e886ec6b17d0038593dfb59 Signed-off-by: Tim Hall <tim.hall@arm.com>
Diffstat (limited to 'ethosu/vela/weight_compressor.py')
-rw-r--r--ethosu/vela/weight_compressor.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ethosu/vela/weight_compressor.py b/ethosu/vela/weight_compressor.py
index fe8f04b9..d3562891 100644
--- a/ethosu/vela/weight_compressor.py
+++ b/ethosu/vela/weight_compressor.py
@@ -246,7 +246,6 @@ def compress_weights(arch, nng, tens, npu_block_type, ofm_block_depth, ofm_depth
# Slice weight stream up depth-ways into bricks and compress
full_ofm_depth = quant_buf.shape[-1]
- ofm_block_depth = ofm_block_depth // arch.ncores
for idx in range(0, full_ofm_depth, ofm_depth_step):
# Get the weights necessary for this brick
count = min(full_ofm_depth - idx, ofm_depth_step)
@@ -260,7 +259,13 @@ def compress_weights(arch, nng, tens, npu_block_type, ofm_block_depth, ofm_depth
# and generate separate compressed streams.
for core in range(0, min(arch.ncores, full_ofm_depth)):
core_weights = core_deinterleave(brick_weights, core, arch.ncores)
- raw_stream = generate_brick(arch, core_weights, ofm_block_depth, tens.block_traversal, ifm_bitdepth, dilation)
+
+ block_depth = (ofm_block_depth + arch.ncores - 1 - core) // arch.ncores
+ if block_depth != 0:
+ raw_stream = generate_brick(arch, core_weights, block_depth, tens.block_traversal, ifm_bitdepth, dilation)
+ else:
+ raw_stream = []
+
raw_size += len( raw_stream )
encoded_substream = encode( raw_stream )
encoded_stream.extend( encoded_substream )