Repository navigation
Conversation
…tion The standalone TIRx extraction (apache#20803, apache#20831) removed the in-tree `tvm.script` and `tvm.tirx` Python modules, but documentation still referenced the removed paths. Update all occurrences under docs/ and example_npu's README to the spellings that tests and the migrated Python tutorials already use: - `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` -> `from tvm_tirx.script import tirx as T` - `@tvm.script.ir_module` -> `@I.ir_module` (with the `ir` import added) - engine APIs (`parse`, `from_source`, `register_dialect`, `parser`) -> same names under `tvm_tirx.script` - `tvm.tirx.compile/layout/transform/Var/Add` -> `tvm_tirx.tirx.*` - docs/tirx/install.rst: the TIRx compiler now ships as the `apache-tvm-tirx` dependency; update the verify command accordingly - docs/reference/api/python: fix the toctree caption to `tvm_tirx.script` (the autosummary pages already document `tvm_tirx.script`) - also fix the example in docs/arch/relax_vm.rst that used `R` without importing it The printer's provenance comments (`# from tvm.script import ...`) inside printed TVMScript output are intentionally left untouched; they are non-executing comments. Fixes apache#20928
Second pass found more pre-extraction module paths that no longer
resolve in the parent tree; the same replacement policy applies:
- `tvm.ir.*` -> `tvm_tirx.ir.*` (transform passes, PassContext,
assert_structural_equal, Call/Range/Stmt, register_op_attr, ir.type)
- `tvm.target.*` -> `tvm_tirx.target.*` (Target, target.tag)
- `tvm.IRModule` -> `tvm_tirx.IRModule`
- `tvm.backend.*` / `tvm.codegen` -> `tvm_tirx.backend` / `tvm_tirx.codegen`
- `tvm.runtime.{tensor,Tensor,empty,Device,load_module}` ->
`tvm_tirx.runtime.*` (the parent `tvm.runtime` only exports
benchmarking, vm and disco)
- device constructors `tvm.cuda()/cpu()/metal()/vulkan()` ->
`tvm_tirx.*` (from_source.rst device checks updated accordingly)
- add `import tvm_tirx` to example headers that now reference the
package, fixing NameErrors the first pass would have introduced in
the tile_ops execution blocks
- from_source.rst: fix the stale `tvm.base._LOADED_LIBS['tvm_runtime']`
key to `tvm_runtime_extra`
The two historical "separate ``tvm.tir`` object model" mentions in
docs/tirx/{overview,arch/lowering_pipeline}.rst are deliberately left
unchanged: they contrast TIRx with the legacy TVM object model and are
not live API references.
Refs apache#20928
…ng imports Address the four review findings on the previous two commits: - layout.rst: `tmem_datapath_layout` lives in `tvm_tirx.backend.cuda.layout`, not `tvm_tirx.tirx.layout` (which the first pass produced mechanically and would raise ImportError); tcgen05_ld_st.rst already used the correct path - arch/index.rst: the type annotations on the runtime examples were accidentally lowercased to `tvm_tirx.runtime.tensor` by a case-insensitive bulk replace (PowerShell -replace); restore the `Tensor` class name, and add the missing `import tvm_tirx` to both runnable examples - relax_vm.rst: the serialization example referenced `relax.VirtualMachine` after the first pass removed `from tvm import relax` from the preceding example; import `VirtualMachine` explicitly (matching the style of the neighboring block), and add `import tvm_tirx` to the later usage block - export_and_load_executable.py: the `run_mlp.py` standalone-script example used `tvm_tirx.*` without importing it; add the import to the script header Refs apache#20928
|
Thanks for the review — all four findings are valid and are addressed in 43bfd6d:
|
Description
Fixes #20928.
After the standalone TIRx extraction (#20803, #20831), many Python module paths moved from the parent
tvm.*namespace into thetvm_tirx.*package, but documentation still referenced the removed paths, so executable doc examples fail withModuleNotFoundError/AttributeError. The Python tutorials (e.g.docs/deep_dive/relax/tutorials/relax_creation.py) and the test suite were already migrated; this PR brings the.rstdocumentation and tutorial comments in line with the spellings they use.Replacements
from tvm.script import relax as Rfrom tvm.relax import script as Rfrom tvm.script import s_tir as Tsfrom tvm.s_tir import script as Tsfrom tvm.script import ir as Ifrom tvm_tirx.script import ir as Ifrom tvm.script import tirx as T/Txfrom tvm_tirx.script import tirx as T/Tx@tvm.script.ir_module@I.ir_module(with theirimport added)tvm.script.parse/from_source/register_dialect/parsertvm_tirx.scripttvm.tirx.compile/.layout/transform/Var/Addtvm_tirx.tirx.*tvm.ir.transform.*(PassContext, Sequential, instruments)tvm_tirx.ir.transform.*tvm.ir.{Call,Range,Stmt,register_op_attr,assert_structural_equal}tvm_tirx.irfrom tvm.ir.type import ...from tvm_tirx.ir.type import ...tvm.target.Target/tvm.target.tag.*tvm_tirx.target.*tvm.IRModuletvm_tirx.IRModuletvm.backend.*/tvm.codegentvm_tirx.backend/tvm_tirx.codegentvm.runtime.{tensor,Tensor,empty,Device,load_module}tvm_tirx.runtime.*(parenttvm.runtimeonly exports benchmarking/vm/disco)tvm.cuda()/cpu()/metal()/vulkan()tvm_tirx.*(incl.from_source.rstdevice checks)import tvm, tvm.tirx(install verify command)import tvm, tvm_tirx.tirxAlso:
import tvm_tirxto example headers that now reference the package (tile_ops execution blocks, the CUDA tutorials,relax_vm.rst)tvm.base._LOADED_LIBS['tvm_runtime']key infrom_source.rsttotvm_runtime_extra(the key defined inpython/tvm/base.py)docs/arch/relax_vm.rstexample, which usedRwithout importing itdocs/reference/api/python/index.rst: the toctree caption is fixed totvm_tirx.script(the autosummary pages it links to already documenttvm_tirx.script)Deliberately left unchanged
# from tvm.script import ...) inside printed output: they are non-executing comments and test expectations rely on them.tvm.tirobject model" mentions indocs/tirx/overview.rstanddocs/tirx/arch/lowering_pipeline.rst: they contrast TIRx with the legacy TVM object model and are not live API references.docs/arch/index.rstprose that describes source folders (tvm/node,tvm/ir) — those sections describe the pre-extraction tree structure and deserve a dedicated rewrite; tracked in Docs reference nonexistent tvm.script / tvm.tirx paths after standalone TIRx extraction #20928.Checklist
[DOCS]per the commit tag conventionruff check/ruff format/ whitespace hooks pass on all changed files (thecheck-asf-headerhook raises a GBKUnicodeDecodeErroron this Windows machine on pre-existing UTF-8 content and fails identically on unmodified files — a local locale artifact, not introduced by this change)