[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
Tue Jan 6 06:36:11 PST 2026
hanhanW wrote:
> Sure, but I think this is exactly where the concern lies. Today, users can intentionally prevent convolution-specific behaviour by choosing linalg.generic instead of linalg.conv. By folding Specialization into Decomposition, we effectively remove that option, without enabling functionality that isn’t already available (since decomposing linalg.generic can already be achieved via (2) from my original post).
IMO, users should collect patterns to build their own passes. This can be solved by adding control functions to decomposition patterns. The upstream patterns provide transformations and downstream users build the passes with the patterns. [DropUnitDims](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp) transformation is a good example, IMO.
> A related issue is vectorization behaviour. Currently, a linalg.generic encoding a convolution will not vectorize (precondition failed: not projected permutations). If vectorization includes specialization, the same op would suddenly become vectorizable, which changes observable behaviour. This also raises a longer-term concern: if support is later added to vectorize such linalg.generic ops directly, we would end up with two independent vectorization paths for convolution-like ops, with no clear mechanism to select between them.
I may be missing something. Doesn't vectorization already force users to collect ops and call [vectorize](https://github.com/llvm/llvm-project/blob/dff081c26f11e1679411e7c0b4012e6a740b6cc3/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L2703-L2707) method? I thought that users are already filtering the ops and apply vectorization. E.g., you match the op and vectorize the op. Users still can disallow the op in their vectorization list. Am I missing something here?
https://github.com/llvm/llvm-project/blob/dff081c26f11e1679411e7c0b4012e6a740b6cc3/mlir/test/Dialect/Linalg/vectorization/convolution.mlir#L13-L30
https://github.com/llvm/llvm-project/pull/174196
More information about the Mlir-commits
mailing list