tvm_tirx.ir.Call#

class tvm_tirx.ir.Call(op, args, attrs=None, ty_args=None, loc=UNKNOWN_LOC, *, ty=None)#

Bases: _CallableExprWithOp

Call a registered operator or another callable IR expression.

Omitted or None keyword-only ty uses available result inference, or a missing type when no deduction is available. Explicit types, including Type.missing(), are preserved exactly. Inference errors propagate. Construction permits provisional IR; validate() checks the operator contract explicitly after inputs are ready. Constructing a Call never emits a builder statement, including calls to allocation operators.

For an Op callee, a registered fixed return type takes precedence over its type-inference callback. For another callee with a FuncType, inference uses the signature’s return type. Without an applicable rule, the result is MissingType. An explicit ty, including MissingType, bypasses inference.

Parameters:
  • op (Expr or str) – The callee expression, or a registered operator name resolved by Op.get.

  • args (sequence[Expr]) – Positional value arguments.

  • attrs (Attrs or dict, optional) – Operator-specific attributes. A dictionary becomes DictAttrs.

  • ty_args (sequence[Type], optional) – Explicit type arguments, empty by default.

  • loc (Location, optional) – The source location of the call.

  • ty (Type or str, optional) – Keyword-only result type; a primitive dtype string is accepted.

property op#
property args#
property attrs#
property ty_args#
validate()#

Run the registered operator’s validator without changing this Call.

An Op callee with a validator invokes that validator; other callees and operators without validators perform no checks. Success returns None, and failed checks raise a diagnostic exception. The checks depend on the registered validator and do not generally establish agreement between the stored result type and the type implied by the inputs.

Return type:

None

Call.expr_ty()#

Return this expression’s primitive result type.

Call.equal(other, loc=UNKNOWN_LOC)#
Parameters:

loc (Location)

Call.astype(dtype, loc=UNKNOWN_LOC)#
Parameters:

loc (Location)

Call.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.prefix for 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

Call.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.prefix for the IR namespace alias (default "I").

Return type:

None

CallEffectKind#

class tvm_tirx.ir.CallEffectKind(*values)#

Bases: IntEnum

Possible call effects, matching the shared C++ IR effect kinds.

ExprAnnotation = 0#
Pure = 1#
ReadState = 2#
UpdateState = 3#
Opaque = 3#
SpecialCallArg = 4#
EmbedInfo = 5#
ControlJump = 6#