Skip to content

Commit ab7fe75

Browse files
committed
finish1:
1 parent 1d02ac3 commit ab7fe75

2 files changed

Lines changed: 595 additions & 0 deletions

File tree

docs/arch/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,26 @@ Developers can register new Ops as well as their additional attributes(e.g. whet
333333

334334
pass_infra
335335

336+
tvm/script (TVMScript)
337+
----------------------
338+
339+
TVMScript is a Python-based DSL for writing TVM IR. It allows users to define ``IRModule``\ s
340+
— containing both Relax functions and TIR ``PrimFunc``\ s — using familiar Python syntax with
341+
three import aliases: ``I`` (module-level), ``T`` (TIR), and ``R`` (Relax). Although TVMScript
342+
uses Python syntax, it is not executed by the Python interpreter — decorators like
343+
``@I.ir_module``, ``@T.prim_func``, and ``@R.function`` extract the Python AST and transform
344+
it into TVM IR through a parser and IR builder pipeline.
345+
346+
TVMScript also supports **roundtrip**: any ``IRModule`` can be printed back to TVMScript via
347+
``mod.script()`` and re-parsed to produce a structurally equivalent module. See
348+
:ref:`tvmscript-arch` for the full architecture documentation, including the parser dispatch
349+
mechanism, IR builder frame stack, printer pipeline, and syntax reference.
350+
351+
.. toctree::
352+
:maxdepth: 1
353+
354+
tvmscript
355+
336356

337357
tvm/target
338358
----------

0 commit comments

Comments
 (0)