From 64fe43e5709ed0f77abda645c2429440143c5906 Mon Sep 17 00:00:00 2001 From: Siva Date: Sun, 26 Jan 2025 12:44:42 +0530 Subject: [PATCH] [TVMC] Bug fix Multiple sub graphs of same BYOC is possible. Append them to the same dump file and also ignore any errors while dump. --- 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 43c53e8859ad..24f680efefd7 100644 --- a/python/tvm/driver/tvmc/compiler.py +++ b/python/tvm/driver/tvmc/compiler.py @@ -469,9 +469,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: + 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(