aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Xu <charles.xu@arm.com>2020-06-23 12:42:28 +0200
committerCharles Xu <charles.xu@arm.com>2020-07-02 09:38:12 +0200
commit04ce34c07cf7fcd0a8ddb29df6f59846862b24f2 (patch)
treef6e9e5aa5a6e01beb7058c9849f771fa52a75bff
parent5f47c0511d3fc6b54aba331b58c85c3970b61718 (diff)
downloadethos-u-vela-04ce34c07cf7fcd0a8ddb29df6f59846862b24f2.tar.gz
MLBEDSW-2340: Make the tensor address default None
Signed-off-by: Charles Xu <charles.xu@arm.com> Change-Id: I53d9d56acee57cff208dccb4822c1f1a461c416d
-rw-r--r--ethosu/vela/high_level_command_stream_generator.py2
-rw-r--r--ethosu/vela/live_range.py2
-rw-r--r--ethosu/vela/tensor.py4
-rw-r--r--ethosu/vela/tflite_writer.py2
4 files changed, 5 insertions, 5 deletions
diff --git a/ethosu/vela/high_level_command_stream_generator.py b/ethosu/vela/high_level_command_stream_generator.py
index d02fd85d..232a56c1 100644
--- a/ethosu/vela/high_level_command_stream_generator.py
+++ b/ethosu/vela/high_level_command_stream_generator.py
@@ -216,7 +216,7 @@ def generate_high_level_command_stream_for_pass(strat, passes, block_configs, id
if len(passes) == 1:
# no cascading, can just issue one big stripe
# but only if we've done allocation and OFM does not overlap IFM
- if ifm_tensor.address != -1 and ofm_tensor.address != -1:
+ if ifm_tensor.address is not None and ofm_tensor.address is not None:
if (
ifm_tensor.address + ifm_tensor.storage_size() <= ofm_tensor.address
or ofm_tensor.address + ofm_tensor.storage_size() <= ifm_tensor.address
diff --git a/ethosu/vela/live_range.py b/ethosu/vela/live_range.py
index 8fe3d571..fe00b622 100644
--- a/ethosu/vela/live_range.py
+++ b/ethosu/vela/live_range.py
@@ -85,7 +85,7 @@ class LiveRange:
def set_address(self, address):
# Set address of all unaddressed tensors in LiveRange
for tens in self.tensors:
- if tens.address == 0:
+ if tens.address is None:
addr = address
else:
# Limit to single tensor for the lr if the tensor address already assigned
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py
index eda21c9c..bc0597f6 100644
--- a/ethosu/vela/tensor.py
+++ b/ethosu/vela/tensor.py
@@ -291,7 +291,7 @@ class Tensor:
self.weight_compressed_offsets = []
self.storage_rounding_quantum = (1, 1, 1, 1)
self.brick_size = (1, 1, 1, 1)
- self.address = 0 # start address of tensor. will be filled in by tensor allocator
+ self.address = None # start address of tensor. will be filled in by tensor allocator
self.element_size_bytes = 0
# quantization parameters
@@ -323,7 +323,7 @@ class Tensor:
res.alignment = self.alignment
res.bandwidth_compression_scale = self.bandwidth_compression_scale
res.storage_rounding_quantum = self.storage_rounding_quantum
- res.address = 0
+ res.address = None
if self.quantization is not None:
res.quantization = self.quantization.clone()
diff --git a/ethosu/vela/tflite_writer.py b/ethosu/vela/tflite_writer.py
index 7e805e31..4aa23b5f 100644
--- a/ethosu/vela/tflite_writer.py
+++ b/ethosu/vela/tflite_writer.py
@@ -401,7 +401,7 @@ class TFLiteSerialiser:
# Ensure that the order of the offsets match the order of the tensors
for tens, idx in self.tensor_map.items():
# Set offsets for tensor allocated in Tensor Arena or in the scratch_fast area
- if tens.mem_type in set((MemType.Scratch, MemType.Scratch_fast)):
+ if tens.mem_type in set((MemType.Scratch, MemType.Scratch_fast)) and tens.address is not None:
offsets[idx] = np.int32(tens.address)
metadata_buffer = np.array([version, subgraph_idx, nbr_tensors] + offsets)