aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/compiler_driver.py
diff options
context:
space:
mode:
authorwilisa01 <william.isaksson@arm.com>2023-02-08 09:56:14 +0000
committerFredrik Svedberg <fredrik.svedberg@arm.com>2023-02-15 15:25:25 +0000
commit46c9477ded912f26ddf0a761c728d23f7d616004 (patch)
tree52dfd6f42239da31a6c498795756779ae2ff150d /ethosu/vela/compiler_driver.py
parent16b5e5e2d79564c7bb82ce6750cb2aec205d6621 (diff)
downloadethos-u-vela-46c9477ded912f26ddf0a761c728d23f7d616004.tar.gz
MLBEDSW-7211: Convert fixup_asymmetric_weights to supported ops check
Changed default behaviour to place int8 ops with asymmetric quantization on cpu, and added an option to force symmetric quantization Change-Id: Ib9b717aaf61eae78833254ca3dfa745f4f253dc6 Signed-off-by: wilisa01 <william.isaksson@arm.com>
Diffstat (limited to 'ethosu/vela/compiler_driver.py')
-rw-r--r--ethosu/vela/compiler_driver.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ethosu/vela/compiler_driver.py b/ethosu/vela/compiler_driver.py
index 439b954a..d2892096 100644
--- a/ethosu/vela/compiler_driver.py
+++ b/ethosu/vela/compiler_driver.py
@@ -1,4 +1,4 @@
-# SPDX-FileCopyrightText: Copyright 2020-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -65,6 +65,7 @@ class CompilerOptions:
show_cpu_operations=False,
tensor_allocator=TensorAllocator.Greedy,
timing=False,
+ force_symmetric_int_weights=False,
output_dir="outputs",
cpu_tensor_alignment=Tensor.AllocationQuantum,
hillclimb_max_iterations=None,
@@ -84,6 +85,7 @@ class CompilerOptions:
self.show_cpu_operations = show_cpu_operations
self.tensor_allocator = tensor_allocator
self.timing = timing
+ self.force_symmetric_int_weights = force_symmetric_int_weights
self.output_dir = output_dir
self.cpu_tensor_alignment = cpu_tensor_alignment
self.hillclimb_max_iterations = hillclimb_max_iterations
@@ -157,7 +159,9 @@ def compiler_driver(nng, arch, options, scheduler_options, network_type, output_
for sg in nng.subgraphs:
visit_graph_post_order(sg.output_tensors, arch, [], [_record_operator])
- nng = graph_optimiser.optimise_graph(nng, arch, network_type, options.verbose_graph)
+ nng = graph_optimiser.optimise_graph(
+ nng, arch, network_type, options.verbose_graph, options.force_symmetric_int_weights
+ )
assert verify_graph_health(nng)
if options.verbose_quantization: