tvm_tirx.ir.RegionStmt#
- class tvm_tirx.ir.RegionStmt(op, args, body_params, attrs, body, result_vars=None, loc=UNKNOWN_LOC)#
Bases:
StmtAn operation with enclosing-scope operands and one lexical body.
body_paramsdefine variables visible only withinbody. Their count and types must match the operation’s requiredFRegionGetBodyParamshook. Zero-parameter regions register an empty-return hook; operations without a hook do not support region construction. Explicit parameter identities and their references inbodyare preserved.result_varsdefine variables after the region in the enclosing sequence. Attributes are evaluated outside the body-parameter scope. Direct construction and JSON serialization support result variables; structured script syntax currently supports only result-free regions.- Parameters:
op (Op or str) – Registered region operator or its name.
args (sequence[Expr]) – Operands evaluated in the enclosing scope.
body_params (sequence[Var]) – Variables bound for the body according to the operator’s contract.
attrs (DictAttrs or Mapping or None) – Operator-specific attributes; None gives an empty map.
body (Stmt or Sequence[Stmt]) – Region body, normalized to SeqStmt.
result_vars (sequence[Var], optional) – Variables defined for subsequent statements, empty by default.
loc (Location, optional) – The source location of the region.
- property op#
- property args#
- property body_params#
- property attrs#
- property body#
- property result_vars#
- RegionStmt.script(*, name=None, show_meta=False, int_dtype='int32', float_dtype='void', verbose_expr=False, indent_spaces=4, print_line_numbers=False, num_context_lines=-1, path_to_underline=None, path_to_annotate=None, obj_to_underline=None, obj_to_annotate=None, extra_config=None)#
Print TVM IR into TVMScript text format
- Parameters:
name (Optional[str] = None) – The name of the object
show_meta (bool = False) – Whether to print the meta data of the object
int_dtype (str = "int32") – The default data type of integer
float_dtype (str = "void") – The default data type of float
verbose_expr (bool = False) – Whether to print the detailed definition of each variable in the expression
indent_spaces (int = 4) – The number of spaces for indentation
print_line_numbers (bool = False) – Whether to print line numbers
num_context_lines (int = -1) – The number of lines of context to print before and after the line to underline.
path_to_underline (Optional[List[AccessPath]] = None) – Object path to be underlined
path_to_annotate (Optional[Dict[AccessPath, str]] = None) – Object path to be annotated
obj_to_underline (Optional[List[tvm_ffi.Object]] = None) – Object to be underlined
obj_to_annotate (Optional[Dict[tvm_ffi.Object, str]] = None) – Object to be annotated
extra_config (Optional[dict] = None) – Dialect-specific configuration passed through to PrinterConfig.extra_config, including
ir.prefixfor the IR namespace alias (default"I"). Keys are conventionally namespaced as “<dialect>.<knob>”, e.g.{"tirx.prefix": "T"}.
- Returns:
script (str) – The TVM Script of the given TVM IR
- Return type:
str
- RegionStmt.show(style=None, *, name=None, show_meta=False, int_dtype='int32', float_dtype='void', verbose_expr=False, indent_spaces=4, print_line_numbers=False, num_context_lines=-1, path_to_underline=None, path_to_annotate=None, obj_to_underline=None, obj_to_annotate=None, extra_config=None)#
Print highlighted TVMScript.
- Parameters:
style (str, optional) – Pygmentize printing style, auto-detected if None. See tvm_tirx.script.printer.highlight.cprint for more details.
name (Optional[str] = None) – The name of the object
show_meta (bool = False) – Whether to print the meta data of the object
int_dtype (str = "int32") – The default data type of integer
float_dtype (str = "void") – The default data type of float
verbose_expr (bool = False) – Whether to print the detailed definition of each variable in the expression
indent_spaces (int = 4) – The number of spaces for indentation
print_line_numbers (bool = False) – Whether to print line numbers
num_context_lines (int = -1) – The number of lines of context to print before and after the line to underline.
path_to_underline (Optional[List[AccessPath]] = None) – Object path to be underlined
path_to_annotate (Optional[Dict[AccessPath, str]] = None) – Object path to be annotated
obj_to_underline (Optional[List[tvm_ffi.Object]] = None) – Object to be underlined
obj_to_annotate (Optional[Dict[tvm_ffi.Object, str]] = None) – Object to be annotated
extra_config (Optional[dict] = None) – Dialect-specific configuration passed through to PrinterConfig.extra_config, including
ir.prefixfor the IR namespace alias (default"I").
- Return type:
None