Skip to content

Add TIR Schedule and TIR support for consumer fusion - #106

Open
guillon wants to merge 7 commits into
xtc-tools:mainfrom
guillon:dev/cguillon/tir-schedule
Open

Add TIR Schedule and TIR support for consumer fusion#106
guillon wants to merge 7 commits into
xtc-tools:mainfrom
guillon:dev/cguillon/tir-schedule

Conversation

@guillon

@guillon guillon commented Jul 22, 2026

Copy link
Copy Markdown
Member

Motivation

TVM's legacy TE scheduling API is no longer available in recent TVM releases. Add an opt-in TIR scheduling path while preserving the existing TE path and XTC scheduling interface.

Description

This introduces schedulable/scheduled TVM expression abstractions that lower TE expressions to either TE schedules or TIR PrimFunc schedules. The TVM scheduler emits TIR transformations for tiling, interchange, caching, buffering, unrolling, vectorization, parallelization, and producer/consumer fusion. It also adapts unroll/vector combinations to TIR code-generation constraints and supports padded pack_at caches through storage alignment. Compilation, IR dumping, C emission, and library generation handle both schedule forms.

The TIR path is selected with the backend tir_schedule option or the exploration CLI's --tir-schedule flag. LoopNest records and displays producer and consumer fusion annotations. FileCheck coverage includes scheduled matmul and fused producer/consumer graphs, while retaining TE fusion coverage.

Commits

  • Fix schedule description dump expectations.
  • Add TE-to-TIR lowering and TIR scheduling support.
  • Add fuse_producer_at to LoopNest.
  • Emit producer fusion for TVM TIR schedules.
  • Add the fuse_consumer_at scheduling primitive and TVM TIR support.
  • Adapt unrolling and vectorization for valid TIR code generation.
  • Add padded pack_at support for TIR schedules.

Discussion

The TIR path is opt-in; TE scheduling remains the default.

@guillon
guillon force-pushed the dev/cguillon/tir-schedule branch from 221f792 to cfb4805 Compare July 22, 2026 17:36
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.90780% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/xtc/backends/tvm/TVMScheduler.py 93.43% 3 Missing and 6 partials ⚠️
src/xtc/backends/tvm/TVMOpsCompiler.py 93.40% 3 Missing and 3 partials ⚠️
src/xtc/backends/tvm/TVMCompiler.py 84.84% 4 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@guillon
guillon force-pushed the dev/cguillon/tir-schedule branch 3 times, most recently from a57e21e to bfc8e58 Compare July 23, 2026 19:47
@guillon
guillon force-pushed the dev/cguillon/tir-schedule branch from bfc8e58 to adfd220 Compare July 24, 2026 01:14
@guillon
guillon force-pushed the dev/cguillon/tir-schedule branch from adfd220 to 1239736 Compare July 24, 2026 02:13
@guillon guillon changed the title Add TIR Schedule Add TIR Schedule and TIR support for consumer fusion Jul 24, 2026
@guillon
guillon requested a review from qaco July 24, 2026 02:16
@guillon
guillon marked this pull request as ready for review July 27, 2026 15:50
@guillon guillon added the enhancement New feature or request label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants