[Mlir-commits] [mlir] [MLIR] Add pattern to bubble up tensor.extract_slice (PR #126898)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Feb 13 01:15:37 PST 2025


banach-space wrote:

> Discoverability has been a big headache for me: There are many useful patterns, but its really hard to find whether a certain pattern already exists.

Let me suggest a partial solution. 

We should be able to identify relevant transformations by simply "grep"-ing for "interesting" Ops in the test directory. For this to work, we need to make sure that:
* we have good (meaningful + descriptive) test file names,
* we have good (meaningful + descriptive) function names,
* we test patterns in isolation and document what patterns are being excercised (e.g. [here](https://github.com/llvm/llvm-project/blob/main/mlir/test/Dialect/Vector/vector-transfer-permutation-lowering.mlir#L5)).

As a stepping stone, @ofri-frishman, please make sure that the new pattern is tested in isolation. As for the right location, there seems to be 2 good candidates:
* "mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp",
* "mlir/lib/Dialect/Tensor/Transforms/ReshapePatterns.cpp".

This pattern feels like "bubbling up" to me, though "swap" might be more fitting actually. Just to avoid bike-shedding, I suggest "BubbleUpExtractSlice.cpp", but lets note (in comments) that this is basically a "swap". We can re-visit later.

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


More information about the Mlir-commits mailing list