[Mlir-commits] [mlir] [mlir][transform] Use LoopInvariant passes in the tileConsumerAndFuseProducersUsingSCF (PR #163222)

Rolf Morel llvmlistbot at llvm.org
Wed Oct 15 13:22:57 PDT 2025


rolfmorel wrote:

Just to check: this change is mostly about hoisting of the extract_slice, for `%extracted_slice_4` in the example of https://github.com/llvm/llvm-project/pull/163222#issuecomment-3398296959 ? And once the extract_slice is hoisted, the fill that is using it should also be hoisted by one loop.

If so, couldn't we just make use of the composability of transform ops and do:
```
  transform.named_sequence @__transform_main(
       %arg0: !transform.any_op {transform.readonly}) {
    %0 = transform.structured.match ops{["linalg.pooling_ncw_max"]} in %arg0 : (!transform.any_op) -> !transform.any_op
    %tiled_pool, %loops:4 = transform.structured.fuse %0 {tile_sizes = [1, 16, 1, 1], apply_cleanup = true}
      : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)
    transform.loop.hoist_loop_invariant_subsets %loops:4 : !transform.any_op // %loops:1, whichever is the innermost loop
    transform.apply_licm %loops:4 : !transform.any_op
    transform.yield
  }
```

Doesn't that already give you the desired result?

https://github.com/llvm/llvm-project/pull/163222


More information about the Mlir-commits mailing list