Skip to content

[mlir][linalg] Re-organise tests for vectorization #141025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
banach-space opened this issue May 22, 2025 · 2 comments
Open

[mlir][linalg] Re-organise tests for vectorization #141025

banach-space opened this issue May 22, 2025 · 2 comments
Assignees

Comments

@banach-space
Copy link
Contributor

The current Linalg vectorization tests are split somewhat arbitrarily across multiple files:

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:

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:

@banach-space banach-space self-assigned this May 22, 2025
@llvmbot llvmbot added the mlir label May 22, 2025
@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/issue-subscribers-mlir

Author: Andrzej Warzyński (banach-space)

The current Linalg vectorization tests are split somewhat arbitrarily across multiple files:
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:

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:

@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/issue-subscribers-mlir-linalg

Author: Andrzej Warzyński (banach-space)

The current Linalg vectorization tests are split somewhat arbitrarily across multiple files:
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:

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants