diff --git a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt --- a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt +++ b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt @@ -1,6 +1,10 @@ add_mlir_dialect_library(MLIRAffineTransforms AffineDataCopyGeneration.cpp AffineLoopInvariantCodeMotion.cpp + LoopTiling.cpp + LoopUnroll.cpp + LoopUnrollAndJam.cpp + SuperVectorize.cpp SimplifyAffineStructures.cpp ADDITIONAL_HEADER_DIRS diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp rename from mlir/lib/Transforms/LoopTiling.cpp rename to mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp --- a/mlir/lib/Transforms/LoopTiling.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp @@ -29,19 +29,19 @@ static llvm::cl::OptionCategory clOptionsCategory(DEBUG_TYPE " options"); static llvm::cl::opt - clCacheSizeKiB("tile-cache-size", + clCacheSizeKiB("affine-tile-cache-size", llvm::cl::desc("Set size of cache to tile for in KiB"), llvm::cl::cat(clOptionsCategory)); // Tile size to use for all loops (overrides -tile-sizes if provided). static llvm::cl::opt - clTileSize("tile-size", llvm::cl::desc("Use this tile size for all loops"), + clTileSize("affine-tile-size", llvm::cl::desc("Use this tile size for all loops"), llvm::cl::cat(clOptionsCategory)); // List of tile sizes. If any of them aren't provided, they are filled with // clTileSize / kDefaultTileSize. static llvm::cl::list clTileSizes( - "tile-sizes", + "affine-tile-sizes", llvm::cl::desc( "List of tile sizes for each perfect nest (overridden by -tile-size)"), llvm::cl::ZeroOrMore, llvm::cl::cat(clOptionsCategory)); diff --git a/mlir/lib/Transforms/LoopUnroll.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp rename from mlir/lib/Transforms/LoopUnroll.cpp rename to mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp diff --git a/mlir/lib/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp rename from mlir/lib/Transforms/LoopUnrollAndJam.cpp rename to mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp rename from mlir/lib/Transforms/Vectorize.cpp rename to mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp --- a/mlir/lib/Transforms/Vectorize.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp @@ -1,4 +1,4 @@ -//===- Vectorize.cpp - Vectorize Pass Impl --------------------------------===// +//===- SuperVectorize.cpp - Vectorize Pass Impl ---------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -1287,5 +1287,5 @@ } static PassRegistration - pass("affine-vectorize", + pass("affine-super-vectorize", "Vectorize to a target independent n-D vector abstraction"); diff --git a/mlir/lib/Transforms/CMakeLists.txt b/mlir/lib/Transforms/CMakeLists.txt --- a/mlir/lib/Transforms/CMakeLists.txt +++ b/mlir/lib/Transforms/CMakeLists.txt @@ -9,15 +9,11 @@ LoopCoalescing.cpp LoopFusion.cpp LoopInvariantCodeMotion.cpp - LoopTiling.cpp - LoopUnrollAndJam.cpp - LoopUnroll.cpp MemRefDataFlowOpt.cpp OpStats.cpp PipelineDataTransfer.cpp StripDebugInfo.cpp SymbolDCE.cpp - Vectorize.cpp ViewOpGraph.cpp ViewRegionGraph.cpp diff --git a/mlir/test/Transforms/Vectorize/compose_maps.mlir b/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir rename from mlir/test/Transforms/Vectorize/compose_maps.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir --- a/mlir/test/Transforms/Vectorize/compose_maps.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -affine-vectorizer-test -compose-maps 2>&1 | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorizer-test -compose-maps 2>&1 | FileCheck %s // For all these cases, the test traverses the `test_affine_map` ops and // composes them in order one-by-one. diff --git a/mlir/test/Transforms/Vectorize/normalize_maps.mlir b/mlir/test/Dialect/Affine/SuperVectorize/normalize_maps.mlir rename from mlir/test/Transforms/Vectorize/normalize_maps.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/normalize_maps.mlir --- a/mlir/test/Transforms/Vectorize/normalize_maps.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/normalize_maps.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -affine-vectorizer-test -normalize-maps | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorizer-test -normalize-maps | FileCheck %s // CHECK-DAG: #[[ZERO:[a-zA-Z0-9]+]] = affine_map<() -> (0)> // CHECK-DAG: #[[ID1:[a-zA-Z0-9]+]] = affine_map<(d0) -> (d0)> diff --git a/mlir/test/Transforms/Vectorize/vector_utils.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir rename from mlir/test/Transforms/Vectorize/vector_utils.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir --- a/mlir/test/Transforms/Vectorize/vector_utils.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -affine-vectorizer-test -vector-shape-ratio 4 -vector-shape-ratio 8 2>&1 | FileCheck %s -// RUN: mlir-opt %s -affine-vectorizer-test -vector-shape-ratio 2 -vector-shape-ratio 5 -vector-shape-ratio 2 2>&1 | FileCheck %s -check-prefix=TEST-3x4x5x8 +// RUN: mlir-opt %s -affine-super-vectorizer-test -vector-shape-ratio 4 -vector-shape-ratio 8 2>&1 | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorizer-test -vector-shape-ratio 2 -vector-shape-ratio 5 -vector-shape-ratio 2 2>&1 | FileCheck %s -check-prefix=TEST-3x4x5x8 func @vector_add_2d(%arg0: index, %arg1: index) -> f32 { // Nothing should be matched in this first block. diff --git a/mlir/test/Transforms/Vectorize/vectorize_1d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir rename from mlir/test/Transforms/Vectorize/vectorize_1d.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir --- a/mlir/test/Transforms/Vectorize/vectorize_1d.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -affine-vectorize -virtual-vector-size 128 --test-fastest-varying=0 | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorize -virtual-vector-size 128 --test-fastest-varying=0 | FileCheck %s // Permutation maps used in vectorization. // CHECK: #[[map_proj_d0d1_0:map[0-9]+]] = affine_map<(d0, d1) -> (0)> diff --git a/mlir/test/Transforms/Vectorize/vectorize_2d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir rename from mlir/test/Transforms/Vectorize/vectorize_2d.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir --- a/mlir/test/Transforms/Vectorize/vectorize_2d.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -affine-vectorize -virtual-vector-size 4 -virtual-vector-size 8 | FileCheck %s -check-prefix=VECT -// RUN: mlir-opt %s -affine-vectorize -virtual-vector-size 32 -virtual-vector-size 256 --test-fastest-varying=1 --test-fastest-varying=0 | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorize -virtual-vector-size 4 -virtual-vector-size 8 | FileCheck %s -check-prefix=VECT +// RUN: mlir-opt %s -affine-super-vectorize -virtual-vector-size 32 -virtual-vector-size 256 --test-fastest-varying=1 --test-fastest-varying=0 | FileCheck %s // Permutation maps used in vectorization. // CHECK-DAG: #[[map_id1:map[0-9]+]] = affine_map<(d0) -> (d0)> diff --git a/mlir/test/Transforms/Vectorize/vectorize_3d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_3d.mlir rename from mlir/test/Transforms/Vectorize/vectorize_3d.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/vectorize_3d.mlir --- a/mlir/test/Transforms/Vectorize/vectorize_3d.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_3d.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -affine-vectorize -virtual-vector-size 32 -virtual-vector-size 64 -virtual-vector-size 256 --test-fastest-varying=2 --test-fastest-varying=1 --test-fastest-varying=0 | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorize -virtual-vector-size 32 -virtual-vector-size 64 -virtual-vector-size 256 --test-fastest-varying=2 --test-fastest-varying=1 --test-fastest-varying=0 | FileCheck %s // Permutation maps used in vectorization. // CHECK: #[[map_proj_d0d1d2_d0d1d2:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0, d1, d2)> diff --git a/mlir/test/Transforms/Vectorize/vectorize_outer_loop_2d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_outer_loop_2d.mlir rename from mlir/test/Transforms/Vectorize/vectorize_outer_loop_2d.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/vectorize_outer_loop_2d.mlir --- a/mlir/test/Transforms/Vectorize/vectorize_outer_loop_2d.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_outer_loop_2d.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -affine-vectorize -virtual-vector-size 32 -virtual-vector-size 256 --test-fastest-varying=2 --test-fastest-varying=0 | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorize -virtual-vector-size 32 -virtual-vector-size 256 --test-fastest-varying=2 --test-fastest-varying=0 | FileCheck %s // Permutation maps used in vectorization. // CHECK: #[[map_proj_d0d1d2_d0d2:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d0, d2)> diff --git a/mlir/test/Transforms/Vectorize/vectorize_outer_loop_transpose_2d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_outer_loop_transpose_2d.mlir rename from mlir/test/Transforms/Vectorize/vectorize_outer_loop_transpose_2d.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/vectorize_outer_loop_transpose_2d.mlir --- a/mlir/test/Transforms/Vectorize/vectorize_outer_loop_transpose_2d.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_outer_loop_transpose_2d.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -affine-vectorize -virtual-vector-size 32 -virtual-vector-size 256 --test-fastest-varying=0 --test-fastest-varying=2 | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorize -virtual-vector-size 32 -virtual-vector-size 256 --test-fastest-varying=0 --test-fastest-varying=2 | FileCheck %s // Permutation maps used in vectorization. // CHECK: #[[map_proj_d0d1d2_d2d0:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d2, d0)> diff --git a/mlir/test/Transforms/Vectorize/vectorize_transpose_2d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_transpose_2d.mlir rename from mlir/test/Transforms/Vectorize/vectorize_transpose_2d.mlir rename to mlir/test/Dialect/Affine/SuperVectorize/vectorize_transpose_2d.mlir --- a/mlir/test/Transforms/Vectorize/vectorize_transpose_2d.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_transpose_2d.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -affine-vectorize -virtual-vector-size 32 -virtual-vector-size 256 --test-fastest-varying=0 --test-fastest-varying=1 | FileCheck %s +// RUN: mlir-opt %s -affine-super-vectorize -virtual-vector-size 32 -virtual-vector-size 256 --test-fastest-varying=0 --test-fastest-varying=1 | FileCheck %s // Permutation maps used in vectorization. // CHECK-DAG: #[[map_proj_d0d1d2_d2d1:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d2, d1)> diff --git a/mlir/test/Transforms/affine-data-copy.mlir b/mlir/test/Dialect/Affine/affine-data-copy.mlir rename from mlir/test/Transforms/affine-data-copy.mlir rename to mlir/test/Dialect/Affine/affine-data-copy.mlir diff --git a/mlir/test/Transforms/affine-loop-invariant-code-motion.mlir b/mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir rename from mlir/test/Transforms/affine-loop-invariant-code-motion.mlir rename to mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir diff --git a/mlir/test/Transforms/dma-generate.mlir b/mlir/test/Dialect/Affine/dma-generate.mlir rename from mlir/test/Transforms/dma-generate.mlir rename to mlir/test/Dialect/Affine/dma-generate.mlir diff --git a/mlir/test/Transforms/loop-tiling.mlir b/mlir/test/Dialect/Affine/loop-tiling.mlir rename from mlir/test/Transforms/loop-tiling.mlir rename to mlir/test/Dialect/Affine/loop-tiling.mlir --- a/mlir/test/Transforms/loop-tiling.mlir +++ b/mlir/test/Dialect/Affine/loop-tiling.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -split-input-file -affine-loop-tile -tile-size=32 | FileCheck %s -// RUN: mlir-opt %s -split-input-file -affine-loop-tile -tile-cache-size=512 | FileCheck %s --check-prefix=MODEL +// RUN: mlir-opt %s -split-input-file -affine-loop-tile -affine-tile-size=32 | FileCheck %s +// RUN: mlir-opt %s -split-input-file -affine-loop-tile -affine-tile-cache-size=512 | FileCheck %s --check-prefix=MODEL // ----- diff --git a/mlir/test/Transforms/parallelism-detection.mlir b/mlir/test/Dialect/Affine/parallelism-detection.mlir rename from mlir/test/Transforms/parallelism-detection.mlir rename to mlir/test/Dialect/Affine/parallelism-detection.mlir diff --git a/mlir/test/Transforms/simplify-affine-structures.mlir b/mlir/test/Dialect/Affine/simplify-affine-structures.mlir rename from mlir/test/Transforms/simplify-affine-structures.mlir rename to mlir/test/Dialect/Affine/simplify-affine-structures.mlir diff --git a/mlir/test/Transforms/slicing-utils.mlir b/mlir/test/Dialect/Affine/slicing-utils.mlir rename from mlir/test/Transforms/slicing-utils.mlir rename to mlir/test/Dialect/Affine/slicing-utils.mlir --- a/mlir/test/Transforms/slicing-utils.mlir +++ b/mlir/test/Dialect/Affine/slicing-utils.mlir @@ -1,6 +1,6 @@ -// RUN: mlir-opt %s -affine-vectorizer-test -forward-slicing=true 2>&1 | FileCheck %s --check-prefix=FWD -// RUN: mlir-opt %s -affine-vectorizer-test -backward-slicing=true 2>&1 | FileCheck %s --check-prefix=BWD -// RUN: mlir-opt %s -affine-vectorizer-test -slicing=true 2>&1 | FileCheck %s --check-prefix=FWDBWD +// RUN: mlir-opt %s -affine-super-vectorizer-test -forward-slicing=true 2>&1 | FileCheck %s --check-prefix=FWD +// RUN: mlir-opt %s -affine-super-vectorizer-test -backward-slicing=true 2>&1 | FileCheck %s --check-prefix=BWD +// RUN: mlir-opt %s -affine-super-vectorizer-test -slicing=true 2>&1 | FileCheck %s --check-prefix=FWDBWD /// 1 2 3 4 /// |_______| |______| diff --git a/mlir/test/Transforms/unroll-jam.mlir b/mlir/test/Dialect/Affine/unroll-jam.mlir rename from mlir/test/Transforms/unroll-jam.mlir rename to mlir/test/Dialect/Affine/unroll-jam.mlir diff --git a/mlir/test/Transforms/unroll.mlir b/mlir/test/Dialect/Affine/unroll.mlir rename from mlir/test/Transforms/unroll.mlir rename to mlir/test/Dialect/Affine/unroll.mlir diff --git a/mlir/test/lib/Dialect/Affine/CMakeLists.txt b/mlir/test/lib/Dialect/Affine/CMakeLists.txt --- a/mlir/test/lib/Dialect/Affine/CMakeLists.txt +++ b/mlir/test/lib/Dialect/Affine/CMakeLists.txt @@ -1,5 +1,7 @@ add_llvm_library(MLIRAffineTransformsTestPasses TestAffineDataCopy.cpp + TestParallelismDetection.cpp + TestVectorizationUtils.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Affine diff --git a/mlir/test/lib/Transforms/TestParallelismDetection.cpp b/mlir/test/lib/Dialect/Affine/TestParallelismDetection.cpp rename from mlir/test/lib/Transforms/TestParallelismDetection.cpp rename to mlir/test/lib/Dialect/Affine/TestParallelismDetection.cpp diff --git a/mlir/test/lib/Transforms/TestVectorizationUtils.cpp b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp rename from mlir/test/lib/Transforms/TestVectorizationUtils.cpp rename to mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp --- a/mlir/test/lib/Transforms/TestVectorizationUtils.cpp +++ b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp @@ -27,7 +27,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" -#define DEBUG_TYPE "affine-vectorizer-test" +#define DEBUG_TYPE "affine-super-vectorizer-test" using namespace mlir; @@ -284,6 +284,7 @@ namespace mlir { void registerVectorizerTestPass() { PassRegistration pass( - "affine-vectorizer-test", "Tests vectorizer standalone functionality."); + "affine-super-vectorizer-test", + "Tests vectorizer standalone functionality."); } } // namespace mlir diff --git a/mlir/test/lib/Transforms/CMakeLists.txt b/mlir/test/lib/Transforms/CMakeLists.txt --- a/mlir/test/lib/Transforms/CMakeLists.txt +++ b/mlir/test/lib/Transforms/CMakeLists.txt @@ -14,10 +14,8 @@ TestMemRefBoundCheck.cpp TestMemRefDependenceCheck.cpp TestMemRefStrideCalculation.cpp - TestParallelismDetection.cpp TestVectorToLoopsConversion.cpp TestVectorTransforms.cpp - TestVectorizationUtils.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms