diff --git a/mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h b/mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h --- a/mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h +++ b/mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h @@ -9,6 +9,7 @@ #ifndef MLIR_CONVERSION_ARITHMETICTOSPIRV_ARITHMETICTOSPIRV_H #define MLIR_CONVERSION_ARITHMETICTOSPIRV_ARITHMETICTOSPIRV_H +#include "mlir/Pass/Pass.h" #include namespace mlir { @@ -21,7 +22,7 @@ void populateArithmeticToSPIRVPatterns(SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); -std::unique_ptr createConvertArithmeticToSPIRVPass(); +std::unique_ptr> createConvertArithmeticToSPIRVPass(); } // namespace arith } // namespace mlir diff --git a/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h b/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h --- a/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h +++ b/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 diff --git a/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h b/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h --- a/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h +++ b/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 diff --git a/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h b/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h --- a/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h +++ b/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 diff --git a/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h b/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h --- a/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h +++ b/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 diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td --- a/mlir/include/mlir/Conversion/Passes.td +++ b/mlir/include/mlir/Conversion/Passes.td @@ -114,7 +114,7 @@ // ArithmeticToSPIRV //===----------------------------------------------------------------------===// -def ConvertArithmeticToSPIRV : Pass<"convert-arith-to-spirv", "ModuleOp"> { +def ConvertArithmeticToSPIRV : Pass<"convert-arith-to-spirv"> { let summary = "Convert Arithmetic dialect to SPIR-V dialect"; let constructor = "mlir::arith::createConvertArithmeticToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; @@ -250,7 +250,7 @@ // ControlFlowToSPIRV //===----------------------------------------------------------------------===// -def ConvertControlFlowToSPIRV : Pass<"convert-cf-to-spirv", "ModuleOp"> { +def ConvertControlFlowToSPIRV : Pass<"convert-cf-to-spirv"> { 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", "ModuleOp"> { +def ConvertFuncToSPIRV : Pass<"convert-func-to-spirv"> { 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", "ModuleOp"> { +def ConvertMathToSPIRV : Pass<"convert-math-to-spirv"> { 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", "ModuleOp"> { +def ConvertMemRefToSPIRV : Pass<"convert-memref-to-spirv"> { 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", "ModuleOp"> { +def SCFToSPIRV : Pass<"convert-scf-to-spirv"> { 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", "ModuleOp"> { +def ConvertTensorToSPIRV : Pass<"convert-tensor-to-spirv"> { 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", "ModuleOp"> { +def ConvertVectorToSPIRV : Pass<"convert-vector-to-spirv"> { let summary = "Convert Vector dialect to SPIR-V dialect"; let constructor = "mlir::createConvertVectorToSPIRVPass()"; let dependentDialects = ["spirv::SPIRVDialect"]; 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 @@ -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 diff --git a/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h b/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h --- a/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h +++ b/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 diff --git a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h --- a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h +++ b/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 diff --git a/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp b/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp --- a/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp +++ b/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp @@ -912,8 +912,8 @@ struct ConvertArithmeticToSPIRVPass : public ConvertArithmeticToSPIRVBase { void runOnOperation() override { - auto module = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); + Operation *op = getOperation(); + auto targetAttr = spirv::lookupTargetEnvOrDefault(op); auto target = SPIRVConversionTarget::get(targetAttr); SPIRVTypeConverter::Options options; @@ -934,12 +934,13 @@ RewritePatternSet patterns(&getContext()); arith::populateArithmeticToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(module, *target, std::move(patterns)))) + if (failed(applyPartialConversion(op, *target, std::move(patterns)))) signalPassFailure(); } }; } // namespace -std::unique_ptr mlir::arith::createConvertArithmeticToSPIRVPass() { +std::unique_ptr> +mlir::arith::createConvertArithmeticToSPIRVPass() { return std::make_unique(); } diff --git a/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp b/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp --- a/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp +++ b/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp @@ -28,9 +28,9 @@ void ConvertControlFlowToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - ModuleOp module = getOperation(); + Operation *op = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); + auto targetAttr = spirv::lookupTargetEnvOrDefault(op); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -41,11 +41,10 @@ RewritePatternSet patterns(context); cf::populateControlFlowToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(module, *target, std::move(patterns)))) + if (failed(applyPartialConversion(op, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> -mlir::createConvertControlFlowToSPIRVPass() { +std::unique_ptr> mlir::createConvertControlFlowToSPIRVPass() { return std::make_unique(); } diff --git a/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp b/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp --- a/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp +++ b/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp @@ -28,9 +28,9 @@ void ConvertFuncToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - ModuleOp module = getOperation(); + Operation *op = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); + auto targetAttr = spirv::lookupTargetEnvOrDefault(op); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -42,10 +42,10 @@ populateFuncToSPIRVPatterns(typeConverter, patterns); populateBuiltinFuncToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(module, *target, std::move(patterns)))) + if (failed(applyPartialConversion(op, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertFuncToSPIRVPass() { +std::unique_ptr> mlir::createConvertFuncToSPIRVPass() { return std::make_unique(); } diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp --- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp @@ -59,7 +59,7 @@ gpuModules.push_back(builder.clone(*moduleOp.getOperation())); }); - // Map MemRef memory space to SPIR-V sotrage class first if requested. + // Map MemRef memory space to SPIR-V storage class first if requested. if (mapMemorySpace) { std::unique_ptr target = spirv::getMemorySpaceToStorageClassTarget(*context); diff --git a/mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp b/mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp --- a/mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp +++ b/mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp @@ -28,9 +28,9 @@ void ConvertMathToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - ModuleOp module = getOperation(); + Operation *op = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); + auto targetAttr = spirv::lookupTargetEnvOrDefault(op); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -50,10 +50,10 @@ RewritePatternSet patterns(context); populateMathToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(module, *target, std::move(patterns)))) + if (failed(applyPartialConversion(op, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertMathToSPIRVPass() { +std::unique_ptr> mlir::createConvertMathToSPIRVPass() { return std::make_unique(); } diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp --- a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp +++ b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp @@ -28,9 +28,9 @@ void ConvertMemRefToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - ModuleOp module = getOperation(); + Operation *op = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); + auto targetAttr = spirv::lookupTargetEnvOrDefault(op); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -52,11 +52,10 @@ RewritePatternSet patterns(context); populateMemRefToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(module, *target, std::move(patterns)))) + if (failed(applyPartialConversion(op, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> -mlir::createConvertMemRefToSPIRVPass() { +std::unique_ptr> mlir::createConvertMemRefToSPIRVPass() { return std::make_unique(); } 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 @@ -31,9 +31,9 @@ void SCFToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - ModuleOp module = getOperation(); + Operation *op = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); + auto targetAttr = spirv::lookupTargetEnvOrDefault(op); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -49,10 +49,10 @@ populateMemRefToSPIRVPatterns(typeConverter, patterns); populateBuiltinFuncToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(module, *target, std::move(patterns)))) + if (failed(applyPartialConversion(op, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> mlir::createConvertSCFToSPIRVPass() { +std::unique_ptr> mlir::createConvertSCFToSPIRVPass() { return std::make_unique(); } diff --git a/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp b/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp --- a/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp +++ b/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp @@ -26,9 +26,9 @@ : public ConvertTensorToSPIRVBase { void runOnOperation() override { MLIRContext *context = &getContext(); - ModuleOp module = getOperation(); + Operation *op = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); + auto targetAttr = spirv::lookupTargetEnvOrDefault(op); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -43,13 +43,12 @@ patterns); populateBuiltinFuncToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(module, *target, std::move(patterns)))) + if (failed(applyPartialConversion(op, *target, std::move(patterns)))) return signalPassFailure(); } }; } // namespace -std::unique_ptr> -mlir::createConvertTensorToSPIRVPass() { +std::unique_ptr> mlir::createConvertTensorToSPIRVPass() { return std::make_unique(); } diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp --- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp +++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp @@ -30,9 +30,9 @@ void ConvertVectorToSPIRVPass::runOnOperation() { MLIRContext *context = &getContext(); - ModuleOp module = getOperation(); + Operation *op = getOperation(); - auto targetAttr = spirv::lookupTargetEnvOrDefault(module); + auto targetAttr = spirv::lookupTargetEnvOrDefault(op); std::unique_ptr target = SPIRVConversionTarget::get(targetAttr); @@ -52,11 +52,10 @@ RewritePatternSet patterns(context); populateVectorToSPIRVPatterns(typeConverter, patterns); - if (failed(applyPartialConversion(module, *target, std::move(patterns)))) + if (failed(applyPartialConversion(op, *target, std::move(patterns)))) return signalPassFailure(); } -std::unique_ptr> -mlir::createConvertVectorToSPIRVPass() { +std::unique_ptr> mlir::createConvertVectorToSPIRVPass() { return std::make_unique(); }