Relax + TIR: TVM's Core IR Evolution

Relax, succeeding Relay, brought dynamic shape support and cross-level abstraction, then merged with low-level TensorIR (TIR) to form a unified paradigm for end-to-end ML optimization.

The top 3

  1. Relax's Leap: Dynamic Shapes & Advanced Dataflow: Relax, as the successor to Relay, was specifically engineered to address Relay's limitations in efficiently supporting dynamic shape workloads and advanced dataflow semantics, crucial for optimizing modern ML architectures like transformers.
  2. Call_tir: Key to Cross-Layer Optimization: The `call_tir` intrinsic is a core feature of the Relax + TIR unified IR, enabling high-level Relax programs to directly embed and invoke low-level TensorIR functions. This allows for seamless cross-layer optimizations, incremental program lowering, and advanced automation previously difficult to achieve.
  3. Unified IRModule: Bridging High and Low-Level Gaps: The Relax + TIR merger establishes a unified `IRModule` capable of containing both high-level Relax functions (computational graphs) and low-level TensorIR functions (tensor operations). This design fundamentally bridges the 'huge gap' that existed between graph-level and tensor-level abstractions in previous TVM iterations.

Sources

Open the full topic