[Mlir-commits] [mlir] [mlir][linalg] Add mixed precision folding pattern in vectorize_children_and_apply_patterns TD Op (PR #148684)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Jul 15 12:24:30 PDT 2025
banach-space wrote:
> Do you know some history behind this? Why it exists in the first place?
This is one of the earliest TD ops, introduced at a time when the intended use of TD was still evolving.
Since then, the op has grown organically without a clearly defined direction. It may be worth auditing - or even considering deprecating - it. To briefly summarise (apologies if you're already familiar):
* `transform.structured.vectorize_children_and_apply_patterns` calls [vectorize](https://github.com/llvm/llvm-project/blob/5f1141ded7845f1879cbf43bc8540f3d6a8dea5e/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L2531-L2535) and applies some "clean-up" patterns. The generated output tends to be very compact, i.e. is easy for humans to parse, but doesn't really show what `vectorize` does (because there is so much more going on).
* `transform.structured.vectorize` will only call [vectorize](https://github.com/llvm/llvm-project/blob/5f1141ded7845f1879cbf43bc8540f3d6a8dea5e/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L2531-L2535) - it is great to test specifically the transformations behind `vectorize`.
Conceptually, `transform.structured.vectorize_children_and_apply_patterns` treats "vectorization" as an abstract notion - `vectorize` plus additional Vector patterns- whereas `transform.structured.vectorize` directly encapsulates only `vectorize`.
II have some concerns about transform.structured.vectorize_children_and_apply_patterns in its current form - it represents just one specific collection of patterns, but it's not necessarily the canonical set IMHO.
> This transform already looks like a convenience wrapper for vectorization and optional additions that are integral to it.
Gathering relevant patterns/options in one place boosts discoverability so, I see some value in having such "comprehensive" (perhaps overloaded) transform.
One concern is that it implicitly applies `populateFoldArithExtensionPatterns`, which can make it harder to trace or discover when analysing transformations.
These are just some points for discussion, should anyone be interested.
Btw, if you want to use `transform.structured.vectorize_children_and_apply_patterns` for this, could you move tests to one of the files in https://github.com/llvm/llvm-project/tree/main/mlir/test/Dialect/Linalg/vectorization?
https://github.com/llvm/llvm-project/pull/148684
More information about the Mlir-commits
mailing list