Skip to content

Commit 305f484

Browse files
banach-spacesivan-shani
authored andcommitted
[mlir][linalg][nfc] Move vectorization tests (llvm#141656)
Moves all the remaining Linalg vectorization tests from: * `mlir/tests/Dialect/Linalg/*` to: * `mlir/tests/Dialect/Linalg/vectorization/*` To maintain consistency within tests, `vectorize-convolution.mlir` was updated to use: * `transform.structured.vectorize_children_and_apply_patterns` instead of: * `-test-linalg-transform-patterns=test-linalg-to-vector-patterns` This change required minor updates to some `CHECK` lines, reflecting only reordering of ops due to an additional pattern being applied. Closes llvm#141025
1 parent fdb3b80 commit 305f484

File tree

8 files changed

+252
-7
lines changed

8 files changed

+252
-7
lines changed

mlir/test/Dialect/Linalg/vectorize-convolution-flatten.mlir renamed to mlir/test/Dialect/Linalg/vectorization/convolution-with-patterns-flatten.mlir

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// RUN: mlir-opt -split-input-file -transform-interpreter %s | FileCheck %s
22

3+
///----------------------------------------------------------------------------------------
4+
/// Tests for vectorizing depthwise convolutions (with patterns) with the
5+
/// flattening of the channel dim enabled. This approach is beneficial when the
6+
/// number of channel dimensions is low.
7+
///----------------------------------------------------------------------------------------
8+
39
func.func @depthwise_conv1d_nwc_wc_1x8x3xi8_tensor(%input: tensor<1x8x3xi8>,
410
%filter: tensor<1x3xi8>,
511
%output: tensor<1x8x3xi8>) -> (tensor<1x8x3xi8>) {

mlir/test/Dialect/Linalg/vectorize-convolution.mlir renamed to mlir/test/Dialect/Linalg/vectorization/convolution-with-patterns.mlir

Lines changed: 223 additions & 7 deletions
Large diffs are not rendered by default.

mlir/test/Dialect/Linalg/vectorize-conv-masked-and-scalable.mlir renamed to mlir/test/Dialect/Linalg/vectorization/convolution.mlir

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
// RUN: mlir-opt -split-input-file -transform-interpreter -cse %s | FileCheck %s
22

3+
///----------------------------------------------------------------------------------------
4+
/// ATM, all tests in this file require masking. As the support for masking is
5+
/// limited to depthwise convs, only that variant of convolutions is tested
6+
/// ATM.
7+
///
8+
/// TODO1: Add more types of convolutions (transform.structured.vectorize
9+
/// usually doesn't require masking when vector sizes are not specified)
10+
/// TODO2: Add support for masking non-depthwise convs.
11+
///----------------------------------------------------------------------------------------
12+
313
func.func @depthwise_conv1d_nwc_wc_1x8x3xi8_tensor(%input: tensor<1x8x?xi8>,
414
%filter: tensor<1x?xi8>,
515
%output: tensor<1x8x?xi8>) -> (tensor<1x8x?xi8>) {

mlir/test/Dialect/Linalg/vectorization-pad-patterns.mlir renamed to mlir/test/Dialect/Linalg/vectorization/pad-patterns.mlir

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
// RUN: mlir-opt %s -transform-interpreter -split-input-file | FileCheck %s
22

3+
///----------------------------------------------------------------------------------------
4+
/// Tests for vectorization patterns for tensor.pad, i.e.
5+
/// * transform.apply_patterns.linalg.pad_vectorization
6+
///
7+
/// These tests are meant os a lower granule than tests in
8+
/// * pad-with-patterns.mlir.
9+
/// The goal is to test specific patterns. To this end, some inputs already
10+
/// contain Vector ops (on top of `tensor.pad`).
11+
///----------------------------------------------------------------------------------------
12+
313
///----------------------------------------------------------------------------------------
414
/// [Pattern: PadOpVectorizationWithTransferReadPattern]
515
///----------------------------------------------------------------------------------------

mlir/test/Integration/Dialect/Linalg/CPU/test-padtensor.mlir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
// RUN: -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils \
88
// RUN: | FileCheck %s
99

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

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

0 commit comments

Comments
 (0)