tvm.script.parser#
tvm.script.parser#
The parser subpackage of TVMScript.
Per-dialect parser submodules (tvm.script.parser.tirx, etc.) are
resolved lazily via tvm.script._DIALECT_REGISTRY. When a dialect
is accessed (e.g. tvm.script.parser.tirx), this subpackage’s
__getattr__ looks up the dialect in _DIALECT_REGISTRY and imports
<dialect_module_path>.parser (e.g. tvm.tirx.script.parser),
caching the result so subsequent accesses skip __getattr__.
The IR layer is foundational and is NOT registered as a dialect — its
parser lives as a real submodule tvm.script.parser.ir, with
ir_module re-exported at this level for convenience.
See tvm.script for a full description of the dialect resolution
mechanism, including the _DialectRedirectFinder that handles
deep statement-form imports.
- tvm.script.parser.parse(program: AST | Any | str, extra_vars: dict[str, Any] | None = None, check_well_formed: bool = True, s_tir: bool = False, absent_params: dict[str, None] | None = None) Any#
Register a method for a operand type, AST operator node and operand index.
- Parameters:
program (Union[doc.AST, Any, str]) – The TVMScript code to parse.
extra_vars (Dict[str, Any]) – The extra variable table for parsing.
check_well_formed (bool) – Whether to check well-formedness after parsing.
absent_params (Optional[Dict[str, None]]) – Function parameters removed by a compile-time specialization. The dialect-specific function parser decides how to bind these names.
- Returns:
func – The parsed TVMScript program.
- Return type:
Any
tvm.script.parser.ir#
The ir module parser
tvm.script.parser.relax#
Initial impl of relax parser for sugars
tvm.script.parser.tirx#
The tirx parser