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

tlopex 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 491480d4db [Docs] Add tvm.s_tir.analysis API reference page (#19353)
491480d4db is described below

commit 491480d4db14444189a230d91cea747453be70e9
Author: Shushi Hong <[email protected]>
AuthorDate: Mon Apr 6 09:51:19 2026 -0400

    [Docs] Add tvm.s_tir.analysis API reference page (#19353)
    
    This PR adds the API reference documentation for `tvm.s_tir.analysis`.
    
    `tvm.s_tir.analysis` functions use Var in their type annotations, which
    exists in both `tvm.tirx` and `tvm.relax`. The existing disambiguator
    uses common module prefix to pick the right one, but `tvm.s_tir` shares
    no prefix with either. The new `tvm_module_type_preference` mapping
    tells the disambiguator to prefer `tvm.tirx` types for `tvm.s_tir.*`
    modules.
---
 docs/conf.py                                 | 15 +++++++++++++++
 docs/reference/api/python/index.rst          |  1 +
 docs/reference/api/python/s_tir/analysis.rst | 21 +++++++++++++++++++++
 3 files changed, 37 insertions(+)

diff --git a/docs/conf.py b/docs/conf.py
index 182e799ef5..5e9762355f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -611,6 +611,13 @@ tvm_class_name_rewrite_map = {
     "tvm.relax.frontend.nn": ["Module"],
 }
 
+# When documenting modules under these prefixes, prefer types from the mapped 
module
+# to resolve ambiguous cross-references (e.g. Var exists in both tvm.tirx and 
tvm.relax).
+tvm_module_type_preference = {
+    "tvm.s_tir": "tvm.tirx",
+}
+
+
 def distinguish_class_name(name: str, lines: list[str]):
     """Distinguish the docstring of type annotations.
 
@@ -721,6 +728,14 @@ def _patch_python_domain_find_obj():
                 if len(best_matches) == 1:
                     return best_matches
 
+            # Check module type preference for cross-module resolution
+            # (e.g. tvm.s_tir.analysis uses types from tvm.tirx).
+            for prefix, preferred_mod in tvm_module_type_preference.items():
+                if modname.startswith(prefix):
+                    preferred = [m for m in matches if 
m[0].startswith(preferred_mod + ".")]
+                    if len(preferred) >= 1:
+                        return preferred[:1]
+
         return matches
 
     _dedup_find_obj._tvm_patched = True
diff --git a/docs/reference/api/python/index.rst 
b/docs/reference/api/python/index.rst
index dec8167a1a..f252d417df 100644
--- a/docs/reference/api/python/index.rst
+++ b/docs/reference/api/python/index.rst
@@ -62,6 +62,7 @@ Python API
     :maxdepth: 1
     :caption: tvm.s_tir
 
+    s_tir/analysis
     s_tir/schedule
     s_tir/transform
     s_tir/dlight
diff --git a/docs/reference/api/python/s_tir/analysis.rst 
b/docs/reference/api/python/s_tir/analysis.rst
new file mode 100644
index 0000000000..dafbd92947
--- /dev/null
+++ b/docs/reference/api/python/s_tir/analysis.rst
@@ -0,0 +1,21 @@
+..  Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+..    http://www.apache.org/licenses/LICENSE-2.0
+
+..  Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+tvm.s_tir.analysis
+------------------
+.. automodule:: tvm.s_tir.analysis
+    :members:

Reply via email to