| Issue |
238734
|
| Summary |
[mlir] Decompose and then rename ConvertVectorToLLVMPass
|
| Labels |
mlir
|
| Assignees |
banach-space
|
| Reporter |
banach-space
|
This is an umbrella ticket to track the effort to:
* _Decompose [ConvertVectorToLLVMPass](https://github.com/llvm/llvm-project/blob/b8b5e88aa9eda612bb1321bc8a9fef0370c1de0a/mlir/include/mlir/Conversion/Passes.td?plain=1#L1706-L1790) into smaller, self-contained passes with fewer dependencies and a clear purpose._
Prior discussions and PRs:
- https://github.com/llvm/llvm-project/pull/160055
- https://github.com/llvm/llvm-project/pull/236760
- [TCDG meeting notes - 2025-09-17](https://discourse.llvm.org/t/tcdg-tensor-compiler-design-group-meeting-notes-2025-09-17/88335)
**GOALs**:
- **Extract** the ISA-specific components currently enabled by `enable-arm-neon`, `enable-arm-sve`, `enable-arm-i8mm`, `enable-arm-bf16`, and `enable-x86` into dedicated passes.
- **Remove** the [vector-contract-lowering](https://github.com/llvm/llvm-project/blob/b8b5e88aa9eda612bb1321bc8a9fef0370c1de0a/mlir/include/mlir/Conversion/Passes.td?plain=1#L1763) and [vector-transpose-lowering](https://github.com/llvm/llvm-project/blob/b8b5e88aa9eda612bb1321bc8a9fef0370c1de0a/mlir/include/mlir/Conversion/Passes.td?plain=1#L1776) options from `ConvertVectorToLLVMPass`. We will use scalar fallback lowerings instead. Alternative lowering strategies will be available through separate passes.
- **Replace** `ConvertVectorToLLVMPass` with a functioning baseline path from the Vector dialect to the LLVM dialect, excluding target-specific optimisations. Separate lowering into two stages:
- **Phase 1** - lowering and legalisation: introduce `lower-vector-ops` (or `legalize-for-llvm-export`, name TBD) for generic _**Vector**_ ➡️ _**Vector**_ transformations. Target-specific _**Vector**_ ➡️ _**HW Vector**_ transformations will remain in separate, explicitly selected passes.
- **Phase 2** - LLVM conversion: use `convert-to-llvm`, with the relevant dialects implementing `ConvertToLLVMPatternInterface`, to prepare the resulting operations for LLVM IR export.
- **Preserve** the functionality currently offered by `ConvertVectorToLLVMPass`, through explicit pass composition.
- **Support** target-specific pipelines, including **Arm SME** pipelines that need to retain 2D vectors until the appropriate target-specific lowering.
**NON-GOALs**:
- Preserve `ConvertVectorToLLVMPass` as a meta-pass to lower from `Vector` to `LLVM`. This approach does not scale - instead we will provide a hardware agnostic baseline consisting of two steps.
- Introduce new optimised meta-passes. Instead, we want to provide building blocks that users can compose into pipelines suited to their needs.
**NEXT STEPS**:
- @banach-space will add a `convert-vector-to-arm-sve` pass, as discussed in #236760.
- Make sure that all HW dialects currently relying on `ConvertVectorToLLVMPass` implement `ConvertToLLVMPatternInterface`.
- Introduce `lower-vector-ops` (or `legalize-for-llvm-export`) and start porting MLIR tests to use it followed by convert-to-llvm, replacing `ConvertVectorToLLVMPass`.
- Note, most of the tests in [mlir/test/Conversion/VectorToLLVM](https://github.com/llvm/llvm-project/tree/b8b5e88aa9eda612bb1321bc8a9fef0370c1de0a/mlir/test/Conversion/VectorToLLVM) have already been categorised and tests that require more than `convert-to-llvm="filter-dialects=vector` should be replaced with more appropriate "legalization" tests.
- This should be accompanied by removing "vector legalisation" from `ConvertVectorToLLVMPass`
_If you’d like to work on this in parallel, please add your name and the area you plan to tackle!_
**PRs**:
- TODO
Thank you,
-Andrzej
CC @FedericoBruzzone @zero9178 @rengolin @adam-smnk @dcaballe @Groverkss
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs