tvm.script.printer

tvm.script.printer#

tvm.script.printer#

TVMScript Unified Printer This package provides a set of APIs to print supported TVM IR into TVMScript in a roundtrippable way.

class tvm.script.printer.PrinterConfig(*, name: str | None = None, show_meta: bool = False, ir_prefix: str = 'I', module_alias: str = 'cls', buffer_dtype: str = 'float32', int_dtype: str = 'int32', float_dtype: str = 'void', verbose_expr: bool = False, indent_spaces: int = 4, print_line_numbers: bool = False, num_context_lines: int | None = None, show_all_ty: bool = True, extra_config: dict | None = None, path_to_underline: list[AccessPath] | None = None, path_to_annotate: dict[AccessPath, str] | None = None, obj_to_underline: list[Object] | None = None, obj_to_annotate: dict[Object, str] | None = None)#

Configuration of TVMScript printer.

The int_dtype and float_dtype arguments populate the string-valued ir.int_dtype and ir.float_dtype entries in extra_config. Explicit entries in extra_config override those arguments.

tirx.scalar_buffer_as_mutable_var in extra_config defaults to true. It prints eligible local scalar buffers as typed mutable variables. Set it to false to retain explicit buffer allocations and indexed loads/stores.