Skip to content

Commit 92caa2f

Browse files
srkreddy1238tqchen
authored andcommitted
[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.
1 parent 09a0ea0 commit 92caa2f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

python/tvm/driver/tvmc/compiler.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,19 @@ def compile_model(
469469
lib = graph_module.lib if use_vm else graph_module.get_lib()
470470
# TODO lib.get_source call have inconsistent behavior for unsupported
471471
# formats (@leandron).
472-
dumps[source_type] = lib.get_source(source_type)
472+
try:
473+
dumps[source_type] = lib.get_source(source_type)
474+
except tvm.TVMError:
475+
pass
473476
for smod in lib.imported_modules:
474-
dumps[smod.type_key] = smod.get_source()
477+
try:
478+
if smod.type_key not in dumps:
479+
dumps[smod.type_key] = ""
480+
else:
481+
dumps[smod.type_key] += "\n"
482+
dumps[smod.type_key] += smod.get_source()
483+
except tvm.TVMError:
484+
print(f"Imported module {smod.type_key} doesn't support source dump")
475485

476486
# Create a new tvmc model package object from the graph definition.
477487
package_path = tvmc_model.export_package(

0 commit comments

Comments
 (0)