This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 92caa2f7e6 [TVMC] Bug fix
92caa2f7e6 is described below

commit 92caa2f7e66df14f85fe12c118668e02d6ac7497
Author: Siva <[email protected]>
AuthorDate: Sun Jan 26 12:44:42 2025 +0530

    [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 058ae62d18..0dbae47294 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(

Reply via email to