Skip to content

[mlir][linalg][nfc] Move vectorization tests #141656

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

Merged
merged 2 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// RUN: mlir-opt -split-input-file -transform-interpreter %s | FileCheck %s

///----------------------------------------------------------------------------------------
/// Tests for vectorizing depthwise convolutions (with patterns) with the
/// flattening of the channel dim enabled. This approach is beneficial when the
/// number of channel dimensions is low.
///----------------------------------------------------------------------------------------

func.func @depthwise_conv1d_nwc_wc_1x8x3xi8_tensor(%input: tensor<1x8x3xi8>,
%filter: tensor<1x3xi8>,
%output: tensor<1x8x3xi8>) -> (tensor<1x8x3xi8>) {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
// RUN: mlir-opt -split-input-file -transform-interpreter -cse %s | FileCheck %s

///----------------------------------------------------------------------------------------
/// ATM, all tests in this file require masking. As the support for masking is
/// limited to depthwise convs, only that variant of convolutions is tested
/// ATM.
///
/// TODO1: Add more types of convolutions (transform.structured.vectorize
/// usually doesn't require masking when vector sizes are not specified)
/// TODO2: Add support for masking non-depthwise convs.
///----------------------------------------------------------------------------------------

func.func @depthwise_conv1d_nwc_wc_1x8x3xi8_tensor(%input: tensor<1x8x?xi8>,
%filter: tensor<1x?xi8>,
%output: tensor<1x8x?xi8>) -> (tensor<1x8x?xi8>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
// RUN: mlir-opt %s -transform-interpreter -split-input-file | FileCheck %s

///----------------------------------------------------------------------------------------
/// Tests for vectorization patterns for tensor.pad, i.e.
/// * transform.apply_patterns.linalg.pad_vectorization
///
/// These tests are meant os a lower granule than tests in
/// * pad-with-patterns.mlir.
/// The goal is to test specific patterns. To this end, some inputs already
/// contain Vector ops (on top of `tensor.pad`).
///----------------------------------------------------------------------------------------

///----------------------------------------------------------------------------------------
/// [Pattern: PadOpVectorizationWithTransferReadPattern]
///----------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions mlir/test/Integration/Dialect/Linalg/CPU/test-padtensor.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// RUN: -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils \
// RUN: | FileCheck %s

// TODO: Use TD for vectorization and remove `test-linalg-to-vector-patterns`
// that's otherwise not required.


func.func @main() {
%const = arith.constant dense<[[[1.0, 2.0, 3.0], [2.0, 3.0, 4.0]]]> : tensor<1x2x3xf32>
Expand Down