From 2b232a42774c8621d51434f42114b420fe05405c Mon Sep 17 00:00:00 2001 From: "B, Siva Rama Krishna Reddy" Date: Sat, 26 Oct 2024 07:11:09 +0530 Subject: [PATCH 1/2] Bug fix (#90) Multiple sub graphs of same BYOC is possible. Append them to the same dump file and also ignore any errors while dump. Co-authored-by: Siva --- python/tvm/driver/tvmc/compiler.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/python/tvm/driver/tvmc/compiler.py b/python/tvm/driver/tvmc/compiler.py index 09ba8909e3e7..d50b7fd22ab4 100644 --- a/python/tvm/driver/tvmc/compiler.py +++ b/python/tvm/driver/tvmc/compiler.py @@ -470,9 +470,19 @@ def compile_model( lib = graph_module.lib if use_vm else graph_module.get_lib() # TODO lib.get_source call have inconsistent behavior for unsupported # formats (@leandron). - dumps[source_type] = lib.get_source(source_type) + try: + dumps[source_type] = lib.get_source(source_type) + except tvm.TVMError: + pass for smod in lib.imported_modules: - dumps[smod.type_key] = smod.get_source() + try: + if smod.type_key not in dumps: + dumps[smod.type_key] = "" + else: + dumps[smod.type_key] += "\n" + dumps[smod.type_key] += smod.get_source() + except tvm.TVMError: + pass # Create a new tvmc model package object from the graph definition. package_path = tvmc_model.export_package( From cc8dd6afc0db031cb02c61951af2cf2995fe75e9 Mon Sep 17 00:00:00 2001 From: "B, Siva Rama Krishna Reddy" Date: Tue, 3 Dec 2024 13:54:16 +0530 Subject: [PATCH 2/2] Review comments. --- python/tvm/driver/tvmc/compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tvm/driver/tvmc/compiler.py b/python/tvm/driver/tvmc/compiler.py index d50b7fd22ab4..2f573344463c 100644 --- a/python/tvm/driver/tvmc/compiler.py +++ b/python/tvm/driver/tvmc/compiler.py @@ -482,7 +482,7 @@ def compile_model( dumps[smod.type_key] += "\n" dumps[smod.type_key] += smod.get_source() except tvm.TVMError: - pass + print(f"Imported module {smod.type_key} doesn't support source dump") # Create a new tvmc model package object from the graph definition. package_path = tvmc_model.export_package(