Skip to content

[Docs] Add tvm.s_tir.analysis API reference page#19353

Merged
tlopex merged 1 commit into
apache:mainfrom
tlopex:doc156
Apr 6, 2026
Merged

[Docs] Add tvm.s_tir.analysis API reference page#19353
tlopex merged 1 commit into
apache:mainfrom
tlopex:doc156

Conversation

@tlopex

@tlopex tlopex commented Apr 5, 2026

Copy link
Copy Markdown
Member

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to resolve ambiguous cross-references in the documentation by defining module type preferences, specifically mapping 'tvm.s_tir' to 'tvm.tirx'. It also adds the 'tvm.s_tir.analysis' module to the Python API documentation. A review comment suggests refining the module prefix matching logic in 'docs/conf.py' to ensure that only intended modules and their sub-modules are matched, preventing potential false positives with similarly named modules.

Comment thread docs/conf.py
Comment on lines +734 to +735
if modname.startswith(prefix):
preferred = [m for m in matches if m[0].startswith(preferred_mod + ".")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The startswith checks on modname and m[0] are a bit too broad and could match modules that share a prefix but are not sub-modules (e.g., tvm.s_tir_extra would match tvm.s_tir). It's safer to check for an exact match or a trailing dot to ensure it only applies to the intended module and its sub-modules.

Suggested change
if modname.startswith(prefix):
preferred = [m for m in matches if m[0].startswith(preferred_mod + ".")]
if modname == prefix or modname.startswith(prefix + "."):
preferred = [m for m in matches if m[0] == preferred_mod or m[0].startswith(preferred_mod + ".")]

@tlopex tlopex merged commit 491480d into apache:main Apr 6, 2026
10 checks passed
Aharrypotter pushed a commit to Aharrypotter/tvm that referenced this pull request Apr 10, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants