Issue |
141025
|
Summary |
[mlir][linalg] Re-organise tests for vectorization
|
Labels |
mlir
|
Assignees |
banach-space
|
Reporter |
banach-space
|
The current Linalg vectorization tests are split somewhat arbitrarily across multiple files:
```bash
ls -1 mlir/test/Dialect/Linalg/vectoriz*
mlir/test/Dialect/Linalg/vectorization-pad-patterns.mlir
mlir/test/Dialect/Linalg/vectorization-scalable.mlir
mlir/test/Dialect/Linalg/vectorization-unsupported.mlir
mlir/test/Dialect/Linalg/vectorization-with-patterns.mlir
mlir/test/Dialect/Linalg/vectorization.mlir
mlir/test/Dialect/Linalg/vectorize-conv-masked-and-scalable.mlir
mlir/test/Dialect/Linalg/vectorize-convolution-flatten.mlir
mlir/test/Dialect/Linalg/vectorize-convolution.mlir
mlir/test/Dialect/Linalg/vectorize-tensor-extract-masked.mlir
mlir/test/Dialect/Linalg/vectorize-tensor-extract.mlir
```
**Proposed improvements:**
1. Standardise naming: e.g., unify `vectorize` vs. `vectorization`.
2. Introduce a dedicated subdirectory (e.g., "Linalg/Vectorization") to eliminate repeated prefixes (`vectorize`/`vectorization`).
3. Standardise the test split between:
* Tests using `transform.structured.vectorize` (with masking).
* Tests using `transform.structured.vectorize_children_and_apply_patterns` (no masking).
Re 3., this split is already followed in "vectorization.mlir" and "vectorization-with-patterns.mlir", respectively.
**Specific steps:**
* **Rename:** "vectorize-tensor-extract-masked.mlir" --> _**"vectorization-tensor-extract.mlir"**_ (it follows the format from _**"vectorization.mlir"**_).
* **Rename:** "vectorize-tensor-extract.mlir" --> **_"vectorization-tensor-extract-with-patterns.mlir"_** (it follows the format from **_"vectorization-with-patterns.mlir"_**).
* **Merge** "vectorization-scalable.mlir" with other tests.
* **Update** convolution tests to follow the same naming and structural convention.
**Additional clean-up**
* Split "vectorization.mlir" and "vectorization-with-patterns.mlir" into smaller tests. At a minimum, extract non-Linalg operations into separate test files.
* Rename "vectorization-pad-patterns.mlir" to more clearly reflect that it tests `transform.apply_patterns.linalg.pad_vectorization`.
**Structure after the changes**
Without committing to all the fine details just yet, here is a possible end structure for the tests:
```bash
mlir/test/Dialect/Linalg/vectorization/
├── conv.mlir
├── conv-flatten.mlir
├── conv-with-patterns.mlir
├── extract.mlir
├── extract-with-patterns.mlir
├── insert-slice.mlir
├── insert-slice-with-patterns.mlir
├── linalg-ops.mlir
├── linalg-ops-with-patterns.mlir
├── pad.mlir
├── pad-with-patterns.mlir
├── unsupported.mlir
```
In addition to consistent naming, this structure provides a clear separation between tests using:
* `transform.structured.vectorize` - finer-grained tests, typically involving masking.
* `transform.structured.vectorize_children_and_apply_patterns` - broader pattern-based transformations, typically without masking.
**Next steps**
I’ll be uploading patches implementing these changes incrementally, and I’ll use this ticket as a reference for the overall direction. If you have any high-level comments, suggestions, or objections, please raise them here. For smaller details, let’s handle them through the individual PRs.
Thanks!
PRs:
* https://github.com/llvm/llvm-project/pull/140877
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs