You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2026/10/01 12:16:27 UTC

(tvm) 03/03: [FIX][Script] Reserve configured module names before metadata names

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

tqchen pushed a commit to branch tqchen/printer-doc-translation
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 3d73d4524d3342d8a06e54b7e098fc178a8d0bc9
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Thu Oct 1 03:58:05 2026 +0000

    [FIX][Script] Reserve configured module names before metadata names
---
 src/script/printer/doc_translator.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/script/printer/doc_translator.cc b/src/script/printer/doc_translator.cc
index 8fbeef3e12..b28fdca671 100644
--- a/src/script/printer/doc_translator.cc
+++ b/src/script/printer/doc_translator.cc
@@ -157,6 +157,12 @@ details::TranslationResult TranslateComplete(ffi::AnyView obj, TranslationEngine
       engine->AllocId(value.cast<ffi::String>());
   }
   for (const ffi::String& name : binding_names) engine->AllocId(name);
+  if (binding_names.empty()) {
+    if (auto name = engine->GetExtraConfig<ffi::Optional<ffi::String>>("script.module_name",
+                                                                       std::nullopt)) {
+      engine->AllocId(name.value());
+    }
+  }
   // Allocate generated names after all configured names. A dialect or module
   // named tvm/metadata must not shadow the loader or metadata registry.
   IdDoc metadata_id = engine->AllocId("metadata");