Skip to content

mlir: [tensor dialect] moved unrolling to after bufferization - #147

Merged
guillon merged 1 commit into
xtc-tools:mainfrom
liamsemeria:dev/sliam/mlir-unroll-after-buff
Sep 21, 2026
Merged

guillon merged 1 commit into
xtc-tools:mainfrom
liamsemeria:dev/sliam/mlir-unroll-after-buff

Conversation

@liamsemeria

@liamsemeria liamsemeria commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

#138 showed that the MLIR backend had excessive compile times due to unrolling causing the bufferization passes to take a long time.

Description

Unrolling was moved after bufferization, which was pretty straight forward due to there already being a post-bufferization transform stage.
Moving the unrolling fixes the compile time issue and bumps performance up to tvm.

with tvm:

time loop-explore  --threads 1 --peak-flops 65.6e9 --operator conv2d --backends tvm --use-tensor --strategy tile7d --test 1 1 1 2 14 1 2 1 28 2 1 16 7 1 1 --save-temps
Schedule: tvm: [1; 1; 1; 2; 14; 1; 2; 1; 28; 2; 1; 16; 7; 1; 1]: time: 1.99 msecs, peak perf: 90.30%

real	0m4,571s
user	0m8,219s
sys	0m0,462s

with unrolling before bufferization:


time loop-explore  --threads 1 --peak-flops 65.6e9 --operator conv2d --backends mlir --use-tensor --strategy tile7d --test 1 1 1 2 14 1 2 1 28 2 1 16 7 1 1 --save-temps
Schedule: mlir: [1; 1; 1; 2; 14; 1; 2; 1; 28; 2; 1; 16; 7; 1; 1]: time: 2.42 msecs, peak perf: 74.47%

real	0m49,846s
user	0m53,662s
sys	0m0,435s

with unrolling after bufferization:

time loop-explore  --threads 1 --peak-flops 65.6e9 --operator conv2d --backends mlir --use-tensor --strategy tile7d --test 1 1 1 2 14 1 2 1 28 2 1 16 7 1 1 --save-temps
Schedule: mlir: [1; 1; 1; 2; 14; 1; 2; 1; 28; 2; 1; 16; 7; 1; 1]: time: 2.03 msecs, peak perf: 88.61%

real	0m3,465s
user	0m7,323s
sys	0m0,294s

@liamsemeria
liamsemeria requested a review from guillon September 21, 2026 12:14
@liamsemeria liamsemeria added the enhancement New feature or request label Sep 21, 2026
@liamsemeria
liamsemeria removed the request for review from guillon September 21, 2026 12:14
@liamsemeria
liamsemeria marked this pull request as draft September 21, 2026 12:16
@liamsemeria
liamsemeria requested a review from guillon September 21, 2026 12:20
@liamsemeria
liamsemeria marked this pull request as ready for review September 21, 2026 12:21
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@guillon guillon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@guillon
guillon merged commit 19a5b66 into xtc-tools:main Sep 21, 2026
10 checks passed
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