logo
  • Community
  • Download
  • Docs
  • GitHub
  • Apache Homepage
  • License
  • Sponsorship
  • Security
  • Thanks
  • Events
  • Apache Homepage
  • License
  • Sponsorship
  • Security
  • Thanks
  • Events
tvm

Getting Started

  • Overview
  • Installing TVM
  • Quick Start
  • IRModule

How To

  • Importing Models from ML Frameworks
  • End-to-End Optimize Model
  • Customize Optimization
  • Optimize Large Language Model
  • Cross Compilation and RPC
  • Export and Load Relax Executables
  • Development Guides

Deep Dive

  • Design and Architecture
  • TensorIR
    • Tensor Program Abstraction
    • Understand TensorIR Abstraction
    • TensorIR Creation
    • Transformation
    • DLight: Rule-Based GPU Scheduling
    • MetaSchedule: Search-Based Auto-Tuning
  • Relax

API Reference

  • Python API
  • Other APIs

About

  • Contributor Guide
  • Publications
  • Security Guide

Index

  • Index
Table of Contents
  • Docs >
  • TensorIR
  • Edit on GitHub

TensorIR

TensorIR is one of the core abstractions in the Apache TVM stack, used to represent and optimize primitive tensor functions.

The TensorIR codebase consists of two modules (split from the former tir):

  • tirx — Core IR definitions and lowering (PrimFunc, Buffer, SBlock, expressions, statements, lowering passes).

  • s_tir (Schedulable TIR) — Schedule primitives, MetaSchedule, DLight, and tensor intrinsics.

In TVMScript, both modules are accessed via from tvm.script import tirx as T.

  • Tensor Program Abstraction
    • Key Elements of Tensor Programs
    • Extra Structure in TensorIR
  • Understand TensorIR Abstraction
    • Function Parameters and Buffers
    • Loop Iterations
    • Computational Block
    • Block Axis Properties
    • Why Extra Information in Block
    • Sugars for Block Axes Binding
  • TensorIR Creation
    • Create TensorIR using TVMScript
    • Create TensorIR using Tensor Expression
  • Transformation
    • Initialization Schedule
    • Loop Tiling
    • Leverage Localities
    • Rewrite Reduction
    • Trace the Transformation
  • DLight: Rule-Based GPU Scheduling
    • Prepare a Model
    • Basic Usage: ApplyDefaultSchedule
    • Rule Catalog
    • Diagnosing Schedule Quality
    • DLight vs MetaSchedule
    • Writing a Custom Rule
    • Summary
  • MetaSchedule: Search-Based Auto-Tuning
    • Architecture Overview
    • Prepare a Model
    • User-Facing Entry Points
    • Inspecting Tunable Tasks
    • Selective Operator Tuning
    • Database
    • Cross-Model Database Reuse
    • Key Parameters Reference
    • Summary
Next Previous
backtop
© 2026 Apache Software Foundation | All rights reserved
Copyright © 2026 The Apache Software Foundation. Apache TVM, Apache, the Apache feather, and the Apache TVM project logo are either trademarks or registered trademarks of the Apache Software Foundation.