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, -`MLIRGPUToSPIRV` and `MLIRStandardToSPIRV`, respectively. +`MLIRGPUToSPIRVTransforms` and `MLIRStandardToSPIRVTransforms`, respectively. There are also common utilities when targeting SPIR-V from any dialect: diff --git a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h b/mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h rename from mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h rename to mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h --- a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h +++ b/mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h @@ -1,4 +1,4 @@ -//===- GPUToSPIRV.h - GPU to SPIR-V Patterns --------------------*- C++ -*-===// +//===- ConvertGPUToSPIRV.h - GPU Ops to SPIR-V dialect 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 to convert GPU dialect to SPIR-V dialect. +// Provides patterns for lowering GPU Ops to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRV_H -#define MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRV_H +#ifndef MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRV_H +#define MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRV_H #include "mlir/Transforms/DialectConversion.h" @@ -26,4 +26,4 @@ OwningRewritePatternList &patterns); } // namespace mlir -#endif // MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRV_H +#endif // MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRV_H diff --git a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h b/mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h rename from mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h rename to mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h --- a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h +++ b/mlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h @@ -1,4 +1,4 @@ -//===- GPUToSPIRVPass.h - GPU to SPIR-V Passes ------------------*- C++ -*-===// +//===- ConvertGPUToSPIRVPass.h - GPU to SPIR-V conversion pass --*- 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,14 @@ // //===----------------------------------------------------------------------===// // -// Provides passes to convert GPU dialect to SPIR-V dialect. +// Provides a pass to convert GPU ops to SPIRV ops. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRVPASS_H -#define MLIR_CONVERSION_GPUTOSPIRV_GPUTOSPIRVPASS_H +#ifndef MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRVPASS_H +#define MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRVPASS_H + +#include "mlir/Support/LLVM.h" #include @@ -21,9 +23,9 @@ template class OperationPass; -/// 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. +/// 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_GPUTOSPIRVPASS_H +#endif // MLIR_CONVERSION_GPUTOSPIRV_CONVERTGPUTOSPIRVPASS_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 Patterns --------------*- C++ -*-===// +//===- LinalgToSPIRV.h - Linalg to SPIR-V dialect conversion ----*- 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 to convert Linalg dialect to SPIR-V dialect. +// This file provides patterns for Linalg to SPIR-V dialect conversion. // //===----------------------------------------------------------------------===// 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 Passes -----------*- C++ -*-===// +//===- LinalgToSPIRVPass.h - Linalg to SPIR-V conversion pass --*- 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 passes to convert Linalg dialect to SPIR-V dialect. +// This file provides a pass for Linalg to SPIR-V dialect conversion. // //===----------------------------------------------------------------------===// 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/GPUToSPIRVPass.h" +#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.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/SPIRVToLLVMPass.h" +#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h" #include "mlir/Conversion/ShapeToStandard/ShapeToStandard.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" -#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h" +#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h" #include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h" #include "mlir/Conversion/VectorToROCDL/VectorToROCDL.h" #include "mlir/Conversion/VectorToSCF/VectorToSCF.h" -#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h" +#include "mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.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 - SCF to SPIR-V Patterns --------------------*- C++ -*-===// +//===------------ SCFToSPIRV.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,7 +6,7 @@ // //===----------------------------------------------------------------------===// // -// Provides patterns to convert SCF dialect to SPIR-V dialect. +// Provides patterns for lowering SCF ops 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,14 +1,10 @@ -//===- SCFToSPIRVPass.h - SCF to SPIR-V Passes ------------------*- C++ -*-===// +//===- SCFToSPIRVPass.h - SCF to SPIR-V Conversion Pass ---------*- 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/SPIRVToLLVM.h b/mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h rename from mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h rename to mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h --- a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h +++ b/mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h @@ -1,4 +1,4 @@ -//===- SPIRVToLLVM.h - SPIR-V to LLVM Patterns ------------------*- C++ -*-===// +//===- ConvertSPIRVToLLVM.h - Convert SPIR-V to LLVM 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. @@ -10,8 +10,8 @@ // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H -#define MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H +#ifndef MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVM_H +#define MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVM_H #include "mlir/Transforms/DialectConversion.h" @@ -57,4 +57,4 @@ } // namespace mlir -#endif // MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVM_H +#endif // MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVM_H diff --git a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h b/mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h rename from mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h rename to mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h --- a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h +++ b/mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h @@ -1,4 +1,4 @@ -//===- SPIRVToLLVMPass.h - SPIR-V to LLVM Passes ----------------*- C++ -*-===// +//===- ConvertSPIRVToLLVMPass.h - SPIR-V dialect to LLVM pass ---*- 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 passes to convert SPIR-V dialect to LLVM dialect. +// Provides a pass to lower from SPIR-V dialect to LLVM dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVMPASS_H -#define MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVMPASS_H +#ifndef MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H +#define MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H #include @@ -35,4 +35,4 @@ } // namespace mlir -#endif // MLIR_CONVERSION_SPIRVTOLLVM_SPIRVTOLLVMPASS_H +#endif // MLIR_CONVERSION_SPIRVTOLLVM_CONVERTSPIRVTOLLVMPASS_H_ diff --git a/mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h b/mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h rename from mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h rename to mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h --- a/mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h +++ b/mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h @@ -1,4 +1,4 @@ -//===- StandardToSPIRV.h - Standard to SPIR-V Patterns --------*- C++ -*-===// +//===- ConvertStandardToSPIRV.h - Convert to SPIR-V 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,21 +6,21 @@ // //===----------------------------------------------------------------------===// // -// Provides patterns to convert Standard dialect to SPIR-V dialect. +// Provides patterns to lower StandardOps to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRV_H -#define MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRV_H +#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRV_H +#define MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRV_H #include "mlir/Transforms/DialectConversion.h" namespace mlir { class SPIRVTypeConverter; -/// 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. +/// 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. void populateStandardToSPIRVPatterns(MLIRContext *context, SPIRVTypeConverter &typeConverter, OwningRewritePatternList &patterns); @@ -32,4 +32,4 @@ } // namespace mlir -#endif // MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRV_H +#endif // MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRV_H diff --git a/mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h b/mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h rename from mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h rename to mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h --- a/mlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h +++ b/mlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h @@ -1,4 +1,4 @@ -//===- StandardToSPIRVPass.h - Standard to SPIR-V Passes --------*- C++ -*-===// +//===- ConvertStandardToSPIRVPass.h - StdOps to SPIR-V pass -----*- 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 passes to convert Standard dialect to SPIR-V dialect. +// Provides a pass to lower from StandardOps to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRVPASS_H -#define MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRVPASS_H +#ifndef MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRVPASS_H +#define MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRVPASS_H #include "mlir/Pass/Pass.h" namespace mlir { -/// Creates a pass to convert standard ops to SPIR-V ops. +/// Pass to convert StandardOps to SPIR-V ops. std::unique_ptr> createConvertStandardToSPIRVPass(); -/// Creates a pass to legalize ops that are not directly lowered to SPIR-V. +/// Pass to legalize ops that are not directly lowered to SPIR-V. std::unique_ptr createLegalizeStdOpsForSPIRVLoweringPass(); } // namespace mlir -#endif // MLIR_CONVERSION_STANDARDTOSPIRV_STANDARDTOSPIRVPASS_H +#endif // MLIR_CONVERSION_STANDARDTOSPIRV_CONVERTSTANDARDTOSPIRVPASS_H diff --git a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h b/mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRV.h rename from mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h rename to mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRV.h --- a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h +++ b/mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRV.h @@ -1,4 +1,4 @@ -//=- VectorToSPIRV.h - Vector to SPIR-V Patterns ------------------*- C++ -*-=// +//=- ConvertVectorToSPIRV.h - Vector Ops to SPIR-V dialect 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 to convert Vector dialect to SPIR-V dialect. +// Provides patterns for lowering Vector Ops to SPIR-V dialect. // //===----------------------------------------------------------------------===// -#ifndef MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_VECTORTOSPIRV_H -#define MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_VECTORTOSPIRV_H +#ifndef MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_CONVERTVECTORTOSPIRV_H_ +#define MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_CONVERTVECTORTOSPIRV_H_ #include "mlir/Transforms/DialectConversion.h" @@ -26,4 +26,4 @@ } // namespace mlir -#endif // MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_VECTORTOSPIRV_H +#endif // MLIR_INCLUDE_MLIR_CONVERSION_VECTORTOSPIRV_CONVERTVECTORTOSPIRV_H_ diff --git a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h b/mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h rename from mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h rename to mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h --- a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h +++ b/mlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h @@ -1,4 +1,4 @@ -//=- VectorToSPIRVPass.h - Vector to SPIR-V Passes ----------------*- C++ -*-=// +//=- ConvertVectorToSPIRVPass.h - Pass converting Vector to SPIRV -*- 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 passes to convert Vector dialect to SPIR-V dialect. +// Provides a pass to convert Vector ops to SPIR-V ops. // //===----------------------------------------------------------------------===// -#ifndef MLIR_CONVERSION_VECTORTOSPIRV_GPUTOSPIRVPASS_H -#define MLIR_CONVERSION_VECTORTOSPIRV_GPUTOSPIRVPASS_H +#ifndef MLIR_CONVERSION_VECTORTOSPIRV_CONVERTGPUTOSPIRVPASS_H +#define MLIR_CONVERSION_VECTORTOSPIRV_CONVERTGPUTOSPIRVPASS_H #include "mlir/Pass/Pass.h" namespace mlir { -/// Creates a pass to convert Vector Ops to SPIR-V ops. +/// Pass to convert Vector Ops to SPIR-V ops. std::unique_ptr> createConvertVectorToSPIRVPass(); } // namespace mlir -#endif // MLIR_CONVERSION_VECTORTOSPIRV_GPUTOSPIRVPASS_H +#endif // MLIR_CONVERSION_VECTORTOSPIRV_CONVERTGPUTOSPIRVPASS_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(MLIRGPUToSPIRV - GPUToSPIRV.cpp - GPUToSPIRVPass.cpp +add_mlir_conversion_library(MLIRGPUToSPIRVTransforms + ConvertGPUToSPIRV.cpp + ConvertGPUToSPIRVPass.cpp DEPENDS MLIRConversionPassIncGen @@ -18,7 +18,7 @@ MLIRSPIRV MLIRSPIRVConversion MLIRStandard - MLIRStandardToSPIRV + MLIRStandardToSPIRVTransforms MLIRSupport MLIRTransforms ) diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp rename from mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp rename to mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp --- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp @@ -1,4 +1,4 @@ -//===- GPUToSPIRV.cpp - GPU to SPIR-V Patterns ----------------------------===// +//===- ConvertGPUToSPIRV.cpp - Convert GPU ops to SPIR-V dialect ----------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,11 +6,10 @@ // //===----------------------------------------------------------------------===// // -// This file implements patterns to convert GPU dialect to SPIR-V dialect. +// This file implements the conversion patterns from GPU ops to SPIR-V dialect. // //===----------------------------------------------------------------------===// - -#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h" +#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.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/GPUToSPIRVPass.cpp b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp rename from mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp rename to mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp --- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp @@ -1,4 +1,4 @@ -//===- GPUToSPIRVPass.cpp - GPU to SPIR-V Passes --------------------------===// +//===- ConvertGPUToSPIRVPass.cpp - GPU to SPIR-V dialect lowering 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/GPUToSPIRVPass.h" +#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h" #include "../PassDetail.h" -#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h" -#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h" +#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h" +#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.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(MLIRLinalgToSPIRV +add_mlir_conversion_library(MLIRLinalgToSPIRVTransforms 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 Patterns ----------------------===// +//===- LinalgToSPIRV.cpp - Linalg to SPIR-V dialect conversion ------------===// // // 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 Passes --------------------===// +//===- LinalgToSPIRVPass.cpp - Linalg to SPIR-V conversion pass -----------===// // // 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 - MLIRStandardToSPIRV + MLIRStandardToSPIRVTransforms 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 - SCF to SPIR-V Patterns ----------------------------===// +//===- SCFToSPIRV.cpp - Convert SCF ops to SPIR-V dialect -----------------===// // // 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,9 @@ // //===----------------------------------------------------------------------===// // -// This file implements patterns to convert SCF dialect to SPIR-V dialect. +// This file implements the conversion patterns from SCF ops 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 Passes --------------------------===// +//===- SCFToSPIRVPass.cpp - SCF to SPIR-V Dialect Conversion Pass ---------===// // // 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/StandardToSPIRV.h" +#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.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 - SPIRVToLLVM.cpp - SPIRVToLLVMPass.cpp + ConvertSPIRVToLLVM.cpp + ConvertSPIRVToLLVMPass.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/SPIRVToLLVM.h" -#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h" +#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h" +#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.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/SPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp rename from mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp rename to mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp --- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp @@ -1,4 +1,4 @@ -//===- SPIRVToLLVM.cpp - SPIR-V to LLVM Patterns --------------------------===// +//===- ConvertSPIRVToLLVM.cpp - SPIR-V dialect to LLVM dialect conversion -===// // // 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/SPIRVToLLVM.h" +#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.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/SPIRVToLLVM/SPIRVToLLVMPass.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.cpp rename from mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp rename to mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.cpp --- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.cpp @@ -1,4 +1,4 @@ -//===- SPIRVToLLVMPass.cpp - SPIR-V to LLVM Passes ------------------------===// +//===- ConvertSPIRVToLLVMPass.cpp - Convert SPIR-V ops to LLVM ops --------===// // // 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/SPIRVToLLVMPass.h" +#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h" #include "../PassDetail.h" -#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h" +#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.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(MLIRStandardToSPIRV +add_mlir_conversion_library(MLIRStandardToSPIRVTransforms + ConvertStandardToSPIRV.cpp + ConvertStandardToSPIRVPass.cpp LegalizeStandardForSPIRV.cpp - StandardToSPIRV.cpp - StandardToSPIRVPass.cpp ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV diff --git a/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp rename from mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp rename to mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp --- a/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp @@ -1,4 +1,4 @@ -//===- StandardToSPIRV.cpp - Standard to SPIR-V Patterns ------------------===// +//===- ConvertStandardToSPIRV.cpp - Standard to SPIR-V dialect conversion--===// // // 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 dialect to SPIR-V dialect. +// This file implements patterns to convert standard ops to SPIR-V ops. // //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp rename from mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp rename to mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp --- a/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp @@ -1,4 +1,4 @@ -//===- StandardToSPIRVPass.cpp - Standard to SPIR-V Passes ----------------===// +//===- ConvertStandardToSPIRVPass.cpp - Convert Std Ops to SPIR-V Ops -----===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,13 +6,14 @@ // //===----------------------------------------------------------------------===// // -// This file implements a pass to convert standard dialect to SPIR-V dialect. +// This file implements a pass to convert MLIR standard ops into the SPIR-V +// ops. // //===----------------------------------------------------------------------===// -#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h" +#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h" #include "../PassDetail.h" -#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h" +#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h" #include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h" #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h" 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/StandardToSPIRV.h" -#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h" +#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h" +#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.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/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,6 +1,5 @@ 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 SPIR-V Patterns ----------------------===// +//===------- VectorToSPIRV.cpp - Vector to SPIRV lowering 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,18 +6,20 @@ // //===----------------------------------------------------------------------===// // -// This file implements patterns to convert Vector dialect to SPIRV dialect. +// This file implements a pass to generate SPIRV operations for Vector +// operations. // //===----------------------------------------------------------------------===// -#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; @@ -122,3 +124,34 @@ 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/VectorToSPIRV/VectorToSPIRVPass.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp deleted file mode 100644 --- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===- 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 "../PassDetail.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 { -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/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/GPUToSPIRVPass.h" -#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h" +#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h" +#include "mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.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/GPUToSPIRVPass.h" +#include "mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h" #include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h" #include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h" -#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h" +#include "mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h" #include "mlir/Dialect/GPU/Passes.h" #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h" #include "mlir/Dialect/SPIRV/Transforms/Passes.h"