Skip to content

[Docs] Add TVMScript architecture documentation#19398

Merged
MasterJH5574 merged 1 commit intoapache:mainfrom
tlopex:doc224
Apr 13, 2026
Merged

[Docs] Add TVMScript architecture documentation#19398
MasterJH5574 merged 1 commit intoapache:mainfrom
tlopex:doc224

Conversation

@tlopex
Copy link
Copy Markdown
Member

@tlopex tlopex commented Apr 12, 2026

This PR adds architecture documentation for TVMScript, the Python-based DSL used to author and inspect TVM IR.
TVMScript is used throughout the codebase (deep dive tutorials, tests, examples) but previously had no documentation explaining its own design or syntax. Users could only learn TVMScript by reading examples in TIR/Relax tutorials. So this PR adds a doc for it.

Copy link
Copy Markdown
Contributor

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

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 adds a detailed architectural overview of TVMScript, including its parser, IR builder, and printer systems, along with syntax references for TIR and Relax. The review feedback suggests improving the documentation by correcting the R.call_dps_packed signature and standardizing the naming of TIR control flow constructs for better consistency.


- ``R.call_tir(func, args, out_sinfo)`` — call a TIR function
- ``R.call_packed(name, *args)`` — call a PackedFunc
- ``R.call_dps_packed(func, *args)`` — call using destination-passing style
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 signature for R.call_dps_packed should include out_sinfo to be consistent with the R.call_tir entry above and to accurately reflect the required arguments in Relax TVMScript.

Suggested change
- ``R.call_dps_packed(func, *args)`` — call using destination-passing style
- ``R.call_dps_packed(func, args, out_sinfo)`` — call using destination-passing style

- TIR ``If`` branch (PrimExpr condition) or static eval (Python bool)
- Relax ``If`` node (plain Python ``if cond:`` syntax)
* - ``while``
- ``T.While`` loop
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

In the TIR column, it is more accurate to refer to the construct as TIR While loop to match the naming convention used for TIR If branch in the same table, or use the actual builder function T.while_loop.

Suggested change
- ``T.While`` loop
- TIR While loop

@MasterJH5574 MasterJH5574 merged commit f9787d1 into apache:main Apr 13, 2026
10 checks passed
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