Index: mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h =================================================================== --- mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h +++ mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h @@ -9,7 +9,6 @@ #ifndef MLIR_CONVERSION_ARITHMETICTOSPIRV_ARITHMETICTOSPIRV_H #define MLIR_CONVERSION_ARITHMETICTOSPIRV_ARITHMETICTOSPIRV_H -#include "mlir/Pass/Pass.h" #include namespace mlir { @@ -22,7 +21,7 @@ void populateArithmeticToSPIRVPatterns(SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); -std::unique_ptr> createConvertArithmeticToSPIRVPass(); +std::unique_ptr createConvertArithmeticToSPIRVPass(); } // namespace arith } // namespace mlir Index: mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h =================================================================== --- mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h +++ mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h @@ -13,7 +13,6 @@ #ifndef MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H #define MLIR_CONVERSION_CONTROLFLOWTOLLVM_CONTROLFLOWTOLLVM_H -#include "mlir/Pass/Pass.h" #include namespace mlir { @@ -29,7 +28,7 @@ RewritePatternSet &patterns); /// Creates a pass to convert the ControlFlow dialect into the LLVMIR dialect. -std::unique_ptr> createConvertControlFlowToLLVMPass(); +std::unique_ptr createConvertControlFlowToLLVMPass(); } // namespace cf } // namespace mlir Index: mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h =================================================================== --- mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h +++ mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h @@ -19,7 +19,7 @@ class ModuleOp; /// Creates a pass to convert ControlFlow ops to SPIR-V ops. -std::unique_ptr> createConvertControlFlowToSPIRVPass(); +std::unique_ptr> createConvertControlFlowToSPIRVPass(); } // namespace mlir Index: mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h =================================================================== --- mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h +++ mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h @@ -19,7 +19,7 @@ class ModuleOp; /// Creates a pass to convert Func ops to SPIR-V ops. -std::unique_ptr> createConvertFuncToSPIRVPass(); +std::unique_ptr> createConvertFuncToSPIRVPass(); } // namespace mlir Index: mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h =================================================================== --- mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h +++ mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h @@ -19,7 +19,7 @@ class ModuleOp; /// Creates a pass to convert Math ops to SPIR-V ops. -std::unique_ptr> createConvertMathToSPIRVPass(); +std::unique_ptr> createConvertMathToSPIRVPass(); } // namespace mlir Index: mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h =================================================================== --- mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h +++ mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h @@ -24,7 +24,7 @@ std::unique_ptr> createMapMemRefStorageClassPass(); /// Creates a pass to convert MemRef ops to SPIR-V ops. -std::unique_ptr> createConvertMemRefToSPIRVPass(); +std::unique_ptr> createConvertMemRefToSPIRVPass(); } // namespace mlir Index: mlir/include/mlir/Conversion/Passes.td =================================================================== --- mlir/include/mlir/Conversion/Passes.td +++ mlir/include/mlir/Conversion/Passes.td @@ -114,7 +114,7 @@ // ArithmeticToSPIRV //===----------------------------------------------------------------------===// -def ConvertArithmeticToSPIRV : Pass<"convert-arith-to-spirv"> { +def ConvertArithmeticToSPIRV : Pass<"convert-arith-to-spirv", "ModuleOp"> { let summary = "Convert Arithmetic dialect to SPIR-V dialect"; let constructor = "mlir::arith::createConvertArithmeticToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; @@ -228,7 +228,7 @@ // ControlFlowToLLVM //===----------------------------------------------------------------------===// -def ConvertControlFlowToLLVM : Pass<"convert-cf-to-llvm"> { +def ConvertControlFlowToLLVM : Pass<"convert-cf-to-llvm", "ModuleOp"> { let summary = "Convert ControlFlow operations to the LLVM dialect"; let description = [{ Convert ControlFlow operations into LLVM IR dialect operations. @@ -250,7 +250,7 @@ // ControlFlowToSPIRV //===----------------------------------------------------------------------===// -def ConvertControlFlowToSPIRV : Pass<"convert-cf-to-spirv"> { +def ConvertControlFlowToSPIRV : Pass<"convert-cf-to-spirv", "ModuleOp"> { let summary = "Convert ControlFlow dialect to SPIR-V dialect"; let constructor = "mlir::createConvertControlFlowToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; @@ -311,7 +311,7 @@ // FuncToSPIRV //===----------------------------------------------------------------------===// -def ConvertFuncToSPIRV : Pass<"convert-func-to-spirv"> { +def ConvertFuncToSPIRV : Pass<"convert-func-to-spirv", "ModuleOp"> { let summary = "Convert Func dialect to SPIR-V dialect"; let constructor = "mlir::createConvertFuncToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; @@ -505,7 +505,7 @@ // MathToSPIRV //===----------------------------------------------------------------------===// -def ConvertMathToSPIRV : Pass<"convert-math-to-spirv"> { +def ConvertMathToSPIRV : Pass<"convert-math-to-spirv", "ModuleOp"> { let summary = "Convert Math dialect to SPIR-V dialect"; let constructor = "mlir::createConvertMathToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; @@ -548,7 +548,7 @@ ]; } -def ConvertMemRefToSPIRV : Pass<"convert-memref-to-spirv"> { +def ConvertMemRefToSPIRV : Pass<"convert-memref-to-spirv", "ModuleOp"> { let summary = "Convert MemRef dialect to SPIR-V dialect"; let constructor = "mlir::createConvertMemRefToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; @@ -668,7 +668,7 @@ // SCFToSPIRV //===----------------------------------------------------------------------===// -def SCFToSPIRV : Pass<"convert-scf-to-spirv"> { +def SCFToSPIRV : Pass<"convert-scf-to-spirv", "ModuleOp"> { let summary = "Convert SCF dialect to SPIR-V dialect."; let description = [{ This pass converts SCF ops into SPIR-V structured control flow ops. @@ -764,7 +764,7 @@ // TensorToSPIRV //===----------------------------------------------------------------------===// -def ConvertTensorToSPIRV : Pass<"convert-tensor-to-spirv"> { +def ConvertTensorToSPIRV : Pass<"convert-tensor-to-spirv", "ModuleOp"> { let summary = "Convert Tensor dialect to SPIR-V dialect"; let constructor = "mlir::createConvertTensorToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; @@ -961,7 +961,7 @@ // VectorToSPIRV //===----------------------------------------------------------------------===// -def ConvertVectorToSPIRV : Pass<"convert-vector-to-spirv"> { +def ConvertVectorToSPIRV : Pass<"convert-vector-to-spirv", "ModuleOp"> { let summary = "Convert Vector dialect to SPIR-V dialect"; let constructor = "mlir::createConvertVectorToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; Index: mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h =================================================================== --- mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h +++ mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h @@ -19,7 +19,7 @@ class ModuleOp; /// Creates a pass to convert SCF ops into SPIR-V ops. -std::unique_ptr> createConvertSCFToSPIRVPass(); +std::unique_ptr> createConvertSCFToSPIRVPass(); } // namespace mlir Index: mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h =================================================================== --- mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h +++ mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h @@ -19,7 +19,7 @@ class ModuleOp; /// Creates a pass to convert Tensor ops to SPIR-V ops. -std::unique_ptr> createConvertTensorToSPIRVPass(); +std::unique_ptr> createConvertTensorToSPIRVPass(); } // namespace mlir Index: mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h =================================================================== --- mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h +++ mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h @@ -19,7 +19,7 @@ class ModuleOp; /// Creates a pass to convert Vector Ops to SPIR-V ops. -std::unique_ptr> createConvertVectorToSPIRVPass(); +std::unique_ptr> createConvertVectorToSPIRVPass(); } // namespace mlir Index: mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp =================================================================== --- mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp +++ mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp @@ -912,8 +912,8 @@ struct ConvertArithmeticToSPIRVPass : public ConvertArithmeticToSPIRVBase { void runOnOperation() override { - Operation *op = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(op); + auto module = getOperation(); + auto targetAttr = spirv::lookupTargetEnvOrDefault(module); auto target = SPIRVConversionTarget::get(targetAttr); SPIRVTypeConverter::Options options; @@ -934,13 +934,12 @@ RewritePatternSet patterns(&getContext()); arith::populateArithmeticToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(op, *target, std::move(patterns)))) + if (failed(applyPartialConversion(module, *target, std::move(patterns)))) signalPassFailure(); } }; } // namespace -std::unique_ptr> -mlir::arith::createConvertArithmeticToSPIRVPass() { +std::unique_ptr mlir::arith::createConvertArithmeticToSPIRVPass() { return std::make_unique(); } Index: mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp =================================================================== --- mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp +++ mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp @@ -218,7 +218,6 @@ }; } // namespace -std::unique_ptr> -mlir::cf::createConvertControlFlowToLLVMPass() { +std::unique_ptr mlir::cf::createConvertControlFlowToLLVMPass() { return std::make_unique(); } Index: mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp =================================================================== --- mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp +++ mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp @@ -28,9 +28,9 @@ void ConvertControlFlowToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - Operation *op = getOperation(); + ModuleOp module = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(op); + auto targetAttr = spirv::lookupTargetEnvOrDefault(module); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -41,10 +41,11 @@ RewritePatternSet patterns(context); cf::populateControlFlowToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(op, *target, std::move(patterns)))) + if (failed(applyPartialConversion(module, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertControlFlowToSPIRVPass() { +std::unique_ptr> +mlir::createConvertControlFlowToSPIRVPass() { return std::make_unique(); } Index: mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp =================================================================== --- mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp +++ mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp @@ -28,9 +28,9 @@ void ConvertFuncToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - Operation *op = getOperation(); + ModuleOp module = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(op); + auto targetAttr = spirv::lookupTargetEnvOrDefault(module); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -42,10 +42,10 @@ populateFuncToSPIRVPatterns(typeConverter, patterns); populateBuiltinFuncToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(op, *target, std::move(patterns)))) + if (failed(applyPartialConversion(module, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertFuncToSPIRVPass() { +std::unique_ptr> mlir::createConvertFuncToSPIRVPass() { return std::make_unique(); } Index: mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp =================================================================== --- mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp +++ mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp @@ -59,7 +59,7 @@ gpuModules.push_back(builder.clone(*moduleOp.getOperation())); }); - // Map MemRef memory space to SPIR-V storage class first if requested. + // Map MemRef memory space to SPIR-V sotrage class first if requested. if (mapMemorySpace) { std::unique_ptr target = spirv::getMemorySpaceToStorageClassTarget(*context); Index: mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp =================================================================== --- mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp +++ mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp @@ -28,9 +28,9 @@ void ConvertMathToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - Operation *op = getOperation(); + ModuleOp module = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(op); + auto targetAttr = spirv::lookupTargetEnvOrDefault(module); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -50,10 +50,10 @@ RewritePatternSet patterns(context); populateMathToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(op, *target, std::move(patterns)))) + if (failed(applyPartialConversion(module, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertMathToSPIRVPass() { +std::unique_ptr> mlir::createConvertMathToSPIRVPass() { return std::make_unique(); } Index: mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp =================================================================== --- mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp +++ mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp @@ -28,9 +28,9 @@ void ConvertMemRefToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - Operation *op = getOperation(); + ModuleOp module = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(op); + auto targetAttr = spirv::lookupTargetEnvOrDefault(module); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -52,10 +52,11 @@ RewritePatternSet patterns(context); populateMemRefToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(op, *target, std::move(patterns)))) + if (failed(applyPartialConversion(module, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertMemRefToSPIRVPass() { +std::unique_ptr> +mlir::createConvertMemRefToSPIRVPass() { return std::make_unique(); } Index: mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp =================================================================== --- mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp +++ mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp @@ -31,9 +31,9 @@ void SCFToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - Operation *op = getOperation(); + ModuleOp module = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(op); + auto targetAttr = spirv::lookupTargetEnvOrDefault(module); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -49,10 +49,10 @@ populateMemRefToSPIRVPatterns(typeConverter, patterns); populateBuiltinFuncToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(op, *target, std::move(patterns)))) + if (failed(applyPartialConversion(module, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertSCFToSPIRVPass() { +std::unique_ptr> mlir::createConvertSCFToSPIRVPass() { return std::make_unique(); } Index: mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp =================================================================== --- mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp +++ mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp @@ -26,9 +26,9 @@ : public ConvertTensorToSPIRVBase { void runOnOperation() override { MLIRContext *context = &getContext(); - Operation *op = getOperation(); + ModuleOp module = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(op); + auto targetAttr = spirv::lookupTargetEnvOrDefault(module); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -43,12 +43,13 @@ patterns); populateBuiltinFuncToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(op, *target, std::move(patterns)))) + if (failed(applyPartialConversion(module, *target, std::move(patterns)))) return signalPassFailure(); } }; } // namespace -std::unique_ptr> mlir::createConvertTensorToSPIRVPass() { +std::unique_ptr> +mlir::createConvertTensorToSPIRVPass() { return std::make_unique(); } Index: mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp =================================================================== --- mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp +++ mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp @@ -30,9 +30,9 @@ void ConvertVectorToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - Operation *op = getOperation(); + ModuleOp module = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(op); + auto targetAttr = spirv::lookupTargetEnvOrDefault(module); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -52,10 +52,11 @@ RewritePatternSet patterns(context); populateVectorToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(op, *target, std::move(patterns)))) + if (failed(applyPartialConversion(module, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertVectorToSPIRVPass() { +std::unique_ptr> +mlir::createConvertVectorToSPIRVPass() { return std::make_unique(); }