Skip to content

[Codegen][GPU] Move hoisting to interface and add it for barrier ops#23519

Merged
Groverkss merged 3 commits intoiree-org:mainfrom
Groverkss:hoist-barrier-region-v2
Feb 24, 2026
Merged

[Codegen][GPU] Move hoisting to interface and add it for barrier ops#23519
Groverkss merged 3 commits intoiree-org:mainfrom
Groverkss:hoist-barrier-region-v2

Conversation

@Groverkss
Copy link
Contributor

@Groverkss Groverkss commented Feb 19, 2026

iree_gpu.barrier_region ops prevent hoisting and only resolve after bufferization. This means that before bufferization, we effectively cannot do any hoisting from loops because they are usually in a barrier region. After bufferization, it's extremely hard to figure out if we can do hoisting because of side effects.

This leads to better codegen in general in TileAndFuse pipeline, generating better barriers in general, because the barrier region is much more restricted. This was manually verified.

The test changes in igemm pipeline are mainly the test being wrong earlier, it was matching some private memory load, instead of the shared memory loads. There was bad barrier placement before this patch because the barrier regions were capturing everything, leading to an extra barrier which got matched.

The patch also moves the hoisting implementation to an interface. This is required, otherwise all codegen patterns start depending on iree gpu dialect, which shouldn't be the case for non gpu code.

@Groverkss
Copy link
Contributor Author

Depends on #23518 , please only review the top commit

Copy link
Contributor

@krzysz00 krzysz00 left a comment

Choose a reason for hiding this comment

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

lgtm here

@Groverkss Groverkss force-pushed the hoist-barrier-region-v2 branch from 7b08191 to e40ef2a Compare February 23, 2026 13:49
@Groverkss Groverkss changed the title [Codegen][GPU] Add hoisting for iree_gpu.barrier_region ops [Codegen][GPU] Move hoisting to interface and add it for barrier ops Feb 23, 2026
Copy link
Contributor

@krzysz00 krzysz00 left a comment

Choose a reason for hiding this comment

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

Interface lgtm, curious about where those extra unit dimensions came from and if they'll break any pattern matches later down the line

Copy link
Contributor

@hanhanW hanhanW left a comment

Choose a reason for hiding this comment

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

Partially Approve. The move of interface looks reasonable to me, thanks for the ping on reviews!

@Groverkss Groverkss force-pushed the hoist-barrier-region-v2 branch from e40ef2a to 3b87539 Compare February 24, 2026 07:05
@Groverkss Groverkss enabled auto-merge (squash) February 24, 2026 07:06
@Groverkss Groverkss merged commit 3f630a7 into iree-org:main Feb 24, 2026
52 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants