Skip to content

[x86] Tweak Linalg graph preprocessing - #311

Merged
adam-smnk merged 1 commit into
llvm:mainfrom
adam-smnk:x86-pipe-tweak-preprocessing
Oct 20, 2026
Merged

adam-smnk merged 1 commit into
llvm:mainfrom
adam-smnk:x86-pipe-tweak-preprocessing

Conversation

@adam-smnk

Copy link
Copy Markdown
Member

Adds unit dim folder and removes initial elementwise fusion to enable lowering of larger KernelBench level2 graphs.

Fusion still occurs in later steps. The separate upstream pass needs further investigation to narrow down the root cause. Unit dim folding unblocks tiling when these unit dims add zero constants to Linalg indexing maps.

Adds unit dim folder and removes initial elementwise fusion to enable
lowering of larger KernelBench level2 graphs.

Fusion still occurs in later steps. The separate upstream pass needs
further investigation to narrow down the root cause.
Unit dim folding unblocks tiling when these unit dims add zero
constants to Linalg indexing maps.
@adam-smnk
adam-smnk merged commit eb90452 into llvm:main Oct 20, 2026
3 checks passed
@tkarna

tkarna commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

For what it's worth in xegpu schedules we apply a bunch of transforms to clean up the initial IR produced by torch-mlir.

# Normalize possible singleton dimensions so tile+fuse logic works.
with ir.InsertionPoint(transform.apply_patterns(func).patterns):
# drop unused argmax results so online fusion sees a simple row max
structured.apply_patterns_linalg_erase_unused_operands_and_results()
# fold unit dims in linalg.generic op inputs
structured.apply_patterns_linalg_fold_unit_extent_dims_via_slices()
# fold tensor.extract_slice(tensor.expand_shape(x)) into x
tensor.apply_patterns_tensor_reassociative_reshape_folding()
# swap tensor.extract_slice(linalg.fill(...)) ops
structured.apply_patterns_linalg_swap_extract_slice_with_fill()
# fold tensor.extract_slice(tensor.empty(...)) into tensor.tensor_empty(...)
tensor.apply_patterns_tensor_fold_tensor_empty(fold_single_use_only=True)
lh_transform.cleanup(func)

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.

2 participants