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

lukhut 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 cde83e1088 [TVMC] enable dumping imported modules too (#15779)
cde83e1088 is described below

commit cde83e108880f96bc5df58a8e92c02a9aeff26a6
Author: Siva <[email protected]>
AuthorDate: Mon Sep 25 21:26:45 2023 +0530

    [TVMC] enable dumping imported modules too (#15779)
    
    Now we can dump the imported modules source too like device code.
---
 python/tvm/driver/tvmc/compiler.py        | 2 ++
 tests/python/driver/tvmc/test_compiler.py | 1 +
 2 files changed, 3 insertions(+)

diff --git a/python/tvm/driver/tvmc/compiler.py 
b/python/tvm/driver/tvmc/compiler.py
index 3496136470..4273674180 100644
--- a/python/tvm/driver/tvmc/compiler.py
+++ b/python/tvm/driver/tvmc/compiler.py
@@ -445,6 +445,8 @@ def compile_model(
                 # TODO lib.get_source call have inconsistent behavior for 
unsupported
                 #      formats (@leandron).
                 dumps[source_type] = lib.get_source(source_type)
+                for smod in lib.imported_modules:
+                    dumps[smod.type_key] = smod.get_source()
 
         # Create a new tvmc model package object from the graph definition.
         package_path = tvmc_model.export_package(
diff --git a/tests/python/driver/tvmc/test_compiler.py 
b/tests/python/driver/tvmc/test_compiler.py
index 6165099558..ca56172cb7 100644
--- a/tests/python/driver/tvmc/test_compiler.py
+++ b/tests/python/driver/tvmc/test_compiler.py
@@ -798,6 +798,7 @@ def test_compile_opencl(tflite_mobilenet_v1_0_25_128):
     assert type(tvmc_package.lib_path) is str
     assert type(tvmc_package.params) is bytearray
     assert os.path.exists(dumps_path)
+    assert path.exists("{}.{}".format(tvmc_package.package_path, "opencl"))
 
 
 @tvm.testing.requires_cmsisnn

Reply via email to