diff --git a/flang/tools/tco/CMakeLists.txt b/flang/tools/tco/CMakeLists.txt --- a/flang/tools/tco/CMakeLists.txt +++ b/flang/tools/tco/CMakeLists.txt @@ -11,7 +11,7 @@ MLIRTransforms MLIRAffineToStandard MLIRAnalysis - MLIRLoopToStandard + MLIRSCFToStandard MLIREDSC MLIRParser MLIRStandardToLLVM diff --git a/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp b/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp --- a/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp +++ b/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp @@ -16,7 +16,7 @@ #include "toy/Passes.h" #include "mlir/Conversion/AffineToStandard/AffineToStandard.h" -#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h" +#include "mlir/Conversion/SCFToStandard/SCFToStandard.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" #include "mlir/Dialect/Affine/IR/AffineOps.h" diff --git a/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp b/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp --- a/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp +++ b/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp @@ -16,7 +16,7 @@ #include "toy/Passes.h" #include "mlir/Conversion/AffineToStandard/AffineToStandard.h" -#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h" +#include "mlir/Conversion/SCFToStandard/SCFToStandard.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" #include "mlir/Dialect/Affine/IR/AffineOps.h" diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td --- a/mlir/include/mlir/Conversion/Passes.td +++ b/mlir/include/mlir/Conversion/Passes.td @@ -151,22 +151,22 @@ } //===----------------------------------------------------------------------===// -// LoopToStandard +// SCFToStandard //===----------------------------------------------------------------------===// -def ConvertLoopToStandard : Pass<"convert-loop-to-std"> { +def SCFToStandard : Pass<"convert-scf-to-std"> { let summary = "Convert SCF dialect to Standard dialect, replacing structured" " control flow with a CFG"; let constructor = "mlir::createLowerToCFGPass()"; } //===----------------------------------------------------------------------===// -// LoopsToGPU +// SCFToGPU //===----------------------------------------------------------------------===// -def ConvertSimpleLoopsToGPU : FunctionPass<"convert-loops-to-gpu"> { +def ConvertSimpleSCFToGPU : FunctionPass<"convert-scf-to-gpu"> { let summary = "Convert top-level loops to GPU kernels"; - let constructor = "mlir::createSimpleLoopsToGPUPass()"; + let constructor = "mlir::createSimpleSCFToGPUPass()"; let options = [ Option<"numBlockDims", "gpu-block-dims", "unsigned", /*default=*/"1u", "Number of GPU block dimensions for mapping">, @@ -175,7 +175,7 @@ ]; } -def ConvertLoopsToGPU : FunctionPass<"convert-loop-op-to-gpu"> { +def ConvertSCFToGPU : FunctionPass<"convert-loop-op-to-gpu"> { let summary = "Convert top-level scf::ForOp to GPU kernels"; let constructor = "mlir::createLoopToGPUPass()"; let options = [ diff --git a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPU.h b/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h rename from mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPU.h rename to mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h --- a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPU.h +++ b/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h @@ -1,12 +1,12 @@ -//===- LoopsToGPU.h - Convert loop nests to GPU kernels ---------*- C++ -*-===// +//===- SCFToGPU.h - Convert loop nests to GPU kernels -----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_LOOPSTOGPU_LOOPSTOGPU_H_ -#define MLIR_CONVERSION_LOOPSTOGPU_LOOPSTOGPU_H_ +#ifndef MLIR_CONVERSION_SCFTOGPU_SCFTOGPU_H_ +#define MLIR_CONVERSION_SCFTOGPU_SCFTOGPU_H_ #include "mlir/Support/LLVM.h" @@ -81,4 +81,4 @@ } // namespace mlir -#endif // MLIR_CONVERSION_LOOPSTOGPU_LOOPSTOGPU_H_ +#endif // MLIR_CONVERSION_SCFTOGPU_SCFTOGPU_H_ diff --git a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h b/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h rename from mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h rename to mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h --- a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h +++ b/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h @@ -1,4 +1,4 @@ -//===- LoopsToGPUPass.h - Pass converting loops to GPU kernels --*- C++ -*-===// +//===- SCFToGPUPass.h - Pass converting loops to GPU kernels ----*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -14,7 +14,8 @@ namespace mlir { class FuncOp; -template class OperationPass; +template +class OperationPass; class Pass; /// Create a pass that converts loop nests into GPU kernels. It considers @@ -26,8 +27,8 @@ /// to strip-mine the loops and to perform the dependence analysis before /// calling the conversion. std::unique_ptr> -createSimpleLoopsToGPUPass(unsigned numBlockDims, unsigned numThreadDims); -std::unique_ptr> createSimpleLoopsToGPUPass(); +createSimpleSCFToGPUPass(unsigned numBlockDims, unsigned numThreadDims); +std::unique_ptr> createSimpleSCFToGPUPass(); /// Create a pass that converts every loop operation within the body of the /// FuncOp into a GPU launch. The number of workgroups and workgroup size for diff --git a/mlir/include/mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h b/mlir/include/mlir/Conversion/SCFToStandard/SCFToStandard.h rename from mlir/include/mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h rename to mlir/include/mlir/Conversion/SCFToStandard/SCFToStandard.h --- a/mlir/include/mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h +++ b/mlir/include/mlir/Conversion/SCFToStandard/SCFToStandard.h @@ -1,4 +1,4 @@ -//===- ConvertLoopToStandard.h - Pass entrypoint ----------------*- C++ -*-===// +//===- ConvertSCFToStandard.h - Pass entrypoint -----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_LOOPTOSTANDARD_CONVERTLOOPTOSTANDARD_H_ -#define MLIR_CONVERSION_LOOPTOSTANDARD_CONVERTLOOPTOSTANDARD_H_ +#ifndef MLIR_CONVERSION_SCFTOSTANDARD_SCFTOSTANDARD_H_ +#define MLIR_CONVERSION_SCFTOSTANDARD_SCFTOSTANDARD_H_ #include #include @@ -32,4 +32,4 @@ } // namespace mlir -#endif // MLIR_CONVERSION_LOOPTOSTANDARD_CONVERTLOOPTOSTANDARD_H_ +#endif // MLIR_CONVERSION_SCFTOSTANDARD_SCFTOSTANDARD_H_ diff --git a/mlir/include/mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h b/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h rename from mlir/include/mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h rename to mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h --- a/mlir/include/mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h +++ b/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h @@ -1,4 +1,4 @@ -//===- ConvertVectorToLoops.h - Utils to convert from the vector dialect --===// +//===- VectorToSCF.h - Utils to convert from the vector dialect -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,17 +6,17 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLOOPS_H_ -#define MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLOOPS_H_ +#ifndef MLIR_CONVERSION_VECTORTOSCF_VECTORTOSCF_H_ +#define MLIR_CONVERSION_VECTORTOSCF_VECTORTOSCF_H_ namespace mlir { class MLIRContext; class OwningRewritePatternList; /// Collect a set of patterns to convert from the Vector dialect to loops + std. -void populateVectorToLoopsConversionPatterns(OwningRewritePatternList &patterns, - MLIRContext *context); +void populateVectorToSCFConversionPatterns(OwningRewritePatternList &patterns, + MLIRContext *context); } // namespace mlir -#endif // MLIR_CONVERSION_VECTORTOLLVM_CONVERTVECTORTOLOOPS_H_ +#endif // MLIR_CONVERSION_VECTORTOSCF_VECTORTOSCF_H_ diff --git a/mlir/include/mlir/Dialect/GPU/ParallelLoopMapper.h b/mlir/include/mlir/Dialect/GPU/ParallelLoopMapper.h --- a/mlir/include/mlir/Dialect/GPU/ParallelLoopMapper.h +++ b/mlir/include/mlir/Dialect/GPU/ParallelLoopMapper.h @@ -63,7 +63,7 @@ /// encountered to the local workgroup. Within each mapping, the first three /// dimensions are mapped to x/y/z hardware ids and all following dimensions are /// mapped to sequential loops. -void greedilyMapParallelLoopsToGPU(Region ®ion); +void greedilyMapParallelSCFToGPU(Region ®ion); } // end namespace mlir #endif // MLIR_DIALECT_GPU_PARALLELLOOPMAPPER_H diff --git a/mlir/include/mlir/Dialect/Vector/VectorTransforms.h b/mlir/include/mlir/Dialect/Vector/VectorTransforms.h --- a/mlir/include/mlir/Dialect/Vector/VectorTransforms.h +++ b/mlir/include/mlir/Dialect/Vector/VectorTransforms.h @@ -16,7 +16,7 @@ class OwningRewritePatternList; /// Collect a set of patterns to convert from the Vector dialect to itself. -/// Should be merged with populateVectorToLoopsLoweringPattern. +/// Should be merged with populateVectorToSCFLoweringPattern. void populateVectorToVectorConversionPatterns( MLIRContext *context, OwningRewritePatternList &patterns, ArrayRef coarseVectorShape = {}, diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h --- a/mlir/include/mlir/InitAllPasses.h +++ b/mlir/include/mlir/InitAllPasses.h @@ -22,8 +22,8 @@ #include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h" #include "mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h" #include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h" -#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h" -#include "mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h" +#include "mlir/Conversion/SCFToGPU/SCFToGPUPass.h" +#include "mlir/Conversion/SCFToStandard/SCFToStandard.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" #include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h" #include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h" diff --git a/mlir/lib/Conversion/CMakeLists.txt b/mlir/lib/Conversion/CMakeLists.txt --- a/mlir/lib/Conversion/CMakeLists.txt +++ b/mlir/lib/Conversion/CMakeLists.txt @@ -7,9 +7,9 @@ add_subdirectory(GPUToVulkan) add_subdirectory(LinalgToLLVM) add_subdirectory(LinalgToSPIRV) -add_subdirectory(LoopsToGPU) -add_subdirectory(LoopToStandard) +add_subdirectory(SCFToGPU) +add_subdirectory(SCFToStandard) add_subdirectory(StandardToLLVM) add_subdirectory(StandardToSPIRV) add_subdirectory(VectorToLLVM) -add_subdirectory(VectorToLoops) +add_subdirectory(VectorToSCF) diff --git a/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt b/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt --- a/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt +++ b/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt @@ -17,9 +17,9 @@ MLIRIR MLIRLinalgOps MLIRLLVMIR - MLIRLoopToStandard + MLIRSCFToStandard MLIRStandardToLLVM - MLIRVectorToLLVM - MLIRVectorToLoops MLIRTransforms + MLIRVectorToLLVM + MLIRVectorToSCF ) diff --git a/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp b/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp --- a/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp +++ b/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp @@ -10,11 +10,11 @@ #include "../PassDetail.h" #include "mlir/Conversion/AffineToStandard/AffineToStandard.h" -#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h" +#include "mlir/Conversion/SCFToStandard/SCFToStandard.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" #include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h" -#include "mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h" +#include "mlir/Conversion/VectorToSCF/VectorToSCF.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/Linalg/IR/LinalgOps.h" #include "mlir/Dialect/Linalg/IR/LinalgTypes.h" @@ -576,7 +576,7 @@ populateAffineToStdConversionPatterns(patterns, &getContext()); populateLoopToStdConversionPatterns(patterns, &getContext()); populateStdToLLVMConversionPatterns(converter, patterns); - populateVectorToLoopsConversionPatterns(patterns, &getContext()); + populateVectorToSCFConversionPatterns(patterns, &getContext()); populateVectorToLLVMMatrixConversionPatterns(converter, patterns); populateVectorToLLVMConversionPatterns(converter, patterns); populateLinalgToStandardConversionPatterns(patterns, &getContext()); diff --git a/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt b/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt rename from mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt rename to mlir/lib/Conversion/SCFToGPU/CMakeLists.txt --- a/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt +++ b/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt @@ -1,9 +1,9 @@ -add_mlir_conversion_library(MLIRLoopsToGPU - LoopsToGPU.cpp - LoopsToGPUPass.cpp +add_mlir_conversion_library(MLIRSCFToGPU + SCFToGPU.cpp + SCFToGPUPass.cpp ADDITIONAL_HEADER_DIRS - ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopsToGPU + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/SCFToGPU DEPENDS MLIRConversionPassIncGen diff --git a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp rename from mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp rename to mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp --- a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp +++ b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp @@ -1,4 +1,4 @@ -//===- LoopsToGPU.cpp - Convert an affine loop nest to a GPU kernel -------===// +//===- SCFToGPU.cpp - Convert an affine loop nest to a GPU kernel -------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/LoopsToGPU/LoopsToGPU.h" +#include "mlir/Conversion/SCFToGPU/SCFToGPU.h" #include "mlir/Conversion/AffineToStandard/AffineToStandard.h" #include "mlir/Dialect/Affine/IR/AffineOps.h" diff --git a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp b/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp rename from mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp rename to mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp --- a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp +++ b/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp @@ -1,4 +1,4 @@ -//===- LoopsToGPUPass.cpp - Convert a loop nest to a GPU kernel -----------===// +//===- SCFToGPUPass.cpp - Convert a loop nest to a GPU kernel -----------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h" +#include "mlir/Conversion/SCFToGPU/SCFToGPUPass.h" #include "../PassDetail.h" -#include "mlir/Conversion/LoopsToGPU/LoopsToGPU.h" +#include "mlir/Conversion/SCFToGPU/SCFToGPU.h" #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/GPU/GPUDialect.h" #include "mlir/Dialect/SCF/SCF.h" @@ -18,7 +18,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/CommandLine.h" -#define PASS_NAME "convert-loops-to-gpu" +#define PASS_NAME "convert-scf-to-gpu" #define LOOPOP_TO_GPU_PASS_NAME "convert-loop-op-to-gpu" using namespace mlir; @@ -28,7 +28,7 @@ // A pass that traverses top-level loops in the function and converts them to // GPU launch operations. Nested launches are not allowed, so this does not // walk the function recursively to avoid considering nested loops. -struct ForLoopMapper : public ConvertSimpleLoopsToGPUBase { +struct ForLoopMapper : public ConvertSimpleSCFToGPUBase { ForLoopMapper() = default; ForLoopMapper(unsigned numBlockDims, unsigned numThreadDims) { this->numBlockDims = numBlockDims; @@ -56,7 +56,7 @@ // nested loops as the size of `numWorkGroups`. Within these any loop nest has // to be perfectly nested upto depth equal to size of `workGroupSize`. struct ImperfectlyNestedForLoopMapper - : public ConvertLoopsToGPUBase { + : public ConvertSCFToGPUBase { ImperfectlyNestedForLoopMapper() = default; ImperfectlyNestedForLoopMapper(ArrayRef numWorkGroups, ArrayRef workGroupSize) { @@ -108,11 +108,10 @@ } // namespace std::unique_ptr> -mlir::createSimpleLoopsToGPUPass(unsigned numBlockDims, - unsigned numThreadDims) { +mlir::createSimpleSCFToGPUPass(unsigned numBlockDims, unsigned numThreadDims) { return std::make_unique(numBlockDims, numThreadDims); } -std::unique_ptr> mlir::createSimpleLoopsToGPUPass() { +std::unique_ptr> mlir::createSimpleSCFToGPUPass() { return std::make_unique(); } diff --git a/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt b/mlir/lib/Conversion/SCFToStandard/CMakeLists.txt rename from mlir/lib/Conversion/LoopToStandard/CMakeLists.txt rename to mlir/lib/Conversion/SCFToStandard/CMakeLists.txt --- a/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt +++ b/mlir/lib/Conversion/SCFToStandard/CMakeLists.txt @@ -1,8 +1,8 @@ -add_mlir_conversion_library(MLIRLoopToStandard - LoopToStandard.cpp +add_mlir_conversion_library(MLIRSCFToStandard + SCFToStandard.cpp ADDITIONAL_HEADER_DIRS - ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/LoopToStandard + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/SCFToStandard DEPENDS MLIRConversionPassIncGen diff --git a/mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp b/mlir/lib/Conversion/SCFToStandard/SCFToStandard.cpp rename from mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp rename to mlir/lib/Conversion/SCFToStandard/SCFToStandard.cpp --- a/mlir/lib/Conversion/LoopToStandard/LoopToStandard.cpp +++ b/mlir/lib/Conversion/SCFToStandard/SCFToStandard.cpp @@ -1,4 +1,4 @@ -//===- LoopToStandard.cpp - ControlFlow to CFG conversion -----------------===// +//===- SCFToStandard.cpp - ControlFlow to CFG conversion ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// +#include "mlir/Conversion/SCFToStandard/SCFToStandard.h" #include "../PassDetail.h" -#include "mlir/Conversion/LoopToStandard/ConvertLoopToStandard.h" #include "mlir/Dialect/SCF/SCF.h" #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/BlockAndValueMapping.h" @@ -29,8 +29,7 @@ namespace { -struct LoopToStandardPass - : public ConvertLoopToStandardBase { +struct SCFToStandardPass : public SCFToStandardBase { void runOnOperation() override; }; @@ -405,7 +404,7 @@ patterns.insert(ctx); } -void LoopToStandardPass::runOnOperation() { +void SCFToStandardPass::runOnOperation() { OwningRewritePatternList patterns; populateLoopToStdConversionPatterns(patterns, &getContext()); ConversionTarget target(getContext()); @@ -415,5 +414,5 @@ } std::unique_ptr mlir::createLowerToCFGPass() { - return std::make_unique(); + return std::make_unique(); } diff --git a/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt b/mlir/lib/Conversion/VectorToSCF/CMakeLists.txt rename from mlir/lib/Conversion/VectorToLoops/CMakeLists.txt rename to mlir/lib/Conversion/VectorToSCF/CMakeLists.txt --- a/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt +++ b/mlir/lib/Conversion/VectorToSCF/CMakeLists.txt @@ -1,8 +1,8 @@ -add_mlir_conversion_library(MLIRVectorToLoops - ConvertVectorToLoops.cpp +add_mlir_conversion_library(MLIRVectorToSCF + VectorToSCF.cpp ADDITIONAL_HEADER_DIRS - ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLoops + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToSCF LINK_COMPONENTS Core diff --git a/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp rename from mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp rename to mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp --- a/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp +++ b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp @@ -1,4 +1,4 @@ -//===- VectorToLoops.cpp - Conversion from Vector to mix of Loops and Std -===// +//===- VectorToSCF.cpp - Conversion from Vector to mix of SCF and Std -----===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,7 +12,7 @@ #include -#include "mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h" +#include "mlir/Conversion/VectorToSCF/VectorToSCF.h" #include "mlir/Dialect/Affine/EDSC/Intrinsics.h" #include "mlir/Dialect/SCF/EDSC/Builders.h" #include "mlir/Dialect/SCF/EDSC/Intrinsics.h" @@ -583,7 +583,7 @@ } // namespace -void mlir::populateVectorToLoopsConversionPatterns( +void mlir::populateVectorToSCFConversionPatterns( OwningRewritePatternList &patterns, MLIRContext *context) { patterns.insert, VectorTransferRewriter>(context); diff --git a/mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp b/mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp --- a/mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp @@ -146,6 +146,6 @@ } } -void mlir::greedilyMapParallelLoopsToGPU(Region ®ion) { +void mlir::greedilyMapParallelSCFToGPU(Region ®ion) { region.walk([](ParallelOp parallelOp) { mapParallelOp(parallelOp); }); } diff --git a/mlir/lib/Dialect/Vector/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/VectorTransforms.cpp --- a/mlir/lib/Dialect/Vector/VectorTransforms.cpp +++ b/mlir/lib/Dialect/Vector/VectorTransforms.cpp @@ -1,4 +1,4 @@ -//===- VectorToLoops.cpp - Conversion within the Vector dialect -----------===// +//===- VectorTransforms.cpp - Conversion within the Vector dialect --------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/mlir/test/Conversion/LoopsToGPU/linalg_to_gpu.mlir b/mlir/test/Conversion/LoopsToGPU/linalg_to_gpu.mlir --- a/mlir/test/Conversion/LoopsToGPU/linalg_to_gpu.mlir +++ b/mlir/test/Conversion/LoopsToGPU/linalg_to_gpu.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -convert-loops-to-gpu %s | FileCheck %s +// RUN: mlir-opt -convert-scf-to-gpu %s | FileCheck %s // CHECK-LABEL: @foo func @foo(%arg0: memref, %arg1 : index) { diff --git a/mlir/test/Conversion/LoopsToGPU/no_blocks_no_threads.mlir b/mlir/test/Conversion/LoopsToGPU/no_blocks_no_threads.mlir --- a/mlir/test/Conversion/LoopsToGPU/no_blocks_no_threads.mlir +++ b/mlir/test/Conversion/LoopsToGPU/no_blocks_no_threads.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt -convert-loops-to-gpu="gpu-block-dims=0 gpu-thread-dims=1" %s | FileCheck --check-prefix=CHECK-THREADS %s --dump-input-on-failure -// RUN: mlir-opt -convert-loops-to-gpu="gpu-block-dims=1 gpu-thread-dims=0" %s | FileCheck --check-prefix=CHECK-BLOCKS %s --dump-input-on-failure +// RUN: mlir-opt -convert-scf-to-gpu="gpu-block-dims=0 gpu-thread-dims=1" %s | FileCheck --check-prefix=CHECK-THREADS %s --dump-input-on-failure +// RUN: mlir-opt -convert-scf-to-gpu="gpu-block-dims=1 gpu-thread-dims=0" %s | FileCheck --check-prefix=CHECK-BLOCKS %s --dump-input-on-failure // CHECK-THREADS-LABEL: @one_d_loop // CHECK-BLOCKS-LABEL: @one_d_loop diff --git a/mlir/test/Conversion/LoopsToGPU/step_one.mlir b/mlir/test/Conversion/LoopsToGPU/step_one.mlir --- a/mlir/test/Conversion/LoopsToGPU/step_one.mlir +++ b/mlir/test/Conversion/LoopsToGPU/step_one.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt -convert-loops-to-gpu="gpu-block-dims=1 gpu-thread-dims=1" %s | FileCheck --check-prefix=CHECK-11 %s -// RUN: mlir-opt -convert-loops-to-gpu="gpu-block-dims=2 gpu-thread-dims=2" %s | FileCheck --check-prefix=CHECK-22 %s +// RUN: mlir-opt -convert-scf-to-gpu="gpu-block-dims=1 gpu-thread-dims=1" %s | FileCheck --check-prefix=CHECK-11 %s +// RUN: mlir-opt -convert-scf-to-gpu="gpu-block-dims=2 gpu-thread-dims=2" %s | FileCheck --check-prefix=CHECK-22 %s // CHECK-11-LABEL: @step_1 // CHECK-22-LABEL: @step_1 diff --git a/mlir/test/Conversion/LoopsToGPU/step_positive.mlir b/mlir/test/Conversion/LoopsToGPU/step_positive.mlir --- a/mlir/test/Conversion/LoopsToGPU/step_positive.mlir +++ b/mlir/test/Conversion/LoopsToGPU/step_positive.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -convert-loops-to-gpu="gpu-block-dims=1 gpu-thread-dims=1" %s | FileCheck %s +// RUN: mlir-opt -convert-scf-to-gpu="gpu-block-dims=1 gpu-thread-dims=1" %s | FileCheck %s // CHECK-LABEL: @step_var func @step_var(%A : memref, %B : memref) { diff --git a/mlir/test/Conversion/VectorToLoops/vector-to-loops.mlir b/mlir/test/Conversion/VectorToLoops/vector-to-loops.mlir --- a/mlir/test/Conversion/VectorToLoops/vector-to-loops.mlir +++ b/mlir/test/Conversion/VectorToLoops/vector-to-loops.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -test-convert-vector-to-loops -split-input-file | FileCheck %s +// RUN: mlir-opt %s -test-convert-vector-to-scf -split-input-file | FileCheck %s // CHECK-LABEL: func @materialize_read_1d() { func @materialize_read_1d() { diff --git a/mlir/test/Conversion/convert-to-cfg.mlir b/mlir/test/Conversion/convert-to-cfg.mlir --- a/mlir/test/Conversion/convert-to-cfg.mlir +++ b/mlir/test/Conversion/convert-to-cfg.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -convert-loop-to-std %s | FileCheck %s +// RUN: mlir-opt -convert-scf-to-std %s | FileCheck %s // CHECK-LABEL: func @simple_std_for_loop(%{{.*}}: index, %{{.*}}: index, %{{.*}}: index) { // CHECK-NEXT: br ^bb1(%{{.*}} : index) 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 @@ -19,7 +19,7 @@ TestMemRefBoundCheck.cpp TestMemRefDependenceCheck.cpp TestMemRefStrideCalculation.cpp - TestVectorToLoopsConversion.cpp + TestVectorToSCFConversion.cpp TestVectorTransforms.cpp EXCLUDE_FROM_LIBMLIR @@ -45,7 +45,7 @@ MLIRStandardOpsTransforms MLIRTestDialect MLIRTransformUtils - MLIRVectorToLoops + MLIRVectorToSCF MLIRVector ) diff --git a/mlir/test/lib/Transforms/TestGpuParallelLoopMapping.cpp b/mlir/test/lib/Transforms/TestGpuParallelLoopMapping.cpp --- a/mlir/test/lib/Transforms/TestGpuParallelLoopMapping.cpp +++ b/mlir/test/lib/Transforms/TestGpuParallelLoopMapping.cpp @@ -25,7 +25,7 @@ void runOnOperation() override { Operation *op = getOperation(); for (Region ®ion : op->getRegions()) - greedilyMapParallelLoopsToGPU(region); + greedilyMapParallelSCFToGPU(region); } }; } // end namespace diff --git a/mlir/test/lib/Transforms/TestVectorToLoopsConversion.cpp b/mlir/test/lib/Transforms/TestVectorToSCFConversion.cpp rename from mlir/test/lib/Transforms/TestVectorToLoopsConversion.cpp rename to mlir/test/lib/Transforms/TestVectorToSCFConversion.cpp --- a/mlir/test/lib/Transforms/TestVectorToLoopsConversion.cpp +++ b/mlir/test/lib/Transforms/TestVectorToSCFConversion.cpp @@ -1,4 +1,4 @@ -//===- TestVectorToLoopsConversion.cpp - Test VectorTransfers lowering ----===// +//===- TestVectorToSCFConversion.cpp - Test VectorTransfers lowering ------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,7 +8,7 @@ #include -#include "mlir/Conversion/VectorToLoops/ConvertVectorToLoops.h" +#include "mlir/Conversion/VectorToSCF/VectorToSCF.h" #include "mlir/IR/PatternMatch.h" #include "mlir/Pass/Pass.h" #include "mlir/Transforms/Passes.h" @@ -17,12 +17,12 @@ namespace { -struct TestVectorToLoopsPass - : public PassWrapper { +struct TestVectorToSCFPass + : public PassWrapper { void runOnFunction() override { OwningRewritePatternList patterns; auto *context = &getContext(); - populateVectorToLoopsConversionPatterns(patterns, context); + populateVectorToSCFConversionPatterns(patterns, context); applyPatternsAndFoldGreedily(getFunction(), patterns); } }; @@ -30,9 +30,9 @@ } // end anonymous namespace namespace mlir { -void registerTestVectorToLoopsPass() { - PassRegistration pass( - "test-convert-vector-to-loops", +void registerTestVectorToSCFPass() { + PassRegistration pass( + "test-convert-vector-to-scf", "Converts vector transfer ops to loops over scalars and vector casts"); } } // namespace mlir diff --git a/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir b/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir --- a/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir +++ b/mlir/test/mlir-cpu-runner/bare_ptr_call_conv.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -convert-loop-to-std -convert-std-to-llvm='use-bare-ptr-memref-call-conv=1' | mlir-cpu-runner -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext -entry-point-result=void | FileCheck %s +// RUN: mlir-opt %s -convert-scf-to-std -convert-std-to-llvm='use-bare-ptr-memref-call-conv=1' | mlir-cpu-runner -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext -entry-point-result=void | FileCheck %s // Verify bare pointer memref calling convention. `simple_add1_add2_test` // gets two 2xf32 memrefs, adds 1.0f to the first one and 2.0f to the second diff --git a/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir b/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir --- a/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir +++ b/mlir/test/mlir-cpu-runner/sgemm_naive_codegen.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt -convert-linalg-to-loops -lower-affine -convert-loop-to-std -convert-std-to-llvm %s | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext | FileCheck %s +// RUN: mlir-opt -convert-linalg-to-loops -lower-affine -convert-scf-to-std -convert-std-to-llvm %s | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext | FileCheck %s func @main() { %A = alloc() : memref<64x64xf32> diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -61,7 +61,7 @@ void registerTestParallelismDetection(); void registerTestGpuParallelLoopMappingPass(); void registerTestVectorConversions(); -void registerTestVectorToLoopsPass(); +void registerTestVectorToSCFPass(); void registerVectorizerTestPass(); } // namespace mlir @@ -128,7 +128,7 @@ registerTestParallelismDetection(); registerTestGpuParallelLoopMappingPass(); registerTestVectorConversions(); - registerTestVectorToLoopsPass(); + registerTestVectorToSCFPass(); registerVectorizerTestPass(); }