From 92ccb8cc50f5098ca4b5642bcfaf7b78761bd892 Mon Sep 17 00:00:00 2001 From: Uday Bondhugula Date: Sun, 30 Jan 2022 17:14:24 +0530 Subject: [PATCH] [MLIR][NFC] Update SCF pass cmd line names to prefix scf Update SCF pass cmd line names to prefix `scf`. This is consistent with guidelines/convention on how to name dialect passes. This also avoids ambiguity on the context given the multiple `for` operations in the tree. NFC. Differential Revision: https://reviews.llvm.org/D118564 --- mlir/include/mlir/Dialect/SCF/Passes.td | 24 ++++++++----------- .../Linalg/tile-scalarize-dynamic-dims.mlir | 2 +- .../SCF/for-loop-canonicalization.mlir | 2 +- mlir/test/Dialect/SCF/for-loop-peeling.mlir | 4 ++-- .../Dialect/SCF/for-loop-specialization.mlir | 2 +- mlir/test/Dialect/SCF/loop-range.mlir | 2 +- .../Dialect/SCF/parallel-loop-fusion.mlir | 2 +- .../SCF/parallel-loop-specialization.mlir | 2 +- .../parallel-loop-tiling-inbound-check.mlir | 2 +- .../Dialect/SCF/parallel-loop-tiling.mlir | 2 +- .../SparseTensor/sparse_vector_peeled.mlir | 2 +- .../Transforms/parallel-loop-collapsing.mlir | 2 +- .../single-parallel-loop-collapsing.mlir | 2 +- 13 files changed, 23 insertions(+), 27 deletions(-) diff --git a/mlir/include/mlir/Dialect/SCF/Passes.td b/mlir/include/mlir/Dialect/SCF/Passes.td index 9e151440792e..b182be54eef8 100644 --- a/mlir/include/mlir/Dialect/SCF/Passes.td +++ b/mlir/include/mlir/Dialect/SCF/Passes.td @@ -21,15 +21,14 @@ def SCFBufferize : Pass<"scf-bufferize", "FuncOp"> { // Note: Making these canonicalization patterns would require a dependency // of the SCF dialect on the Affine/Tensor/MemRef dialects or vice versa. def SCFForLoopCanonicalization - : Pass<"for-loop-canonicalization", "FuncOp"> { + : Pass<"scf-for-loop-canonicalization", "FuncOp"> { let summary = "Canonicalize operations within scf.for loop bodies"; let constructor = "mlir::createSCFForLoopCanonicalizationPass()"; let dependentDialects = ["AffineDialect", "tensor::TensorDialect", "memref::MemRefDialect"]; } -def SCFForLoopPeeling - : Pass<"for-loop-peeling", "FuncOp"> { +def SCFForLoopPeeling : Pass<"scf-for-loop-peeling", "FuncOp"> { let summary = "Peel `for` loops at their upper bounds."; let constructor = "mlir::createForLoopPeelingPass()"; let options = [ @@ -41,18 +40,17 @@ def SCFForLoopPeeling let dependentDialects = ["AffineDialect"]; } -def SCFForLoopSpecialization - : Pass<"for-loop-specialization", "FuncOp"> { +def SCFForLoopSpecialization : Pass<"scf-for-loop-specialization", "FuncOp"> { let summary = "Specialize `for` loops for vectorization"; let constructor = "mlir::createForLoopSpecializationPass()"; } -def SCFParallelLoopFusion : Pass<"parallel-loop-fusion"> { +def SCFParallelLoopFusion : Pass<"scf-parallel-loop-fusion"> { let summary = "Fuse adjacent parallel loops"; let constructor = "mlir::createParallelLoopFusionPass()"; } -def SCFParallelLoopCollapsing : Pass<"parallel-loop-collapsing"> { +def SCFParallelLoopCollapsing : Pass<"scf-parallel-loop-collapsing"> { let summary = "Collapse parallel loops to use less induction variables"; let constructor = "mlir::createParallelLoopCollapsingPass()"; let options = [ @@ -69,12 +67,12 @@ def SCFParallelLoopCollapsing : Pass<"parallel-loop-collapsing"> { } def SCFParallelLoopSpecialization - : Pass<"parallel-loop-specialization", "FuncOp"> { + : Pass<"scf-parallel-loop-specialization", "FuncOp"> { let summary = "Specialize parallel loops for vectorization"; let constructor = "mlir::createParallelLoopSpecializationPass()"; } -def SCFParallelLoopTiling : Pass<"parallel-loop-tiling", "FuncOp"> { +def SCFParallelLoopTiling : Pass<"scf-parallel-loop-tiling", "FuncOp"> { let summary = "Tile parallel loops"; let constructor = "mlir::createParallelLoopTilingPass()"; let options = [ @@ -89,14 +87,12 @@ def SCFParallelLoopTiling : Pass<"parallel-loop-tiling", "FuncOp"> { let dependentDialects = ["AffineDialect"]; } -def SCFForLoopRangeFolding - : Pass<"for-loop-range-folding"> { +def SCFForLoopRangeFolding : Pass<"scf-for-loop-range-folding"> { let summary = "Fold add/mul ops into loop range"; let constructor = "mlir::createForLoopRangeFoldingPass()"; } -def SCFForToWhileLoop - : Pass<"scf-for-to-while", "FuncOp"> { +def SCFForToWhileLoop : Pass<"scf-for-to-while", "FuncOp"> { let summary = "Convert SCF for loops to SCF while loops"; let constructor = "mlir::createForToWhileLoopPass()"; let description = [{ @@ -120,7 +116,7 @@ def SCFForToWhileLoop %1 = arith.cmpi slt, %i, %arg1 : index scf.condition(%1) %i : index } do { - ^bb0(%i: index): + ^bb0(%i: index): %1 = arith.addi %i, %c1 : index %2 = arith.addi %arg2, %arg2 : i32 memref.store %2, %arg0[%i] : memref diff --git a/mlir/test/Dialect/Linalg/tile-scalarize-dynamic-dims.mlir b/mlir/test/Dialect/Linalg/tile-scalarize-dynamic-dims.mlir index 46cb460274c5..df372159a337 100644 --- a/mlir/test/Dialect/Linalg/tile-scalarize-dynamic-dims.mlir +++ b/mlir/test/Dialect/Linalg/tile-scalarize-dynamic-dims.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -test-linalg-transform-patterns="test-tile-scalarize-dynamic-dims" -for-loop-canonicalization -canonicalize -split-input-file | \ +// RUN: mlir-opt %s -test-linalg-transform-patterns="test-tile-scalarize-dynamic-dims" -scf-for-loop-canonicalization -canonicalize -split-input-file | \ // RUN: FileCheck %s // CHECK-LABEL: func @matmul_partly_dynamic_tensor( diff --git a/mlir/test/Dialect/SCF/for-loop-canonicalization.mlir b/mlir/test/Dialect/SCF/for-loop-canonicalization.mlir index 79a692f9d59b..e26dfa937a52 100644 --- a/mlir/test/Dialect/SCF/for-loop-canonicalization.mlir +++ b/mlir/test/Dialect/SCF/for-loop-canonicalization.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -for-loop-canonicalization -split-input-file | FileCheck %s +// RUN: mlir-opt %s -scf-for-loop-canonicalization -split-input-file | FileCheck %s // CHECK-LABEL: func @scf_for_canonicalize_min // CHECK: %[[C2:.*]] = arith.constant 2 : i64 diff --git a/mlir/test/Dialect/SCF/for-loop-peeling.mlir b/mlir/test/Dialect/SCF/for-loop-peeling.mlir index e138dcf2bd10..fb23ae2c14d3 100644 --- a/mlir/test/Dialect/SCF/for-loop-peeling.mlir +++ b/mlir/test/Dialect/SCF/for-loop-peeling.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -for-loop-peeling -canonicalize -split-input-file | FileCheck %s -// RUN: mlir-opt %s -for-loop-peeling=skip-partial=false -canonicalize -split-input-file | FileCheck %s -check-prefix=CHECK-NO-SKIP +// RUN: mlir-opt %s -scf-for-loop-peeling -canonicalize -split-input-file | FileCheck %s +// RUN: mlir-opt %s -scf-for-loop-peeling=skip-partial=false -canonicalize -split-input-file | FileCheck %s -check-prefix=CHECK-NO-SKIP // CHECK-DAG: #[[MAP0:.*]] = affine_map<()[s0, s1, s2] -> (s1 - (-s0 + s1) mod s2)> // CHECK-DAG: #[[MAP1:.*]] = affine_map<(d0)[s0] -> (-d0 + s0)> diff --git a/mlir/test/Dialect/SCF/for-loop-specialization.mlir b/mlir/test/Dialect/SCF/for-loop-specialization.mlir index c525178f3820..d0e1c286b638 100644 --- a/mlir/test/Dialect/SCF/for-loop-specialization.mlir +++ b/mlir/test/Dialect/SCF/for-loop-specialization.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -for-loop-specialization -split-input-file | FileCheck %s +// RUN: mlir-opt %s -scf-for-loop-specialization -split-input-file | FileCheck %s #map0 = affine_map<()[s0, s1] -> (1024, s0 - s1)> #map1 = affine_map<()[s0, s1] -> (64, s0 - s1)> diff --git a/mlir/test/Dialect/SCF/loop-range.mlir b/mlir/test/Dialect/SCF/loop-range.mlir index 95804f7ccd55..9fe80079e245 100644 --- a/mlir/test/Dialect/SCF/loop-range.mlir +++ b/mlir/test/Dialect/SCF/loop-range.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='builtin.func(for-loop-range-folding)' -split-input-file | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(scf-for-loop-range-folding)' -split-input-file | FileCheck %s func @fold_one_loop(%arg0: memref, %arg1: index, %arg2: index) { %c0 = arith.constant 0 : index diff --git a/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir b/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir index e938f4d097f8..2dc78aa36f61 100644 --- a/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir +++ b/mlir/test/Dialect/SCF/parallel-loop-fusion.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(parallel-loop-fusion)' -split-input-file | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(scf-parallel-loop-fusion)' -split-input-file | FileCheck %s func @fuse_empty_loops() { %c2 = arith.constant 2 : index diff --git a/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir b/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir index efde77eb107d..bbdcbd13947f 100644 --- a/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir +++ b/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -parallel-loop-specialization -split-input-file | FileCheck %s +// RUN: mlir-opt %s -scf-parallel-loop-specialization -split-input-file | FileCheck %s #map0 = affine_map<()[s0, s1] -> (1024, s0 - s1)> #map1 = affine_map<()[s0, s1] -> (64, s0 - s1)> diff --git a/mlir/test/Dialect/SCF/parallel-loop-tiling-inbound-check.mlir b/mlir/test/Dialect/SCF/parallel-loop-tiling-inbound-check.mlir index b89358d91259..53a51de2d576 100644 --- a/mlir/test/Dialect/SCF/parallel-loop-tiling-inbound-check.mlir +++ b/mlir/test/Dialect/SCF/parallel-loop-tiling-inbound-check.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='builtin.func(parallel-loop-tiling{parallel-loop-tile-sizes=1,4 no-min-max-bounds=true})' -split-input-file | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4 no-min-max-bounds=true})' -split-input-file | FileCheck %s func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, diff --git a/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir b/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir index 01d49c656b02..7939dce71dc3 100644 --- a/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir +++ b/mlir/test/Dialect/SCF/parallel-loop-tiling.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -pass-pipeline='builtin.func(parallel-loop-tiling{parallel-loop-tile-sizes=1,4})' -split-input-file | FileCheck %s +// RUN: mlir-opt %s -pass-pipeline='builtin.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4})' -split-input-file | FileCheck %s func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, diff --git a/mlir/test/Dialect/SparseTensor/sparse_vector_peeled.mlir b/mlir/test/Dialect/SparseTensor/sparse_vector_peeled.mlir index 79523598856d..c48a62029124 100644 --- a/mlir/test/Dialect/SparseTensor/sparse_vector_peeled.mlir +++ b/mlir/test/Dialect/SparseTensor/sparse_vector_peeled.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -sparsification="vectorization-strategy=2 vl=16" -for-loop-peeling -canonicalize | \ +// RUN: mlir-opt %s -sparsification="vectorization-strategy=2 vl=16" -scf-for-loop-peeling -canonicalize | \ // RUN: FileCheck %s #SparseVector = #sparse_tensor.encoding<{ diff --git a/mlir/test/Transforms/parallel-loop-collapsing.mlir b/mlir/test/Transforms/parallel-loop-collapsing.mlir index c62735716822..da715b7b1283 100644 --- a/mlir/test/Transforms/parallel-loop-collapsing.mlir +++ b/mlir/test/Transforms/parallel-loop-collapsing.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(parallel-loop-collapsing{collapsed-indices-0=0,3 collapsed-indices-1=1,4 collapsed-indices-2=2}, canonicalize)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(scf-parallel-loop-collapsing{collapsed-indices-0=0,3 collapsed-indices-1=1,4 collapsed-indices-2=2}, canonicalize)' | FileCheck %s // CHECK-LABEL: func @parallel_many_dims() { func @parallel_many_dims() { diff --git a/mlir/test/Transforms/single-parallel-loop-collapsing.mlir b/mlir/test/Transforms/single-parallel-loop-collapsing.mlir index 0d79f989fd07..f521341f336e 100644 --- a/mlir/test/Transforms/single-parallel-loop-collapsing.mlir +++ b/mlir/test/Transforms/single-parallel-loop-collapsing.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(parallel-loop-collapsing{collapsed-indices-0=0,1}, canonicalize)' | FileCheck %s +// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.func(scf-parallel-loop-collapsing{collapsed-indices-0=0,1}, canonicalize)' | FileCheck %s func @collapse_to_single() { %c0 = arith.constant 3 : index