tvm_tirx

Module ir

Source
Expand description

The shared IR: expressions, statements, types, functions, modules and operators.

Laid out like python/tvm_tirx/ir/. Expr, Stmt and Type are the bases of the three node hierarchies, and IRModule holds the functions of a program. prim holds the primitive expressions and transform the pass infrastructure.

Re-exports§

Modules§

  • Attributes attached to calls, functions and modules.
  • Functions of the global registry referred to by name.
  • The DLPack data types by their fields, for a caller that knows the type it wants: dtype::int(32) where C++ writes DataType::Int(32), instead of parsing "int32" with DLDataType::try_from_str. These are plain values with no native call, so they can be constants and can be compared; PrimType::int and its siblings give the IR type of each.
  • Expressions: variables, constants, calls, tuples and tensor accesses.
  • The base of every function.
  • Module-level information that is not a function.
  • Source locations of IR nodes, for diagnostics.
  • The module: the unit of compilation.
  • Operators: the registry entry Op, its ArgumentInfo, and its attribute columns.
  • Registering operators from Rust: C++ OpDef, with its signature descriptors (sig) and attribute keys (op_attr), whose chains a tvm_ffi::static_init_block! runs to define operators, as C++ defines them in a TVM_FFI_STATIC_INIT_BLOCK.
  • Primitive expressions: scalar arithmetic, comparisons and vector lanes.
  • Statements: bindings, assertions, loops, conditionals, tensor stores and sequences.
  • The pass infrastructure: passes, pass contexts and instrumentation.
  • Types: primitive, pointer, tuple, function and the special types.
  • Registering IR types from Rust: register_type, which a tvm_ffi::static_init_block! calls for an rs_class type, as C++ registers a type with refl::ObjectDef in a TVM_FFI_STATIC_INIT_BLOCK.
  • A supply of unique names, for building and rewriting IR.