aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/compiler_driver.py
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2020-11-09 16:46:37 +0000
committerTim Hall <tim.hall@arm.com>2020-11-11 11:38:41 +0000
commite6ccd87a2f40877cacdd9721a5116a6853dfe573 (patch)
tree8e22dacc02e82df59cb460b68d39e5fd338abf4d /ethosu/vela/compiler_driver.py
parente168b969dc75fc3057413a80fdf0e164ab936910 (diff)
downloadethos-u-vela-e6ccd87a2f40877cacdd9721a5116a6853dfe573.tar.gz
MLBEDSW-3019: Add profiling debug database
- Added mechanism to track input to output graph transforms for debugging the resultant command stream. - Provides base implementation for MLBEDSW-2661 Signed-off-by: Tim Hall <tim.hall@arm.com> Change-Id: I2dfe8a409fbde7ad0282bfab5acb11ba1c8b82d8
Diffstat (limited to 'ethosu/vela/compiler_driver.py')
-rw-r--r--ethosu/vela/compiler_driver.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ethosu/vela/compiler_driver.py b/ethosu/vela/compiler_driver.py
index 9263305a..e089b708 100644
--- a/ethosu/vela/compiler_driver.py
+++ b/ethosu/vela/compiler_driver.py
@@ -31,10 +31,13 @@ from . import register_command_stream_generator
from . import scheduler
from . import tensor_allocation
from . import weight_compressor
+from .debug_database import DebugDatabase
from .errors import VelaError
from .nn_graph import PassPlacement
from .nn_graph import TensorAllocator
+from .operation import Op
from .rewrite_graph import verify_graph_health
+from .rewrite_graph import visit_graph_post_order
from .tensor import MemType
from .tensor import Tensor
@@ -127,8 +130,18 @@ def next_sram_factor(alloc_results):
return ((lower + upper) / 2, True)
+def _record_operator(op, arch):
+ if op.type != Op.Const:
+ DebugDatabase.add_source(op)
+
+
def compiler_driver(nng, arch, options, scheduler_options):
assert verify_graph_health(nng)
+
+ # Pre-optimisation operator tracking
+ for sg in nng.subgraphs:
+ visit_graph_post_order(sg.output_tensors, arch, [], [_record_operator])
+
nng = graph_optimiser.optimise_graph_a(nng, arch, options.verbose_graph)
assert verify_graph_health(nng)