aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/weight_compressor.py
diff options
context:
space:
mode:
authorAndreas Nevalainen <andreas.nevalainen@arm.com>2020-10-28 15:42:08 +0100
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2020-11-11 08:34:16 +0000
commit897cc14968e017b1f48f376f7f7cefc515c5fe88 (patch)
tree27d17a59f1529c1ed0b1cc59e60438ee7f5d29d2 /ethosu/vela/weight_compressor.py
parent73320a48dfa711f5938b0e3d8e03b9858558b899 (diff)
downloadethos-u-vela-897cc14968e017b1f48f376f7f7cefc515c5fe88.tar.gz
MLBEDSW-3222: Bias tensors in fast storage
For IFM streamed cascades bias tensors are read several times. Moves these tensors to fast storage and add DMA commands. Change-Id: I630f6275986c1b5e3f126c925b11e22500fb1128 Signed-off-by: Andreas Nevalainen <andreas.nevalainen@arm.com>
Diffstat (limited to 'ethosu/vela/weight_compressor.py')
-rw-r--r--ethosu/vela/weight_compressor.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/ethosu/vela/weight_compressor.py b/ethosu/vela/weight_compressor.py
index 94535216..b0187b65 100644
--- a/ethosu/vela/weight_compressor.py
+++ b/ethosu/vela/weight_compressor.py
@@ -404,7 +404,7 @@ def compress_weights(arch, nng, tens, npu_block_type, ofm_block_depth, ofm_depth
def calc_scales_and_pack_biases(tens, arch, ofm_depth_step, rescale_for_faf=False):
- assert tens.purpose == TensorPurpose.FeatureMap
+ assert tens.purpose in [TensorPurpose.FeatureMap, TensorPurpose.FSBias]
assert tens.format == TensorFormat.NHWC
# the connected operator should expect a bias input unless it is a FullyConnected
assert tens.consumer_list[0].type.needs_bias()
@@ -531,3 +531,9 @@ def update_pass_weight_and_scale_tensors(nng, arch):
if (ps.ops[-1].type in activation_ops) and (ps.npu_block_type != NpuBlockType.ElementWise):
rescale_for_faf = True
calc_scales_and_pack_biases(ps.scale_tensor, arch, ofm_depth_step, rescale_for_faf)
+ if ps.scale_tensor.ops[0].type == Op.DMA:
+ src_tens = ps.scale_tensor.get_dma_src_tensor()
+ src_tens.shape = ps.scale_tensor.shape
+ src_tens.quant_values = ps.scale_tensor.quant_values
+ src_tens.element_size_bytes = ps.scale_tensor.element_size_bytes
+ src_tens.copy_compressed_weight_info(ps.scale_tensor)