Repository navigation
Description
Summary
After #20803 ([REFACTOR] Consume standalone TIRx as a pinned dependency) and
#20831 ([REFACTOR] Bump TIRx and migrate object and constraint APIs), the
in-tree Python layout no longer provides tvm.script.* or tvm.tirx.*.
However, 80+ references to these paths remain under docs/ and one bundled
README, and the executable examples that teach them now fail with
ModuleNotFoundError.
The Python tutorials under docs/deep_dive/*/tutorials/*.py were already
migrated to the new spellings (e.g. docs/deep_dive/relax/tutorials/relax_creation.py),
so only the .rst documentation and one README still teach the removed paths.
What actually works on current main
Taken from test files (e.g. tests/python/driver/test_compile.py,
tests/python/disco/test_session.py) and the migrated tutorials:
from tvm.relax import script as R # Relax dialect
from tvm.s_tir import script as Ts # s_tir dialect
from tvm_tirx.script import ir as I # shared IR namespace
from tvm_tirx.script import tirx as T # TIRx kernel dialect@tvm.script.ir_module becomes @I.ir_module or @tvm_tirx.script.ir_module
(both are used in tests). Kernel-side APIs live under the standalone package:
compiled = tvm_tirx.tirx.compile(kernel, target="cuda", pipeline="tirx")
from tvm_tirx.tirx.layout import S, TileLayout
from tvm_tirx.tirx import transformWhy the old paths are gone
python/tvm/contains noscript/ortirx/subpackage, and a repo-wide
grep finds nosys.modules["tvm.script"]/"tvm.tirx"binding or
import_module("tvm...")shim in eitherpython/tvm/or
3rdparty/tvm-tirx/python/.- The TVMScript engine now lives in
tvm_tirx.script(standalone repo).
Parent dialects register into it at import time
(tvm_tirx.script.register_dialect("relax", "tvm.relax.script", ...),
("s_tir", "tvm.s_tir.script"),("tirx", "tvm_tirx.tirx.script")), so the
old top-leveltvm.scriptfacade has no implementation anymore. from tvm.script import ...therefore fails with
ModuleNotFoundError: No module named 'tvm.script'.
Inventory (80+ references)
from tvm.script import ... — 40 lines:
docs/arch/tvmscript.rst(1 code block + 2 prose mentions)docs/deep_dive/relax/abstraction.rst(1),dpl.rst(2),learning.rst(4)docs/deep_dive/tensor_ir/abstraction.rst(2),index.rst(1 prose),
learning.rst(2)docs/tirx/overview.rst,native_basics.rst(2),programming/index.rst,
api/tile.rst(prose),native_basics/cuda/first_kernel.rst,
native_basics/cuda/profiling.rst- 19 files under
docs/tirx/tile_ops/ python/tvm/relax/backend/contrib/example_npu/README.md(1)
@tvm.script.ir_module decorator — 3 lines:
docs/arch/relax_vm.rst:74, docs/deep_dive/tensor_ir/learning.rst:65,240.
Engine API references in docs/arch/tvmscript.rst — 6 lines:
tvm.script.parser, tvm.script.parse, tvm.script.from_source (x2),
tvm.script.parser.protocol_registry, tvm.script.register_dialect.
tvm.tirx.* — 32 lines:
docs/install/pypi.rst("including modules such astvm.tirx")docs/tirx/install.rst(3, incl. the verify snippet
python -c "import tvm, tvm.tirx; print(tvm.__version__)")docs/tirx/arch/backends.rst,arch/lowering_pipeline.rst,
api/tile_dispatch.rst(2),docs/tirx/layout.rstdocs/arch/index.rst(2:tvm.tirx.Var,tvm.tirx.Add)docs/tirx/overview.rst("tvm.script.tirxis the construction syntax for
thetvm.tirxobject")tvm.tirx.compile(...)in 12docs/tirx/tile_ops/*.rstfilesfrom tvm.tirx.layout import ...in 7docs/tirx/tile_ops/*.rstfiles
Plus docs/reference/api/python/index.rst:73 still has a
:caption: tvm.script toctree, although the autosummary pages it points to
(docs/reference/api/python/script/*.rst) already document tvm_tirx.script.
Repro for the inventory:
grep -rEn "tvm\.script|tvm\.tirx" docs python --include="*.rst" --include="*.md" --include="*.py"Suggested resolution — direction A: update the docs
The migrated .py tutorials already establish the target spellings:
| Stale spelling | Working spelling on current main |
|---|---|
from tvm.script import relax as R |
from tvm.relax import script as R |
from tvm.script import s_tir as Ts |
from tvm.s_tir import script as Ts |
from tvm.script import ir as I |
from tvm_tirx.script import ir as I |
from tvm.script import tirx as T / Tx |
from tvm_tirx.script import tirx as T |
@tvm.script.ir_module |
@I.ir_module / @tvm_tirx.script.ir_module |
tvm.script.parse / from_source / register_dialect / parser |
same under tvm_tirx.script |
tvm.tirx.compile(...) |
tvm_tirx.tirx.compile(...) |
from tvm.tirx.layout import ... |
from tvm_tirx.tirx.layout import ... |
from tvm.tirx import transform |
from tvm_tirx.tirx import transform |
tvm.tirx.Var / tvm.tirx.Add |
tvm_tirx.tirx.Var / tvm_tirx.tirx.Add |
import tvm, tvm.tirx (install.rst verify) |
import tvm, tvm_tirx.tirx |
Possible direction B: restore a compatibility facade
Some evidence suggests these spellings may have been intended to keep working:
- Comments in
3rdparty/tvm-tirx/python/tvm_tirx/__init__.pystill speak the
embedded naming ("# tvm.script— must be imported before any dialect
package so thattvm.script.register_dialectis reachable ...",
"# tvm.tirx— registers itself viatvm.script.register_dialect"), which
reads as iftvm.script/tvm.tirxbindings are expected to exist. docs/tirx/install.rstsays "the TIRx compiler is thetvm.tirxmodule".
That statement is true for the currently published 0.27 wheel (pre-extraction
vendored layout) but false for wheels built from this tree, so the doc was
not wrong when written — the layout changed under it.
If a tvm.script / tvm.tirx facade is planned, this issue can track it;
otherwise I will send a docs-only PR per direction A.
Notes for whoever does the sweep
- TVMScript printer provenance headers (
# from tvm.script import ...) are
comments emitted inside printed output; they never execute and are fine to
keep as-is. Do not bulk-rewrite round-trip output blocks (none were found
underdocs/; they do appear in test expectations, which are correct). docs/tirx/api/cuda.rstandapi/ptx.rstalready use the standalone
spelling (from tvm_tirx.script import tirx as Tx), so the tree currently
mixes both spellings for the same thing.- The stale comments in
tvm_tirx/__init__.pymay be worth updating in the
standalone repo as a follow-up.
Activity
[DOCS] Replace remaining stale module paths after TIRx extraction
erhsh commentedon Nov 7, 2026
While preparing #20929, a self-review found the stale-path problem is wider than the
tvm.script/tvm.tirxclasses originally inventoried here. The same extraction also moved:tvm.ir.*->tvm_tirx.ir.*(transformpasses,PassContext,assert_structural_equal,Call/Range/Stmt,register_op_attr,ir.type) — e.g.docs/arch/pass_infra.rst(7 refs),docs/tirx/api/tile_dispatch.rst(5)tvm.target.*->tvm_tirx.target.*(Target,target.tag) — 14 refs incl.docs/arch/relax_vm.rst,docs/tirx/install.rstverify command, the CUDA tutorialstvm.IRModule->tvm_tirx.IRModule— 7 refstvm.backend.*/tvm.codegen->tvm_tirx.backend/tvm_tirx.codegen— 10 refstvm.runtime.{tensor,Tensor,empty,Device,load_module}->tvm_tirx.runtime.*— the parenttvm.runtimepackage now only exportsBenchmarkResult/time_evaluator/vm/disco— ~40 refs acrosstile_ops,native_basics/cuda, tutorialstvm.cuda()/cpu()/metal()/vulkan()->tvm_tirx.*— 13 refs incl. the device-detection snippet indocs/install/from_source.rstAll of the above are covered by the second commit of #20929 (same mechanical policy; canonical spellings verified against live test code, e.g.
tests/python/driver/test_compile.pyusestvm_tirx.target.Target("llvm")andtvm_tirx.ir.assert_structural_equal).Intentionally not changed in #20929:
tvm.tirobject model" mentions (docs/tirx/overview.rst:115,docs/tirx/arch/lowering_pipeline.rst:155) — they contrast TIRx with the legacy TVM object model; not live API references. Could optionally be reworded to name the legacy model explicitly.docs/arch/index.rststill contains prose that tours the old source tree layout ("Thetvm/irfolder contains...", "tvm/node", "tvm/target" sections). Those modules/folders now live in thetvm-tirxsubmodule, so the whole "Source Tree Structure" narrative deserves a dedicated rewrite rather than mechanical replacement — leaving it as a tracked follow-up here.[DOCS] Address review: fix wrong import path, type annotations, missi…