aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela
diff options
context:
space:
mode:
Diffstat (limited to 'ethosu/vela')
-rw-r--r--ethosu/vela/mark_tensors.py9
-rw-r--r--ethosu/vela/tensor.py2
-rw-r--r--ethosu/vela/weight_compressor.py2
3 files changed, 8 insertions, 5 deletions
diff --git a/ethosu/vela/mark_tensors.py b/ethosu/vela/mark_tensors.py
index b6b2f9f4..40ce467b 100644
--- a/ethosu/vela/mark_tensors.py
+++ b/ethosu/vela/mark_tensors.py
@@ -371,10 +371,11 @@ def mark_tensor_format(nng, arch, verbose_tensor_format=False):
src_tens = tens.get_dma_src_tensor()
if src_tens is not None:
op = tens.find_npu_op()
- npu_block_type = op.attrs["npu_block_type"]
- weight_compressor.compress_weights(arch, nng, tens, npu_block_type, 16, 16, op.get_dilation_h_w())
- # Alias compressed weights back into source tensor
- src_tens.copy_compressed_weight_info(tens)
+ if op is not None:
+ npu_block_type = op.attrs["npu_block_type"]
+ weight_compressor.compress_weights(arch, nng, tens, npu_block_type, 16, 16, op.get_dilation_h_w())
+ # Alias compressed weights back into source tensor
+ src_tens.copy_compressed_weight_info(tens)
if verbose_tensor_format:
nng.print_passes_with_tensors()
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py
index 312e8f35..c41a7ebf 100644
--- a/ethosu/vela/tensor.py
+++ b/ethosu/vela/tensor.py
@@ -626,7 +626,7 @@ class Tensor:
for op in self.consumers():
if op.type == "DMA":
return op.outputs[0].find_npu_op()
- if "npu_block_type" in op.attrs:
+ if op.run_on_npu:
return op
return None
diff --git a/ethosu/vela/weight_compressor.py b/ethosu/vela/weight_compressor.py
index 45427a1a..a275e412 100644
--- a/ethosu/vela/weight_compressor.py
+++ b/ethosu/vela/weight_compressor.py
@@ -507,6 +507,8 @@ def update_pass_weight_and_scale_tensors(nng, arch):
tens = ps.weight_tensor
if tens is not None:
op = tens.find_npu_op()
+ if op is None:
+ continue
npu_usage_of_tensor = op.attrs["npu_block_type"]
needs_dma = tens.needs_dma()
if ps.cascade.strategy == SchedulingStrategy.WeightStream and needs_dma: