diff --git a/mlir/docs/Dialects/SPIR-V.md b/mlir/docs/Dialects/SPIR-V.md --- a/mlir/docs/Dialects/SPIR-V.md +++ b/mlir/docs/Dialects/SPIR-V.md @@ -1145,7 +1145,7 @@ are at [lib/Conversion/StandardToSPIRV][MlirStdToSpirvLibs]. These dialect to dialect conversions have their dedicated libraries, -`MLIRGPUToSPIRVTransforms` and `MLIRStandardToSPIRVTransforms`, respectively. +`MLIRGPUToSPIRV` and `MLIRStandardToSPIRV`, respectively. There are also common utilities when targeting SPIR-V from any dialect: diff --git a/mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h rename from mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h rename to mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h --- a/mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h +++ b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h @@ -1,4 +1,4 @@ -//===- ConvertGPUToSPIRV.h - GPU Ops to SPIR-V dialect patterns ----C++ -*-===// +//===- GPUToSPIRV.h - GPU to SPIR-V Patterns --------------------*- 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,12 +6,12 @@ // //===----------------------------------------------------------------------===// // -// Provides patterns for lowering GPU Ops to SPIR-V dialect. +// Provides patterns to convert GPU dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRV_H -#define MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRV_H +#ifndef MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRV_H +#define MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRV_H #include "mlir/Transforms/DialectConversion.h" @@ -26,4 +26,4 @@ OwningRewritePatternList &patterns); } // namespace mlir -#endif // MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRV_H +#endif // MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRV_H diff --git a/mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h rename from mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h rename to mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h --- a/mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h +++ b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h @@ -1,4 +1,4 @@ -//===- ConvertGPUToSPIRVPass.h - GPU to SPIR-V conversion pass --*- C++ -*-===// +//===- GPUToSPIRVPass.h - GPU to SPIR-V Passes ------------------*- 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,25 +6,24 @@ // //===----------------------------------------------------------------------===// // -// Provides a pass to convert GPU ops to SPIRV ops. +// Provides passes to convert GPU dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRVPASS_H -#define MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRVPASS_H - -#include "mlir/Support/LLVM.h" +#ifndef MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRVPASS_H +#define MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRVPASS_H #include namespace mlir { class ModuleOp; -template class OperationPass; +template +class OperationPass; -/// Pass to convert GPU Ops to SPIR-V ops. For a gpu.func to be converted, it -/// should have a spv.entry_point_abi attribute. +/// Creates a pass to convert GPU Ops to SPIR-V ops. For a gpu.func to be +/// converted, it should have a spv.entry_point_abi attribute. std::unique_ptr> createConvertGPUToSPIRVPass(); } // namespace mlir -#endif // MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRVPASS_H +#endif // MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRVPASS_H diff --git a/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h b/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h --- a/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h +++ b/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h @@ -1,4 +1,4 @@ -//===- LinalgToSPIRV.h - Linalg to SPIR-V dialect conversion ----*- C++ -*-===// +//===- LinalgToSPIRV.h - Linalg to SPIR-V Patterns --------------*- 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,7 +6,7 @@ // //===----------------------------------------------------------------------===// // -// This file provides patterns for Linalg to SPIR-V dialect conversion. +// Provides patterns to convert Linalg dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h b/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h --- a/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h +++ b/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h @@ -1,4 +1,4 @@ -//===- LinalgToSPIRVPass.h - Linalg to SPIR-V conversion pass --*- C++ -*-===// +//===- LinalgToSPIRVPass.h - Linalg to SPIR-V Passes -----------*- 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,7 +6,7 @@ // //===----------------------------------------------------------------------===// // -// This file provides a pass for Linalg to SPIR-V dialect conversion. +// Provides passes to convert Linalg dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/Conversion/Passes.h b/mlir/include/mlir/Conversion/Passes.h --- a/mlir/include/mlir/Conversion/Passes.h +++ b/mlir/include/mlir/Conversion/Passes.h @@ -14,7 +14,7 @@ #include "mlir/Conversion/GPUCommon/GPUCommonPass.h" #include "mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h" #include "mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h" -#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h" +#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h" #include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h" #include "mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h" #include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h" @@ -25,14 +25,14 @@ #include "mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h" #include "mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h" #include "mlir/Conversion/SCFToStandard/SCFToStandard.h" -#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h" +#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h" #include "mlir/Conversion/ShapeToStandard/ShapeToStandard.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" -#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h" +#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h" #include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h" #include "mlir/Conversion/VectorToROCDL/VectorToROCDL.h" #include "mlir/Conversion/VectorToSCF/VectorToSCF.h" -#include "mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h" +#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h" namespace mlir { diff --git a/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h b/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h --- a/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h +++ b/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h @@ -1,4 +1,4 @@ -//===------------ SCFToSPIRV.h - Pass entrypoint ----------------*- C++ -*-===// +//===- SCFToSPIRV.h - SCF to SPIR-V Patterns --------------------*- 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,7 +6,7 @@ // //===----------------------------------------------------------------------===// // -// Provides patterns for lowering SCF ops to SPIR-V dialect. +// Provides patterns to convert SCF dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// #ifndef MLIR_CONVERSION_SCFTOSPIRV_SCFTOSPIRV_H_ diff --git a/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h b/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h --- a/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h +++ b/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h @@ -1,10 +1,14 @@ -//===- SCFToSPIRVPass.h - SCF to SPIR-V Conversion Pass ---------*- C++ -*-===// +//===- SCFToSPIRVPass.h - SCF to SPIR-V Passes ------------------*- 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 // //===----------------------------------------------------------------------===// +// +// Provides passes to convert SCF dialect to SPIR-V dialect. +// +//===----------------------------------------------------------------------===// #ifndef MLIR_CONVERSION_SCFTOSPIRV_SCFTOSPIRVPASS_H #define MLIR_CONVERSION_SCFTOSPIRV_SCFTOSPIRVPASS_H diff --git a/mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h rename from mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h rename to mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h --- a/mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h +++ b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h @@ -1,4 +1,4 @@ -//===- ConvertSPIRVToLLVM.h - Convert SPIR-V to LLVM dialect ----*- C++ -*-===// +//===- SPIRVToLLVM.h - SPIR-V to LLVM Patterns ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,8 +10,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVM_H -#define MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVM_H +#ifndef MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H +#define MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H #include "mlir/Transforms/DialectConversion.h" @@ -57,4 +57,4 @@ } // namespace mlir -#endif // MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVM_H +#endif // MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H diff --git a/mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h rename from mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h rename to mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h --- a/mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h +++ b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h @@ -1,4 +1,4 @@ -//===- ConvertSPIRVToLLVMPass.h - SPIR-V dialect to LLVM pass ---*- C++ -*-===// +//===- SPIRVToLLVMPass.h - SPIR-V to LLVM Passes ----------------*- 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,12 +6,12 @@ // //===----------------------------------------------------------------------===// // -// Provides a pass to lower from SPIR-V dialect to LLVM dialect. +// Provides passes to convert SPIR-V dialect to LLVM dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H -#define MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H +#ifndef MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVMPASS_H +#define MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVMPASS_H #include @@ -35,4 +35,4 @@ } // namespace mlir -#endif // MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H_ +#endif // MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVMPASS_H diff --git a/mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h b/mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h rename from mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h rename to mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h --- a/mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h +++ b/mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h @@ -1,4 +1,4 @@ -//===- ConvertStandardToSPIRV.h - Convert to SPIR-V dialect -----*- C++ -*-===// +//===- StandardToSPIRV.h - Standard to SPIR-V Patterns --------*- 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,21 +6,21 @@ // //===----------------------------------------------------------------------===// // -// Provides patterns to lower StandardOps to SPIR-V dialect. +// Provides patterns to convert Standard dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRV_H -#define MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRV_H +#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRV_H +#define MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRV_H #include "mlir/Transforms/DialectConversion.h" namespace mlir { class SPIRVTypeConverter; -/// Appends to a pattern list additional patterns for translating StandardOps to -/// SPIR-V ops. Also adds the patterns legalize ops not directly translated to -/// SPIR-V dialect. +/// Appends to a pattern list additional patterns for translating standard ops +/// to SPIR-V ops. Also adds the patterns to legalize ops not directly +/// translated to SPIR-V dialect. void populateStandardToSPIRVPatterns(MLIRContext *context, SPIRVTypeConverter &typeConverter, OwningRewritePatternList &patterns); @@ -32,4 +32,4 @@ } // namespace mlir -#endif // MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRV_H +#endif // MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRV_H diff --git a/mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h b/mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h rename from mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h rename to mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h --- a/mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h +++ b/mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h @@ -1,4 +1,4 @@ -//===- ConvertStandardToSPIRVPass.h - StdOps to SPIR-V pass -----*- C++ -*-===// +//===- StandardToSPIRVPass.h - Standard to SPIR-V Passes --------*- 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,23 +6,23 @@ // //===----------------------------------------------------------------------===// // -// Provides a pass to lower from StandardOps to SPIR-V dialect. +// Provides passes to convert Standard dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRVPASS_H -#define MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRVPASS_H +#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRVPASS_H +#define MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRVPASS_H #include "mlir/Pass/Pass.h" namespace mlir { -/// Pass to convert StandardOps to SPIR-V ops. +/// Creates a pass to convert standard ops to SPIR-V ops. std::unique_ptr> createConvertStandardToSPIRVPass(); -/// Pass to legalize ops that are not directly lowered to SPIR-V. +/// Creates a pass to legalize ops that are not directly lowered to SPIR-V. std::unique_ptr createLegalizeStdOpsForSPIRVLoweringPass(); } // namespace mlir -#endif // MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRVPASS_H +#endif // MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRVPASS_H diff --git a/mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRV.h b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h rename from mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRV.h rename to mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h --- a/mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRV.h +++ b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h @@ -1,4 +1,4 @@ -//=- ConvertVectorToSPIRV.h - Vector Ops to SPIR-V dialect patterns - C++ -*-=// +//=- VectorToSPIRV.h - Vector to SPIR-V Patterns ------------------*- 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,12 +6,12 @@ // //===----------------------------------------------------------------------===// // -// Provides patterns for lowering Vector Ops to SPIR-V dialect. +// Provides patterns to convert Vector dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_CONVERTVECTORTOSPIRV_H_ -#define MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_CONVERTVECTORTOSPIRV_H_ +#ifndef MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_VECTORTOSPIRV_H +#define MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_VECTORTOSPIRV_H #include "mlir/Transforms/DialectConversion.h" @@ -26,4 +26,4 @@ } // namespace mlir -#endif // MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_CONVERTVECTORTOSPIRV_H_ +#endif // MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_VECTORTOSPIRV_H diff --git a/mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h rename from mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h rename to mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h --- a/mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h +++ b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h @@ -1,4 +1,4 @@ -//=- ConvertVectorToSPIRVPass.h - Pass converting Vector to SPIRV -*- C++ -*-=// +//=- VectorToSPIRVPass.h - Vector to SPIR-V Passes ----------------*- 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,20 +6,20 @@ // //===----------------------------------------------------------------------===// // -// Provides a pass to convert Vector ops to SPIR-V ops. +// Provides passes to convert Vector dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_VECTORTOSPIRV_CONVERTGPUTOSPIRVPASS_H -#define MLIR_CONVERSION_VECTORTOSPIRV_CONVERTGPUTOSPIRVPASS_H +#ifndef MLIR_CONVERSION_VECTORTOSPIRV_GPUTOSPIRVPASS_H +#define MLIR_CONVERSION_VECTORTOSPIRV_GPUTOSPIRVPASS_H #include "mlir/Pass/Pass.h" namespace mlir { -/// Pass to convert Vector Ops to SPIR-V ops. +/// Creates a pass to convert Vector Ops to SPIR-V ops. std::unique_ptr> createConvertVectorToSPIRVPass(); } // namespace mlir -#endif // MLIR_CONVERSION_VECTORTOSPIRV_CONVERTGPUTOSPIRVPASS_H +#endif // MLIR_CONVERSION_VECTORTOSPIRV_GPUTOSPIRVPASS_H diff --git a/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt --- a/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt +++ b/mlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt @@ -2,9 +2,9 @@ mlir_tablegen(GPUToSPIRV.cpp.inc -gen-rewriters) add_public_tablegen_target(MLIRGPUToSPIRVIncGen) -add_mlir_conversion_library(MLIRGPUToSPIRVTransforms - ConvertGPUToSPIRV.cpp - ConvertGPUToSPIRVPass.cpp +add_mlir_conversion_library(MLIRGPUToSPIRV + GPUToSPIRV.cpp + GPUToSPIRVPass.cpp DEPENDS MLIRConversionPassIncGen @@ -18,7 +18,7 @@ MLIRSPIRV MLIRSPIRVConversion MLIRStandard - MLIRStandardToSPIRVTransforms + MLIRStandardToSPIRV MLIRSupport MLIRTransforms ) diff --git a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp rename from mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp rename to mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp --- a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp @@ -1,4 +1,4 @@ -//===- ConvertGPUToSPIRV.cpp - Convert GPU ops to SPIR-V dialect ----------===// +//===- GPUToSPIRV.cpp - GPU to SPIR-V Patterns ----------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,11 @@ // //===----------------------------------------------------------------------===// // -// This file implements the conversion patterns from GPU ops to SPIR-V dialect. +// This file implements patterns to convert GPU dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h" + +#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h" #include "mlir/Dialect/GPU/GPUDialect.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" diff --git a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp rename from mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp rename to mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp --- a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp @@ -1,4 +1,4 @@ -//===- ConvertGPUToSPIRVPass.cpp - GPU to SPIR-V dialect lowering passes --===// +//===- GPUToSPIRVPass.cpp - GPU to SPIR-V Passes --------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,15 +7,15 @@ //===----------------------------------------------------------------------===// // // This file implements a pass to convert a kernel function in the GPU Dialect -// into a spv.module operation +// into a spv.module operation. // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h" +#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h" #include "../PassDetail.h" -#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h" -#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h" +#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h" +#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h" #include "mlir/Dialect/GPU/GPUDialect.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" diff --git a/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt --- a/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt +++ b/mlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt @@ -1,4 +1,4 @@ -add_mlir_conversion_library(MLIRLinalgToSPIRVTransforms +add_mlir_conversion_library(MLIRLinalgToSPIRV LinalgToSPIRV.cpp LinalgToSPIRVPass.cpp diff --git a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp --- a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp +++ b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp @@ -1,4 +1,4 @@ -//===- LinalgToSPIRV.cpp - Linalg to SPIR-V dialect conversion ------------===// +//===- LinalgToSPIRV.cpp - Linalg to SPIR-V Patterns ----------------------===// // // 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/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp --- a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp +++ b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp @@ -1,4 +1,4 @@ -//===- LinalgToSPIRVPass.cpp - Linalg to SPIR-V conversion pass -----------===// +//===- LinalgToSPIRVPass.cpp - Linalg to SPIR-V Passes --------------------===// // // 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/lib/Conversion/SCFToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt --- a/mlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt +++ b/mlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt @@ -11,7 +11,7 @@ LINK_LIBS PUBLIC MLIRSPIRV MLIRSPIRVConversion - MLIRStandardToSPIRVTransforms + MLIRStandardToSPIRV MLIRIR MLIRPass MLIRStandard diff --git a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp --- a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp +++ b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp @@ -1,4 +1,4 @@ -//===- SCFToSPIRV.cpp - Convert SCF ops to SPIR-V dialect -----------------===// +//===- SCFToSPIRV.cpp - SCF to SPIR-V Patterns ----------------------------===// // // 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,10 @@ // //===----------------------------------------------------------------------===// // -// This file implements the conversion patterns from SCF ops to SPIR-V dialect. +// This file implements patterns to convert SCF dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// + #include "mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h" #include "mlir/Dialect/SCF/SCF.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" diff --git a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp --- a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp +++ b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp @@ -1,4 +1,4 @@ -//===- SCFToSPIRVPass.cpp - SCF to SPIR-V Dialect Conversion Pass ---------===// +//===- SCFToSPIRVPass.cpp - SCF to SPIR-V Passes --------------------------===// // // 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,7 @@ #include "../PassDetail.h" #include "mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h" -#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h" +#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h" #include "mlir/Dialect/SCF/SCF.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h" diff --git a/mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt b/mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt --- a/mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt +++ b/mlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt @@ -1,7 +1,7 @@ add_mlir_conversion_library(MLIRSPIRVToLLVM ConvertLaunchFuncToLLVMCalls.cpp - ConvertSPIRVToLLVM.cpp - ConvertSPIRVToLLVMPass.cpp + SPIRVToLLVM.cpp + SPIRVToLLVMPass.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/SPIRVToLLVM diff --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp --- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp @@ -12,8 +12,8 @@ //===----------------------------------------------------------------------===// #include "../PassDetail.h" -#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h" -#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h" +#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h" +#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h" #include "mlir/Dialect/GPU/GPUDialect.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" diff --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp rename from mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp rename to mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp --- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp @@ -1,4 +1,4 @@ -//===- ConvertSPIRVToLLVM.cpp - SPIR-V dialect to LLVM dialect conversion -===// +//===- SPIRVToLLVM.cpp - SPIR-V to LLVM Patterns --------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h" +#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" @@ -894,7 +894,7 @@ if (!op.memory_access().hasValue()) { replaceWithLoadOrStore(op, rewriter, this->typeConverter, /*alignment=*/0, - /*isVolatile=*/false, /*isNonTemporal=*/ false); + /*isVolatile=*/false, /*isNonTemporal=*/false); return success(); } auto memoryAccess = op.memory_access().getValue(); diff --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp rename from mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.cpp rename to mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp --- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp @@ -1,4 +1,4 @@ -//===- ConvertSPIRVToLLVMPass.cpp - Convert SPIR-V ops to LLVM ops --------===// +//===- SPIRVToLLVMPass.cpp - SPIR-V to LLVM Passes ------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,9 +10,9 @@ // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h" +#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h" #include "../PassDetail.h" -#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h" +#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" diff --git a/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt --- a/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt +++ b/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt @@ -1,7 +1,7 @@ -add_mlir_conversion_library(MLIRStandardToSPIRVTransforms - ConvertStandardToSPIRV.cpp - ConvertStandardToSPIRVPass.cpp +add_mlir_conversion_library(MLIRStandardToSPIRV LegalizeStandardForSPIRV.cpp + StandardToSPIRV.cpp + StandardToSPIRVPass.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV diff --git a/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp --- a/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp @@ -12,8 +12,8 @@ //===----------------------------------------------------------------------===// #include "../PassDetail.h" -#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h" -#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h" +#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h" +#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/Vector/VectorOps.h" diff --git a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp rename from mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp rename to mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp --- a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp @@ -1,4 +1,4 @@ -//===- ConvertStandardToSPIRV.cpp - Standard to SPIR-V dialect conversion--===// +//===- StandardToSPIRV.cpp - Standard to SPIR-V Patterns ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// // -// This file implements patterns to convert standard ops to SPIR-V ops. +// This file implements patterns to convert standard dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp b/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp rename from mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp rename to mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp --- a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp @@ -1,4 +1,4 @@ -//===- ConvertStandardToSPIRVPass.cpp - Convert Std Ops to SPIR-V Ops -----===// +//===- StandardToSPIRVPass.cpp - Standard to SPIR-V Passes ----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,14 +6,13 @@ // //===----------------------------------------------------------------------===// // -// This file implements a pass to convert MLIR standard ops into the SPIR-V -// ops. +// This file implements a pass to convert standard dialect to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h" +#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h" #include "../PassDetail.h" -#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h" +#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h" diff --git a/mlir/lib/Conversion/VectorToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/VectorToSPIRV/CMakeLists.txt --- a/mlir/lib/Conversion/VectorToSPIRV/CMakeLists.txt +++ b/mlir/lib/Conversion/VectorToSPIRV/CMakeLists.txt @@ -1,5 +1,6 @@ add_mlir_conversion_library(MLIRVectorToSPIRV VectorToSPIRV.cpp + VectorToSPIRVPass.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToSPIRV diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp --- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp +++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp @@ -1,4 +1,4 @@ -//===------- VectorToSPIRV.cpp - Vector to SPIRV lowering passes ----------===// +//===- VectorToSPIRV.cpp - Vector to SPIR-V Patterns ----------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,20 +6,18 @@ // //===----------------------------------------------------------------------===// // -// This file implements a pass to generate SPIRV operations for Vector -// operations. +// This file implements patterns to convert Vector dialect to SPIRV dialect. // //===----------------------------------------------------------------------===// +#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h" + #include "../PassDetail.h" -#include "mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRV.h" -#include "mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" #include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h" #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h" #include "mlir/Dialect/Vector/VectorOps.h" -#include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" using namespace mlir; @@ -68,7 +66,7 @@ matchAndRewrite(vector::InsertOp insertOp, ArrayRef operands, ConversionPatternRewriter &rewriter) const override { if (insertOp.getSourceType().isa() || - !spirv::CompositeType::isValid(insertOp.getDestVectorType())) + !spirv::CompositeType::isValid(insertOp.getDestVectorType())) return failure(); vector::InsertOp::Adaptor adaptor(operands); int32_t id = insertOp.position().begin()->cast().getInt(); @@ -124,34 +122,3 @@ VectorInsertOpConvert, VectorExtractElementOpConvert, VectorInsertElementOpConvert>(context, typeConverter); } - -namespace { -struct LowerVectorToSPIRVPass - : public ConvertVectorToSPIRVBase { - void runOnOperation() override; -}; -} // namespace - -void LowerVectorToSPIRVPass::runOnOperation() { - MLIRContext *context = &getContext(); - ModuleOp module = getOperation(); - - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); - std::unique_ptr target = - spirv::SPIRVConversionTarget::get(targetAttr); - - SPIRVTypeConverter typeConverter(targetAttr); - OwningRewritePatternList patterns; - populateVectorToSPIRVPatterns(context, typeConverter, patterns); - - target->addLegalOp(); - target->addLegalOp(); - - if (failed(applyFullConversion(module, *target, std::move(patterns)))) - return signalPassFailure(); -} - -std::unique_ptr> -mlir::createConvertVectorToSPIRVPass() { - return std::make_unique(); -} diff --git a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp copy from mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp copy to mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp --- a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp +++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp @@ -1,27 +1,34 @@ -//===- LinalgToSPIRVPass.cpp - Linalg to SPIR-V conversion pass -----------===// +//===- VectorToSPIRVPass.cpp - Vector to SPIR-V Passes --------------------===// // // 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 // //===----------------------------------------------------------------------===// +// +// This file implements a pass to convert Vector dialect to SPIRV dialect. +// +//===----------------------------------------------------------------------===// + +#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h" -#include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h" #include "../PassDetail.h" -#include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h" +#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h" +#include "mlir/Pass/Pass.h" +#include "mlir/Transforms/DialectConversion.h" using namespace mlir; namespace { -/// A pass converting MLIR Linalg ops into SPIR-V ops. -class LinalgToSPIRVPass : public ConvertLinalgToSPIRVBase { +struct LowerVectorToSPIRVPass + : public ConvertVectorToSPIRVBase { void runOnOperation() override; }; } // namespace -void LinalgToSPIRVPass::runOnOperation() { +void LowerVectorToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); ModuleOp module = getOperation(); @@ -31,20 +38,16 @@ SPIRVTypeConverter typeConverter(targetAttr); OwningRewritePatternList patterns; - populateLinalgToSPIRVPatterns(context, typeConverter, patterns); - populateBuiltinFuncToSPIRVPatterns(context, typeConverter, patterns); + populateVectorToSPIRVPatterns(context, typeConverter, patterns); - // Allow builtin ops. target->addLegalOp(); - target->addDynamicallyLegalOp([&](FuncOp op) { - return typeConverter.isSignatureLegal(op.getType()) && - typeConverter.isLegal(&op.getBody()); - }); + target->addLegalOp(); if (failed(applyFullConversion(module, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createLinalgToSPIRVPass() { - return std::make_unique(); +std::unique_ptr> +mlir::createConvertVectorToSPIRVPass() { + return std::make_unique(); } diff --git a/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp b/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp --- a/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp +++ b/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h" -#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h" +#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h" +#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" #include "mlir/Dialect/GPU/Passes.h" #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" diff --git a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp --- a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp +++ b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp @@ -12,10 +12,10 @@ // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h" +#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h" #include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" -#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h" +#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h" #include "mlir/Dialect/GPU/Passes.h" #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" #include "mlir/Dialect/SPIRV/Transforms/Passes.h"