[Mlir-commits] [mlir] [Linalg] Update Conv Decomposition patterns to work with generic convolution ops as well (PR #174196)

Han-Chung Wang llvmlistbot at llvm.org
Mon Jan 5 22:16:58 PST 2026


https://github.com/hanhanW commented:

I agree with Mahesh here because the key is about linalg structured ops. A transformation should be able to do the same thing for named ops and generic form ops; it's user's choice for the input format. They are the same ops to me, and the main difference is more about visualization to human. IMO, we don't force users to run a specific transformation before another transformation if they are the same ops. The key (to me) is that they are all linalg structured ops and the transformations are implemented by interface methods (using those properties like indexing maps). I think this is why we started linalg dialect with [LinalgStructuredInterface](https://github.com/llvm/llvm-project/blob/41c5830aabd5df865027e0812cd58a8ebae987d2/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td#L226-L769)). It provides access to the 'LinalgOp' interface.

> Also, tests in this PR appear to duplicate inputs to cover both named and generic forms inside decomposition/vectorization tests. We already test specialization and decomposition extensively on their own, so this looks like test duplication rather than additional coverage.

RE test coverage, I think we can have a second `RUN` that generalize linalg structure ops first, and then kick in the decomposition/vectorization. The checks should be the same because the main difference is about matchers. This way we don't duplicate the tests and have a more robust setup. E.g., we don't even need to check if the named op version matches generic op version.

E.g., we can create two specs in https://github.com/llvm/llvm-project/tree/main/mlir/test/Dialect/Linalg/td

And do something like `decompose-pack.mlir`. One run for spec_1 and the other run for spec_2. I don't fully love the solution, but this is what I can figure out atm; it is better than the duplication.

https://github.com/llvm/llvm-project/blob/b81c1bb1a1494e313ffc21f42020f04ae9fbf995/mlir/test/Dialect/Linalg/decompose-pack.mlir#L1-L3



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


More information about the Mlir-commits mailing list