[mlir] Rename the Standard dialect to the Func dialect
The last remaining operations in the standard dialect all revolve around
FuncOp/function related constructs. This patch simply handles the initial
renaming (which by itself is already huge), but there are a large number
of cleanups unlocked/necessary afterwards:
* Removing a bunch of unnecessary dependencies on Func
* Cleaning up the From/ToStandard conversion passes
* Preparing for the move of FuncOp to the Func dialect
See the discussion at https://discourse.llvm.org/t/standard-dialect-the-final-chapter/6061
Differential Revision: https://reviews.llvm.org/D120624
diff --git a/flang/include/flang/Lower/Support/Utils.h b/flang/include/flang/Lower/Support/Utils.h
index 0acd607..40968d4 100644
--- a/flang/include/flang/Lower/Support/Utils.h
+++ b/flang/include/flang/Lower/Support/Utils.h
@@ -16,7 +16,7 @@
#include "flang/Common/indirection.h"
#include "flang/Parser/char-block.h"
#include "flang/Semantics/tools.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "llvm/ADT/StringRef.h"
#include <cstdint>
diff --git a/flang/include/flang/Optimizer/Builder/Factory.h b/flang/include/flang/Optimizer/Builder/Factory.h
index cc25c67..d0d5510 100644
--- a/flang/include/flang/Optimizer/Builder/Factory.h
+++ b/flang/include/flang/Optimizer/Builder/Factory.h
@@ -17,7 +17,7 @@
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "llvm/ADT/iterator_range.h"
namespace mlir {
diff --git a/flang/include/flang/Optimizer/Builder/Runtime/Character.h b/flang/include/flang/Optimizer/Builder/Runtime/Character.h
index 4249302..b13a651 100644
--- a/flang/include/flang/Optimizer/Builder/Runtime/Character.h
+++ b/flang/include/flang/Optimizer/Builder/Runtime/Character.h
@@ -9,7 +9,7 @@
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_CHARACTER_H
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_CHARACTER_H
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
namespace fir {
class ExtendedValue;
diff --git a/flang/include/flang/Optimizer/Builder/Runtime/Numeric.h b/flang/include/flang/Optimizer/Builder/Runtime/Numeric.h
index 323cc2c..9380ad7 100644
--- a/flang/include/flang/Optimizer/Builder/Runtime/Numeric.h
+++ b/flang/include/flang/Optimizer/Builder/Runtime/Numeric.h
@@ -9,7 +9,7 @@
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_NUMERIC_H
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_NUMERIC_H
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
namespace fir {
class ExtendedValue;
diff --git a/flang/include/flang/Optimizer/Builder/Runtime/Reduction.h b/flang/include/flang/Optimizer/Builder/Runtime/Reduction.h
index 9907d67..1f15fdd 100644
--- a/flang/include/flang/Optimizer/Builder/Runtime/Reduction.h
+++ b/flang/include/flang/Optimizer/Builder/Runtime/Reduction.h
@@ -16,7 +16,7 @@
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_REDUCTION_H
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_REDUCTION_H
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
namespace fir {
class ExtendedValue;
diff --git a/flang/include/flang/Optimizer/Builder/Runtime/Transformational.h b/flang/include/flang/Optimizer/Builder/Runtime/Transformational.h
index 5f1f28b..1657dff 100644
--- a/flang/include/flang/Optimizer/Builder/Runtime/Transformational.h
+++ b/flang/include/flang/Optimizer/Builder/Runtime/Transformational.h
@@ -10,7 +10,7 @@
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_TRANSFORMATIONAL_H
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_TRANSFORMATIONAL_H
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
namespace fir {
class ExtendedValue;
diff --git a/flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td b/flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
index 65f669c..8760c6a 100644
--- a/flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
+++ b/flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
@@ -16,7 +16,6 @@
include "mlir/IR/OpBase.td"
include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
-include "mlir/Dialect/StandardOps/IR/Ops.td"
include "flang/Optimizer/Dialect/FIROps.td"
def IdenticalTypePred : Constraint<CPred<"$0.getType() == $1.getType()">>;
diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.h b/flang/include/flang/Optimizer/Dialect/FIROps.h
index 3a67577..a78c853 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.h
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.h
@@ -11,7 +11,7 @@
#include "flang/Optimizer/Dialect/FIRType.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
diff --git a/flang/include/flang/Optimizer/Dialect/FIROpsSupport.h b/flang/include/flang/Optimizer/Dialect/FIROpsSupport.h
index c99f2a3..28fecd3 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROpsSupport.h
+++ b/flang/include/flang/Optimizer/Dialect/FIROpsSupport.h
@@ -10,7 +10,7 @@
#define FORTRAN_OPTIMIZER_DIALECT_FIROPSSUPPORT_H
#include "flang/Optimizer/Dialect/FIROps.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BuiltinOps.h"
namespace fir {
@@ -25,7 +25,7 @@
/// return true iff the Operation is a call
inline bool isaCall(mlir::Operation *op) {
return isa<fir::CallOp>(op) || isa<fir::DispatchOp>(op) ||
- isa<mlir::CallOp>(op) || isa<mlir::CallIndirectOp>(op);
+ isa<mlir::func::CallOp>(op) || isa<mlir::func::CallIndirectOp>(op);
}
/// return true iff the Operation is a fir::CallOp, fir::DispatchOp,
diff --git a/flang/include/flang/Optimizer/Support/InitFIR.h b/flang/include/flang/Optimizer/Support/InitFIR.h
index 30108ec..f312518 100644
--- a/flang/include/flang/Optimizer/Support/InitFIR.h
+++ b/flang/include/flang/Optimizer/Support/InitFIR.h
@@ -28,7 +28,7 @@
mlir::AffineDialect, FIROpsDialect, mlir::acc::OpenACCDialect, \
mlir::omp::OpenMPDialect, mlir::scf::SCFDialect, \
mlir::arith::ArithmeticDialect, mlir::cf::ControlFlowDialect, \
- mlir::StandardOpsDialect, mlir::vector::VectorDialect
+ mlir::func::FuncDialect, mlir::vector::VectorDialect
// The definitive list of dialects used by flang.
#define FLANG_DIALECT_LIST \
diff --git a/flang/include/flang/Optimizer/Support/Utils.h b/flang/include/flang/Optimizer/Support/Utils.h
index 26783d2..d25a400 100644
--- a/flang/include/flang/Optimizer/Support/Utils.h
+++ b/flang/include/flang/Optimizer/Support/Utils.h
@@ -15,7 +15,7 @@
#include "flang/Common/default-kinds.h"
#include "flang/Optimizer/Dialect/FIRType.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BuiltinAttributes.h"
namespace fir {
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index fa92753..d81cb36 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -25,7 +25,7 @@
}];
let constructor = "::fir::createAbstractResultOptPass()";
let dependentDialects = [
- "fir::FIROpsDialect", "mlir::StandardOpsDialect"
+ "fir::FIROpsDialect", "mlir::func::FuncDialect"
];
let options = [
Option<"passResultAsBox", "abstract-result-as-box",
@@ -56,7 +56,7 @@
}];
let constructor = "::fir::createPromoteToAffinePass()";
let dependentDialects = [
- "fir::FIROpsDialect", "mlir::StandardOpsDialect", "mlir::AffineDialect"
+ "fir::FIROpsDialect", "mlir::func::FuncDialect", "mlir::AffineDialect"
];
}
@@ -70,7 +70,7 @@
}];
let constructor = "::fir::createAffineDemotionPass()";
let dependentDialects = [
- "fir::FIROpsDialect", "mlir::StandardOpsDialect", "mlir::AffineDialect"
+ "fir::FIROpsDialect", "mlir::func::FuncDialect", "mlir::AffineDialect"
];
}
@@ -122,7 +122,7 @@
}];
let constructor = "::fir::createFirToCfgPass()";
let dependentDialects = [
- "fir::FIROpsDialect", "mlir::StandardOpsDialect"
+ "fir::FIROpsDialect", "mlir::func::FuncDialect"
];
let options = [
Option<"forceLoopToExecuteOnce", "always-execute-loop-body", "bool",
@@ -148,7 +148,7 @@
}];
let constructor = "::fir::createMemDataFlowOptPass()";
let dependentDialects = [
- "fir::FIROpsDialect", "mlir::StandardOpsDialect"
+ "fir::FIROpsDialect", "mlir::func::FuncDialect"
];
}
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index b8b52e4..6e50e1c 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -427,7 +427,7 @@
/// Generate the cleanup block before the program exits
void genExitRoutine() {
if (blockIsUnterminated())
- builder->create<mlir::ReturnOp>(toLocation());
+ builder->create<mlir::func::ReturnOp>(toLocation());
}
void genFIR(const Fortran::parser::EndProgramStmt &) { genExitRoutine(); }
@@ -459,7 +459,7 @@
TODO(loc, "Convert to actual type");
return builder->create<fir::LoadOp>(loc, resultRef);
});
- builder->create<mlir::ReturnOp>(loc, resultVal);
+ builder->create<mlir::func::ReturnOp>(loc, resultVal);
}
void genFIRProcedureExit(Fortran::lower::pft::FunctionLikeUnit &funit,
diff --git a/flang/lib/Lower/CMakeLists.txt b/flang/lib/Lower/CMakeLists.txt
index 031701e..e60087e 100644
--- a/flang/lib/Lower/CMakeLists.txt
+++ b/flang/lib/Lower/CMakeLists.txt
@@ -37,9 +37,9 @@
FortranEvaluate
FortranSemantics
MLIRAffineToStandard
+ MLIRFunc
MLIRLLVMIR
MLIRSCFToControlFlow
- MLIRStandard
LINK_COMPONENTS
Support
diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index 60745b8..dd8c6ce 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -31,7 +31,7 @@
#include "flang/Semantics/symbol.h"
#include "flang/Semantics/tools.h"
#include "flang/Semantics/type.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE "flang-lower-expr"
diff --git a/flang/lib/Optimizer/Builder/Runtime/Character.cpp b/flang/lib/Optimizer/Builder/Runtime/Character.cpp
index 5a2ea82..2575e65 100644
--- a/flang/lib/Optimizer/Builder/Runtime/Character.cpp
+++ b/flang/lib/Optimizer/Builder/Runtime/Character.cpp
@@ -13,7 +13,7 @@
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
#include "flang/Runtime/character.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
using namespace Fortran::runtime;
diff --git a/flang/lib/Optimizer/Builder/Runtime/Numeric.cpp b/flang/lib/Optimizer/Builder/Runtime/Numeric.cpp
index 5c7da46..f3db541 100644
--- a/flang/lib/Optimizer/Builder/Runtime/Numeric.cpp
+++ b/flang/lib/Optimizer/Builder/Runtime/Numeric.cpp
@@ -12,7 +12,7 @@
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
#include "flang/Runtime/numeric.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
using namespace Fortran::runtime;
diff --git a/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp b/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
index c726d3c..750968d 100644
--- a/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
+++ b/flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
@@ -13,7 +13,7 @@
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
#include "flang/Runtime/reduction.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
using namespace Fortran::runtime;
diff --git a/flang/lib/Optimizer/Builder/Runtime/Transformational.cpp b/flang/lib/Optimizer/Builder/Runtime/Transformational.cpp
index 467f09e..9d2a18c 100644
--- a/flang/lib/Optimizer/Builder/Runtime/Transformational.cpp
+++ b/flang/lib/Optimizer/Builder/Runtime/Transformational.cpp
@@ -15,7 +15,7 @@
#include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
#include "flang/Runtime/matmul.h"
#include "flang/Runtime/transformational.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
using namespace Fortran::runtime;
diff --git a/flang/lib/Optimizer/CodeGen/CGOps.h b/flang/lib/Optimizer/CodeGen/CGOps.h
index f5f552c..c6419aa 100644
--- a/flang/lib/Optimizer/CodeGen/CGOps.h
+++ b/flang/lib/Optimizer/CodeGen/CGOps.h
@@ -14,7 +14,7 @@
#define OPTIMIZER_CODEGEN_CGOPS_H
#include "flang/Optimizer/Dialect/FIRType.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
using namespace mlir;
diff --git a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
index a4c9305..5ebf14b 100644
--- a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
@@ -262,7 +262,7 @@
mlir::OpBuilder rewriter(&context);
mlir::ConversionTarget target(context);
target.addLegalDialect<mlir::arith::ArithmeticDialect, FIROpsDialect,
- FIRCodeGenDialect, mlir::StandardOpsDialect>();
+ FIRCodeGenDialect, mlir::func::FuncDialect>();
target.addIllegalOp<ArrayCoorOp>();
target.addIllegalOp<ReboxOp>();
target.addDynamicallyLegalOp<EmboxOp>([](EmboxOp embox) {
diff --git a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
index 575d267..ef4b59e 100644
--- a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
@@ -599,20 +599,20 @@
auto newArg = func.front().insertArgument(fixup.index,
newInTys[fixup.index], loc);
offset++;
- func.walk([&](mlir::ReturnOp ret) {
+ func.walk([&](mlir::func::ReturnOp ret) {
rewriter->setInsertionPoint(ret);
auto oldOper = ret.getOperand(0);
auto oldOperTy = ReferenceType::get(oldOper.getType());
auto cast = rewriter->create<ConvertOp>(loc, oldOperTy, newArg);
rewriter->create<fir::StoreOp>(loc, oldOper, cast);
- rewriter->create<mlir::ReturnOp>(loc);
+ rewriter->create<mlir::func::ReturnOp>(loc);
ret.erase();
});
} break;
case FixupTy::Codes::ReturnType: {
// The function is still returning a value, but its type has likely
// changed to suit the target ABI convention.
- func.walk([&](mlir::ReturnOp ret) {
+ func.walk([&](mlir::func::ReturnOp ret) {
rewriter->setInsertionPoint(ret);
auto oldOper = ret.getOperand(0);
auto oldOperTy = ReferenceType::get(oldOper.getType());
@@ -621,7 +621,7 @@
auto cast = rewriter->create<ConvertOp>(loc, oldOperTy, mem);
rewriter->create<fir::StoreOp>(loc, oldOper, cast);
mlir::Value load = rewriter->create<fir::LoadOp>(loc, mem);
- rewriter->create<mlir::ReturnOp>(loc, load);
+ rewriter->create<mlir::func::ReturnOp>(loc, load);
ret.erase();
});
} break;
diff --git a/flang/lib/Optimizer/Dialect/FIRDialect.cpp b/flang/lib/Optimizer/Dialect/FIRDialect.cpp
index 45320d5..6193924 100644
--- a/flang/lib/Optimizer/Dialect/FIRDialect.cpp
+++ b/flang/lib/Optimizer/Dialect/FIRDialect.cpp
@@ -42,7 +42,7 @@
/// return.
void handleTerminator(mlir::Operation *op,
llvm::ArrayRef<mlir::Value> valuesToRepl) const final {
- auto returnOp = cast<mlir::ReturnOp>(op);
+ auto returnOp = cast<mlir::func::ReturnOp>(op);
assert(returnOp.getNumOperands() == valuesToRepl.size());
for (const auto &it : llvm::enumerate(returnOp.getOperands()))
valuesToRepl[it.index()].replaceAllUsesWith(it.value());
diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp
index 0f1f594..9a9a31e 100644
--- a/flang/lib/Optimizer/Dialect/FIROps.cpp
+++ b/flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -16,7 +16,7 @@
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/Utils.h"
#include "mlir/Dialect/CommonFolders.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Diagnostics.h"
diff --git a/flang/lib/Optimizer/Transforms/AbstractResult.cpp b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
index 156ff41..f885ffb 100644
--- a/flang/lib/Optimizer/Transforms/AbstractResult.cpp
+++ b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
@@ -11,7 +11,7 @@
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -149,14 +149,14 @@
}
};
-class ReturnOpConversion : public mlir::OpRewritePattern<mlir::ReturnOp> {
+class ReturnOpConversion : public mlir::OpRewritePattern<mlir::func::ReturnOp> {
public:
using OpRewritePattern::OpRewritePattern;
ReturnOpConversion(mlir::MLIRContext *context,
const AbstractResultOptions &opt)
: OpRewritePattern(context), options{opt} {}
mlir::LogicalResult
- matchAndRewrite(mlir::ReturnOp ret,
+ matchAndRewrite(mlir::func::ReturnOp ret,
mlir::PatternRewriter &rewriter) const override {
rewriter.setInsertionPoint(ret);
auto returnedValue = ret.getOperand(0);
@@ -177,7 +177,7 @@
if (!replacedStorage)
rewriter.create<fir::StoreOp>(ret.getLoc(), returnedValue,
options.newArg);
- rewriter.replaceOpWithNewOp<mlir::ReturnOp>(ret);
+ rewriter.replaceOpWithNewOp<mlir::func::ReturnOp>(ret);
return mlir::success();
}
@@ -239,8 +239,8 @@
rewriter.create<fir::BoxAddrOp>(loc, bufferType, options.newArg);
}
patterns.insert<ReturnOpConversion>(context, options);
- target.addDynamicallyLegalOp<mlir::ReturnOp>(
- [](mlir::ReturnOp ret) { return ret.operands().empty(); });
+ target.addDynamicallyLegalOp<mlir::func::ReturnOp>(
+ [](mlir::func::ReturnOp ret) { return ret.operands().empty(); });
}
}
@@ -249,7 +249,7 @@
// Convert the calls and, if needed, the ReturnOp in the function body.
target.addLegalDialect<fir::FIROpsDialect, mlir::arith::ArithmeticDialect,
- mlir::StandardOpsDialect>();
+ mlir::func::FuncDialect>();
target.addIllegalOp<fir::SaveResultOp>();
target.addDynamicallyLegalOp<fir::CallOp>([](fir::CallOp call) {
return !mustConvertCallOrFunc(call.getFunctionType());
diff --git a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
index ceebc26..01f2c99 100644
--- a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
@@ -23,9 +23,9 @@
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/Visitors.h"
@@ -158,7 +158,7 @@
});
target.addLegalDialect<FIROpsDialect, mlir::scf::SCFDialect,
mlir::arith::ArithmeticDialect,
- mlir::StandardOpsDialect>();
+ mlir::func::FuncDialect>();
if (mlir::failed(mlir::applyPartialConversion(function, target,
std::move(patterns)))) {
diff --git a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
index daf84b6..e771c2c 100644
--- a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
@@ -21,8 +21,8 @@
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/Visitors.h"
@@ -595,7 +595,7 @@
mlir::ConversionTarget target = *context;
target.addLegalDialect<
mlir::AffineDialect, FIROpsDialect, mlir::scf::SCFDialect,
- mlir::arith::ArithmeticDialect, mlir::StandardOpsDialect>();
+ mlir::arith::ArithmeticDialect, mlir::func::FuncDialect>();
target.addDynamicallyLegalOp<IfOp>([&functionAnalysis](fir::IfOp op) {
return !(functionAnalysis.getChildIfAnalysis(op).canPromoteToAffine());
});
diff --git a/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp b/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
index 81e37f6..e9c4ef9 100644
--- a/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
+++ b/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
@@ -792,7 +792,7 @@
mlir::ConversionTarget target(*context);
target.addLegalDialect<
FIROpsDialect, mlir::scf::SCFDialect, mlir::arith::ArithmeticDialect,
- mlir::cf::ControlFlowDialect, mlir::StandardOpsDialect>();
+ mlir::cf::ControlFlowDialect, mlir::func::FuncDialect>();
target.addIllegalOp<ArrayFetchOp, ArrayUpdateOp, ArrayModifyOp>();
// Rewrite the array fetch and array update ops.
if (mlir::failed(
diff --git a/flang/lib/Optimizer/Transforms/CharacterConversion.cpp b/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
index f58d03c..650b990 100644
--- a/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
@@ -13,7 +13,7 @@
#include "flang/Optimizer/Support/FIRContext.h"
#include "flang/Optimizer/Support/KindMapping.h"
#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -107,7 +107,7 @@
mlir::ConversionTarget target(*context);
target.addLegalDialect<mlir::AffineDialect, fir::FIROpsDialect,
mlir::arith::ArithmeticDialect,
- mlir::StandardOpsDialect>();
+ mlir::func::FuncDialect>();
// apply the patterns
target.addIllegalOp<fir::CharConvertOp>();
diff --git a/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp b/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
index f3f86cb..726fa01 100644
--- a/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
+++ b/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
@@ -11,7 +11,7 @@
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Dominance.h"
#include "mlir/IR/Operation.h"
#include "mlir/Transforms/Passes.h"
diff --git a/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp b/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
index 76ca3fd..408cdc6 100644
--- a/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
+++ b/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
@@ -11,7 +11,7 @@
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -41,7 +41,7 @@
if (auto func = mlir::dyn_cast<mlir::FuncOp>(op))
for (mlir::Block &block : func)
for (mlir::Operation &i : block)
- if (mlir::isa<mlir::ReturnOp>(i)) {
+ if (mlir::isa<mlir::func::ReturnOp>(i)) {
returnMap[op].push_back(&i);
break;
}
@@ -189,7 +189,7 @@
const auto &analysis = getAnalysis<ReturnAnalysis>();
target.addLegalDialect<fir::FIROpsDialect, mlir::arith::ArithmeticDialect,
- mlir::StandardOpsDialect>();
+ mlir::func::FuncDialect>();
target.addDynamicallyLegalOp<fir::AllocaOp>([&](fir::AllocaOp alloca) {
return keepStackAllocation(alloca, &func.front(), options);
});
diff --git a/flang/lib/Optimizer/Transforms/PassDetail.h b/flang/lib/Optimizer/Transforms/PassDetail.h
index 02d203f..c81993d 100644
--- a/flang/lib/Optimizer/Transforms/PassDetail.h
+++ b/flang/lib/Optimizer/Transforms/PassDetail.h
@@ -10,10 +10,10 @@
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassRegistry.h"
diff --git a/flang/lib/Optimizer/Transforms/RewriteLoop.cpp b/flang/lib/Optimizer/Transforms/RewriteLoop.cpp
index 4e20a4b..c2a9cc7 100644
--- a/flang/lib/Optimizer/Transforms/RewriteLoop.cpp
+++ b/flang/lib/Optimizer/Transforms/RewriteLoop.cpp
@@ -12,7 +12,7 @@
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/CommandLine.h"
@@ -304,7 +304,7 @@
context, forceLoopToExecuteOnce);
mlir::ConversionTarget target(*context);
target.addLegalDialect<mlir::AffineDialect, mlir::cf::ControlFlowDialect,
- FIROpsDialect, mlir::StandardOpsDialect>();
+ FIROpsDialect, mlir::func::FuncDialect>();
// apply the patterns
target.addIllegalOp<ResultOp, DoLoopOp, IfOp, IterWhileOp>();
diff --git a/mlir/benchmark/python/common.py b/mlir/benchmark/python/common.py
index a340911..9ab6b1a 100644
--- a/mlir/benchmark/python/common.py
+++ b/mlir/benchmark/python/common.py
@@ -6,9 +6,9 @@
from mlir import ir
from mlir.dialects import arith
from mlir.dialects import builtin
+from mlir.dialects import func
from mlir.dialects import memref
from mlir.dialects import scf
-from mlir.dialects import std
from mlir.passmanager import PassManager
@@ -93,15 +93,15 @@
iter_args = list(wrapped_func.arguments[-num_results - 1:-1])
loop = scf.ForOp(zero, n_iterations, one, iter_args)
with ir.InsertionPoint(loop.body):
- start = std.CallOp(timer_func, [])
- call = std.CallOp(
+ start = func.CallOp(timer_func, [])
+ call = func.CallOp(
func,
wrapped_func.arguments[:-num_results - 1] + loop.inner_iter_args
)
- end = std.CallOp(timer_func, [])
+ end = func.CallOp(timer_func, [])
time_taken = arith.SubIOp(end, start)
memref.StoreOp(time_taken, timer_buffer, [loop.induction_variable])
scf.YieldOp(list(call.results))
- std.ReturnOp(loop)
+ func.ReturnOp(loop)
return wrapped_func
diff --git a/mlir/docs/Bindings/Python.md b/mlir/docs/Bindings/Python.md
index c9d38bb..f867948 100644
--- a/mlir/docs/Bindings/Python.md
+++ b/mlir/docs/Bindings/Python.md
@@ -885,16 +885,16 @@
`_{DIALECT_NAMESPACE}_ops_gen.py` wrapper module is created. This is done by
invoking `mlir-tblgen` on a python-bindings specific tablegen wrapper that
includes the boilerplate and actual dialect specific `td` file. An example, for
-the `StandardOps` (which is assigned the namespace `std` as a special case):
+the `Func` (which is assigned the namespace `func` as a special case):
```tablegen
-#ifndef PYTHON_BINDINGS_STANDARD_OPS
-#define PYTHON_BINDINGS_STANDARD_OPS
+#ifndef PYTHON_BINDINGS_FUNC_OPS
+#define PYTHON_BINDINGS_FUNC_OPS
include "mlir/Bindings/Python/Attributes.td"
-include "mlir/Dialect/StandardOps/IR/Ops.td"
+include "mlir/Dialect/Func/IR/FuncOps.td"
-#endif
+#endif // PYTHON_BINDINGS_FUNC_OPS
```
In the main repository, building the wrapper is done via the CMake function
diff --git a/mlir/docs/Bufferization.md b/mlir/docs/Bufferization.md
index 2f1d7a1..3f39e8d 100644
--- a/mlir/docs/Bufferization.md
+++ b/mlir/docs/Bufferization.md
@@ -169,7 +169,7 @@
populateTensorBufferizePatterns(typeConverter, patterns);
target.addIllegalOp<tensor::CastOp, tensor::ExtractOp>();
- target.addLegalDialect<StandardOpsDialect>();
+ target.addLegalDialect<func::FuncDialect>();
if (failed(
applyPartialConversion(getOperation(), target, std::move(patterns))))
diff --git a/mlir/docs/DialectConversion.md b/mlir/docs/DialectConversion.md
index 4731ef5..1173a0d 100644
--- a/mlir/docs/DialectConversion.md
+++ b/mlir/docs/DialectConversion.md
@@ -100,9 +100,9 @@
/// constraints.
addDynamicallyLegalDialect<AffineDialect>([](Operation *op) { ... });
- /// Mark `std.return` as dynamically legal, but provide a specific legality
+ /// Mark `func.return` as dynamically legal, but provide a specific legality
/// callback.
- addDynamicallyLegalOp<ReturnOp>([](ReturnOp op) { ... });
+ addDynamicallyLegalOp<func::ReturnOp>([](func::ReturnOp op) { ... });
/// Treat unknown operations, i.e. those without a legalization action
/// directly set, as dynamically legal.
@@ -424,15 +424,15 @@
```
//===-------------------------------------------===//
-Legalizing operation : 'std.return'(0x608000002e20) {
- "std.return"() : () -> ()
+Legalizing operation : 'func.return'(0x608000002e20) {
+ "func.return"() : () -> ()
* Fold {
} -> FAILURE : unable to fold
- * Pattern : 'std.return -> ()' {
+ * Pattern : 'func.return -> ()' {
** Insert : 'spv.Return'(0x6070000453e0)
- ** Replace : 'std.return'(0x608000002e20)
+ ** Replace : 'func.return'(0x608000002e20)
//===-------------------------------------------===//
Legalizing operation : 'spv.Return'(0x6070000453e0) {
@@ -445,8 +445,8 @@
//===-------------------------------------------===//
```
-This output is describing the legalization of an `std.return` operation. We
+This output is describing the legalization of an `func.return` operation. We
first try to legalize by folding the operation, but that is unsuccessful for
-`std.return`. From there, a pattern is applied that replaces the `std.return`
+`func.return`. From there, a pattern is applied that replaces the `func.return`
with a `spv.Return`. The newly generated `spv.Return` is then processed for
legalization, but is found to already legal as per the target.
diff --git a/mlir/docs/Dialects/Affine.md b/mlir/docs/Dialects/Affine.md
index 4e1ca8f..89d9d89 100644
--- a/mlir/docs/Dialects/Affine.md
+++ b/mlir/docs/Dialects/Affine.md
@@ -66,7 +66,7 @@
at the top level of an `AffineScope` op (i.e., immediately enclosed by the
latter), 3. a value that dominates the `AffineScope` op enclosing the value's
use, 4. the result of a
-[`constant` operation](Standard.md/#stdconstant-constantop), 5. the result of an
+constant operation, 5. the result of an
[`affine.apply` operation](#affineapply-affineapplyop) that recursively takes as
arguments any valid symbolic identifiers, or 6. the result of a
[`dim` operation](MemRef.md/#memrefdim-mlirmemrefdimop) on either a memref that
diff --git a/mlir/docs/Dialects/Func.md b/mlir/docs/Dialects/Func.md
new file mode 100644
index 0000000..4d94d1a
--- /dev/null
+++ b/mlir/docs/Dialects/Func.md
@@ -0,0 +1,15 @@
+# 'func' Dialect
+
+This dialect provides documentation for operations within the Func dialect.
+
+This dialect contains operations surrounding high order function
+abstractions, such as calls.
+
+**Please post an RFC on the [forum](https://llvm.discourse.group/c/mlir/31)
+before adding or changing any operation in this dialect.**
+
+[TOC]
+
+## Operations
+
+[include "Dialects/FuncOps.md"]
diff --git a/mlir/docs/Dialects/Standard.md b/mlir/docs/Dialects/Standard.md
deleted file mode 100644
index 942a9767..0000000
--- a/mlir/docs/Dialects/Standard.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# 'std' Dialect
-
-This dialect provides documentation for operations within the Standard dialect.
-
-Note: This dialect is a collection of operations for several different concepts,
-and should be split into multiple more-focused dialects accordingly.
-
-**Please post an RFC on the [forum](https://llvm.discourse.group/c/mlir/31)
-before adding or changing any operation in this dialect.**
-
-[TOC]
-
-## Operations
-
-[include "Dialects/StandardOps.md"]
diff --git a/mlir/docs/Dialects/Vector.md b/mlir/docs/Dialects/Vector.md
index 33289ab..c010c3c 100644
--- a/mlir/docs/Dialects/Vector.md
+++ b/mlir/docs/Dialects/Vector.md
@@ -99,7 +99,7 @@
```mlir
%2 = arith.addf %0, %1 : vector<3x7x8xf32> // -> vector<3x7x8xf32> %2 =
-arith.mulf %0, %1 : vector<3x7x8xf32> // -> vector<3x7x8xf32> %2 = std.splat
+arith.mulf %0, %1 : vector<3x7x8xf32> // -> vector<3x7x8xf32> %2 = vector.splat
%1 : vector<3x7x8xf32> // -> vector<3x7x8xf32>
%1 = vector.extract %0[1]: vector<3x7x8xf32> // -> vector<7x8xf32> %1 =
diff --git a/mlir/docs/Dialects/emitc.md b/mlir/docs/Dialects/emitc.md
index e90fd32..8974e82 100644
--- a/mlir/docs/Dialects/emitc.md
+++ b/mlir/docs/Dialects/emitc.md
@@ -26,10 +26,10 @@
* 'cf' Dialect
* `cf.br`
* `cf.cond_br`
-* 'std' Dialect
- * `std.call`
- * `std.constant`
- * `std.return`
+* 'func' Dialect
+ * `func.call`
+ * `func.constant`
+ * `func.return`
* 'scf' Dialect
* `scf.for`
* `scf.if`
diff --git a/mlir/docs/LangRef.md b/mlir/docs/LangRef.md
index 2fe1c62..927d50f 100644
--- a/mlir/docs/LangRef.md
+++ b/mlir/docs/LangRef.md
@@ -256,10 +256,10 @@
A few of the dialects supported by MLIR:
* [Affine dialect](Dialects/Affine.md)
+* [Func dialect](Dialects/Func.md)
* [GPU dialect](Dialects/GPU.md)
* [LLVM dialect](Dialects/LLVM.md)
* [SPIR-V dialect](Dialects/SPIR-V.md)
-* [Standard dialect](Dialects/Standard.md)
* [Vector dialect](Dialects/Vector.md)
### Target specific operations
diff --git a/mlir/docs/OpDefinitions.md b/mlir/docs/OpDefinitions.md
index 09a3ca5..87c33b5 100644
--- a/mlir/docs/OpDefinitions.md
+++ b/mlir/docs/OpDefinitions.md
@@ -861,7 +861,7 @@
- All region variables can be used. When a non-variable length region is
used, if the group is not present the region is empty.
-An example of an operation with an optional group is `std.return`, which has a
+An example of an operation with an optional group is `func.return`, which has a
variadic number of operands.
```tablegen
diff --git a/mlir/docs/Passes.md b/mlir/docs/Passes.md
index 13ec3ba..aeed41a 100644
--- a/mlir/docs/Passes.md
+++ b/mlir/docs/Passes.md
@@ -28,6 +28,10 @@
[include "ArithmeticPasses.md"]
+## `func` Dialect Passes
+
+[include "FuncPasses.md"]
+
## `gpu` Dialect Passes
[include "GPUPasses.md"]
@@ -68,10 +72,6 @@
[include "SPIRVPasses.md"]
-## `standard` Dialect Passes
-
-[include "StandardPasses.md"]
-
## `tensor` Dialect Passes
[include "TensorPasses.md"]
diff --git a/mlir/docs/SymbolsAndSymbolTables.md b/mlir/docs/SymbolsAndSymbolTables.md
index 25df6e2..3786682 100644
--- a/mlir/docs/SymbolsAndSymbolTables.md
+++ b/mlir/docs/SymbolsAndSymbolTables.md
@@ -33,7 +33,7 @@
link, or use, to the symbol. An example of a `Symbol` operation is
[`builtin.func`](Dialects/Builtin.md/#func-mlirfuncop). `builtin.func` defines a
symbol name, which is [referred to](#referencing-a-symbol) by operations like
-[`std.call`](Dialects/Standard.md/#stdcall-callop).
+[`func.call`](Dialects/Func.md/#funccall-callop).
### Defining or declaring a Symbol
diff --git a/mlir/docs/TargetLLVMIR.md b/mlir/docs/TargetLLVMIR.md
index f56ada6..e3ebe99 100644
--- a/mlir/docs/TargetLLVMIR.md
+++ b/mlir/docs/TargetLLVMIR.md
@@ -348,7 +348,7 @@
Examples:
-This convention is implemented in the conversion of `std.func` and `std.call` to
+This convention is implemented in the conversion of `builtin.func` and `func.call` to
the LLVM dialect, with the former unpacking the descriptor into a set of
individual values and the latter packing those values back into a descriptor so
as to make it transparently usable by other operations. Conversions from other
@@ -481,7 +481,7 @@
dynamically allocated memory, and the pointer in the unranked descriptor is
updated accordingly. The allocation happens immediately before returning. It is
the responsibility of the caller to free the dynamically allocated memory. The
-default conversion of `std.call` and `std.call_indirect` copies the ranked
+default conversion of `func.call` and `func.call_indirect` copies the ranked
descriptor to newly allocated memory on the caller's stack. Thus, the convention
of the ranked memref descriptor pointed to by an unranked memref descriptor
being stored on stack is respected.
diff --git a/mlir/docs/Tutorials/CreatingADialect.md b/mlir/docs/Tutorials/CreatingADialect.md
index 3f39cfce..2926c36 100644
--- a/mlir/docs/Tutorials/CreatingADialect.md
+++ b/mlir/docs/Tutorials/CreatingADialect.md
@@ -130,7 +130,7 @@
Each conversion typically exists in a separate library, declared with
add_mlir_conversion_library(). Conversion libraries typically depend
on their source and target dialects, but may also depend on other
-dialects (e.g. MLIRStandard). Typically this dependence is specified
+dialects (e.g. MLIRFunc). Typically this dependence is specified
using target_link_libraries() and the PUBLIC keyword. For instance:
```cmake
diff --git a/mlir/docs/Tutorials/Toy/Ch-5.md b/mlir/docs/Tutorials/Toy/Ch-5.md
index b5ab606..0d04738 100644
--- a/mlir/docs/Tutorials/Toy/Ch-5.md
+++ b/mlir/docs/Tutorials/Toy/Ch-5.md
@@ -63,9 +63,9 @@
// We define the specific operations, or dialects, that are legal targets for
// this lowering. In our case, we are lowering to a combination of the
- // `Affine`, `Arithmetic`, `MemRef`, and `Standard` dialects.
+ // `Affine`, `Arithmetic`, `Func`, and `MemRef` dialects.
target.addLegalDialect<AffineDialect, arith::ArithmeticDialect,
- memref::MemRefDialect, StandardOpsDialect>();
+ func::FuncDialect, memref::MemRefDialect>();
// We also define the Toy dialect as Illegal so that the conversion will fail
// if any of these operations are *not* converted. Given that we actually want
diff --git a/mlir/examples/standalone/standalone-opt/standalone-opt.cpp b/mlir/examples/standalone/standalone-opt/standalone-opt.cpp
index e279545..5a1354d 100644
--- a/mlir/examples/standalone/standalone-opt/standalone-opt.cpp
+++ b/mlir/examples/standalone/standalone-opt/standalone-opt.cpp
@@ -28,7 +28,7 @@
mlir::DialectRegistry registry;
registry.insert<mlir::standalone::StandaloneDialect,
- mlir::arith::ArithmeticDialect, mlir::StandardOpsDialect>();
+ mlir::arith::ArithmeticDialect, mlir::func::FuncDialect>();
// Add the following to include *all* MLIR Core dialects, or selectively
// include what you need like above. You only need to register dialects that
// will be *parsed* by the tool, not the one generated
diff --git a/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
index 545a714..8994153 100644
--- a/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
@@ -17,8 +17,8 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/Sequence.h"
@@ -229,8 +229,8 @@
if (op.hasOperand())
return failure();
- // We lower "toy.return" directly to "std.return".
- rewriter.replaceOpWithNewOp<ReturnOp>(op);
+ // We lower "toy.return" directly to "func.return".
+ rewriter.replaceOpWithNewOp<func::ReturnOp>(op);
return success();
}
};
@@ -279,7 +279,7 @@
struct ToyToAffineLoweringPass
: public PassWrapper<ToyToAffineLoweringPass, OperationPass<FuncOp>> {
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<AffineDialect, memref::MemRefDialect, StandardOpsDialect>();
+ registry.insert<AffineDialect, func::FuncDialect, memref::MemRefDialect>();
}
void runOnOperation() final;
};
@@ -305,9 +305,9 @@
// We define the specific operations, or dialects, that are legal targets for
// this lowering. In our case, we are lowering to a combination of the
- // `Affine`, `Arithmetic`, `MemRef`, and `Standard` dialects.
+ // `Affine`, `Arithmetic`, `Func`, and `MemRef` dialects.
target.addLegalDialect<AffineDialect, arith::ArithmeticDialect,
- memref::MemRefDialect, StandardOpsDialect>();
+ func::FuncDialect, memref::MemRefDialect>();
// We also define the Toy dialect as Illegal so that the conversion will fail
// if any of these operations are *not* converted. Given that we actually want
diff --git a/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
index 78de920..fa7d4c7 100644
--- a/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
@@ -17,8 +17,8 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/Sequence.h"
@@ -229,8 +229,8 @@
if (op.hasOperand())
return failure();
- // We lower "toy.return" directly to "std.return".
- rewriter.replaceOpWithNewOp<ReturnOp>(op);
+ // We lower "toy.return" directly to "func.return".
+ rewriter.replaceOpWithNewOp<func::ReturnOp>(op);
return success();
}
};
@@ -279,7 +279,7 @@
struct ToyToAffineLoweringPass
: public PassWrapper<ToyToAffineLoweringPass, OperationPass<FuncOp>> {
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<AffineDialect, memref::MemRefDialect, StandardOpsDialect>();
+ registry.insert<AffineDialect, func::FuncDialect, memref::MemRefDialect>();
}
void runOnOperation() final;
};
@@ -305,9 +305,9 @@
// We define the specific operations, or dialects, that are legal targets for
// this lowering. In our case, we are lowering to a combination of the
- // `Affine`, `Arithmetic`, `MemRef`, and `Standard` dialects.
+ // `Affine`, `Arithmetic`, `Func`, and `MemRef` dialects.
target.addLegalDialect<AffineDialect, arith::ArithmeticDialect,
- memref::MemRefDialect, StandardOpsDialect>();
+ func::FuncDialect, memref::MemRefDialect>();
// We also define the Toy dialect as Illegal so that the conversion will fail
// if any of these operations are *not* converted. Given that we actually want
diff --git a/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp b/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
index 855566b..ca7a598 100644
--- a/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
+++ b/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
@@ -35,10 +35,10 @@
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/Sequence.h"
@@ -91,8 +91,8 @@
// Insert a newline after each of the inner dimensions of the shape.
if (i != e - 1)
- rewriter.create<CallOp>(loc, printfRef, rewriter.getIntegerType(32),
- newLineCst);
+ rewriter.create<func::CallOp>(loc, printfRef,
+ rewriter.getIntegerType(32), newLineCst);
rewriter.create<scf::YieldOp>(loc);
rewriter.setInsertionPointToStart(loop.getBody());
}
@@ -101,8 +101,9 @@
auto printOp = cast<toy::PrintOp>(op);
auto elementLoad =
rewriter.create<memref::LoadOp>(loc, printOp.input(), loopIvs);
- rewriter.create<CallOp>(loc, printfRef, rewriter.getIntegerType(32),
- ArrayRef<Value>({formatSpecifierCst, elementLoad}));
+ rewriter.create<func::CallOp>(
+ loc, printfRef, rewriter.getIntegerType(32),
+ ArrayRef<Value>({formatSpecifierCst, elementLoad}));
// Notify the rewriter that this operation has been removed.
rewriter.eraseOp(op);
diff --git a/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
index 78de920..fa7d4c7 100644
--- a/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
@@ -17,8 +17,8 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/Sequence.h"
@@ -229,8 +229,8 @@
if (op.hasOperand())
return failure();
- // We lower "toy.return" directly to "std.return".
- rewriter.replaceOpWithNewOp<ReturnOp>(op);
+ // We lower "toy.return" directly to "func.return".
+ rewriter.replaceOpWithNewOp<func::ReturnOp>(op);
return success();
}
};
@@ -279,7 +279,7 @@
struct ToyToAffineLoweringPass
: public PassWrapper<ToyToAffineLoweringPass, OperationPass<FuncOp>> {
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<AffineDialect, memref::MemRefDialect, StandardOpsDialect>();
+ registry.insert<AffineDialect, func::FuncDialect, memref::MemRefDialect>();
}
void runOnOperation() final;
};
@@ -305,9 +305,9 @@
// We define the specific operations, or dialects, that are legal targets for
// this lowering. In our case, we are lowering to a combination of the
- // `Affine`, `Arithmetic`, `MemRef`, and `Standard` dialects.
+ // `Affine`, `Arithmetic`, `Func`, and `MemRef` dialects.
target.addLegalDialect<AffineDialect, arith::ArithmeticDialect,
- memref::MemRefDialect, StandardOpsDialect>();
+ func::FuncDialect, memref::MemRefDialect>();
// We also define the Toy dialect as Illegal so that the conversion will fail
// if any of these operations are *not* converted. Given that we actually want
diff --git a/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp b/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
index 855566b..ca7a598 100644
--- a/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
+++ b/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
@@ -35,10 +35,10 @@
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/Sequence.h"
@@ -91,8 +91,8 @@
// Insert a newline after each of the inner dimensions of the shape.
if (i != e - 1)
- rewriter.create<CallOp>(loc, printfRef, rewriter.getIntegerType(32),
- newLineCst);
+ rewriter.create<func::CallOp>(loc, printfRef,
+ rewriter.getIntegerType(32), newLineCst);
rewriter.create<scf::YieldOp>(loc);
rewriter.setInsertionPointToStart(loop.getBody());
}
@@ -101,8 +101,9 @@
auto printOp = cast<toy::PrintOp>(op);
auto elementLoad =
rewriter.create<memref::LoadOp>(loc, printOp.input(), loopIvs);
- rewriter.create<CallOp>(loc, printfRef, rewriter.getIntegerType(32),
- ArrayRef<Value>({formatSpecifierCst, elementLoad}));
+ rewriter.create<func::CallOp>(
+ loc, printfRef, rewriter.getIntegerType(32),
+ ArrayRef<Value>({formatSpecifierCst, elementLoad}));
// Notify the rewriter that this operation has been removed.
rewriter.eraseOp(op);
diff --git a/mlir/include/mlir-c/Dialect/Standard.h b/mlir/include/mlir-c/Dialect/Func.h
similarity index 71%
rename from mlir/include/mlir-c/Dialect/Standard.h
rename to mlir/include/mlir-c/Dialect/Func.h
index 2009621..4bdac42 100644
--- a/mlir/include/mlir-c/Dialect/Standard.h
+++ b/mlir/include/mlir-c/Dialect/Func.h
@@ -1,4 +1,4 @@
-//===-- mlir-c/Dialect/Standard.h - C API for Standard dialect ----*- C -*-===//
+//===-- mlir-c/Dialect/Func.h - C API for Func dialect ------------*- C -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
// Exceptions.
@@ -8,15 +8,15 @@
//===----------------------------------------------------------------------===//
//
// This header declares the C interface for registering and accessing the
-// Standard dialect. A dialect should be registered with a context to make it
+// Func dialect. A dialect should be registered with a context to make it
// available to users of the context. These users must load the dialect
// before using any of its attributes, operations or types. Parser and pass
// manager can load registered dialects automatically.
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_C_DIALECT_STANDARD_H
-#define MLIR_C_DIALECT_STANDARD_H
+#ifndef MLIR_C_DIALECT_FUNC_H
+#define MLIR_C_DIALECT_FUNC_H
#include "mlir-c/Registration.h"
@@ -24,10 +24,10 @@
extern "C" {
#endif
-MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Standard, std);
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Func, func);
#ifdef __cplusplus
}
#endif
-#endif // MLIR_C_DIALECT_STANDARD_H
+#endif // MLIR_C_DIALECT_FUNC_H
diff --git a/mlir/include/mlir-c/Registration.h b/mlir/include/mlir-c/Registration.h
index 4424496..ab37866 100644
--- a/mlir/include/mlir-c/Registration.h
+++ b/mlir/include/mlir-c/Registration.h
@@ -20,7 +20,7 @@
// Dialect registration declarations.
// Registration entry-points for each dialect are declared using the common
// MLIR_DECLARE_DIALECT_REGISTRATION_CAPI macro, which takes the dialect
-// API name (i.e. "Standard", "Tensor", "Linalg") and namespace (i.e. "std",
+// API name (i.e. "Func", "Tensor", "Linalg") and namespace (i.e. "func",
// "tensor", "linalg"). The following declarations are produced:
//
// /// Gets the above hook methods in struct form for a dialect by namespace.
diff --git a/mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h b/mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h
index 89d8844..9214b33 100644
--- a/mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h
+++ b/mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h
@@ -25,8 +25,8 @@
/// to derive the bitwidth from the LLVM data layout.
static constexpr unsigned kDeriveIndexBitwidthFromDataLayout = 0;
-/// Options to control the Standard dialect to LLVM lowering. The struct is used
-/// to share lowering options between passes, patterns, and type converter.
+/// Options to control the LLVM lowering. The struct is used to share lowering
+/// options between passes, patterns, and type converter.
class LowerToLLVMOptions {
public:
explicit LowerToLLVMOptions(MLIRContext *ctx);
diff --git a/mlir/include/mlir/Conversion/LLVMCommon/TypeConverter.h b/mlir/include/mlir/Conversion/LLVMCommon/TypeConverter.h
index aa59fda..e5d4b5f 100644
--- a/mlir/include/mlir/Conversion/LLVMCommon/TypeConverter.h
+++ b/mlir/include/mlir/Conversion/LLVMCommon/TypeConverter.h
@@ -26,7 +26,7 @@
class LLVMDialect;
} // namespace LLVM
-/// Conversion from types in the Standard dialect to the LLVM IR dialect.
+/// Conversion from types to the LLVM IR dialect.
class LLVMTypeConverter : public TypeConverter {
/// Give structFuncArgTypeConverter access to memref-specific functions.
friend LogicalResult
diff --git a/mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h b/mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
index ff538ac..a891962 100644
--- a/mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
+++ b/mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
@@ -20,7 +20,7 @@
namespace linalg {
//===----------------------------------------------------------------------===//
-// Patterns to convert a LinalgOp to std.call @external library implementation.
+// Patterns to convert a LinalgOp to func.call @external library implementation.
//===----------------------------------------------------------------------===//
// These patterns are exposed individually because they are expected to be
// typically used individually.
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index 09a5b93..33bc5c2 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -67,9 +67,9 @@
}];
let constructor = "mlir::createLowerAffinePass()";
let dependentDialects = [
+ "func::FuncDialect",
"memref::MemRefDialect",
"scf::SCFDialect",
- "StandardOpsDialect",
"vector::VectorDialect"
];
}
@@ -227,9 +227,9 @@
let summary = "Generate NVVM operations for gpu operations";
let constructor = "mlir::createLowerGpuOpsToNVVMOpsPass()";
let dependentDialects = [
+ "func::FuncDialect",
"memref::MemRefDialect",
"NVVM::NVVMDialect",
- "StandardOpsDialect",
];
let options = [
Option<"indexBitwidth", "index-bitwidth", "unsigned",
@@ -327,7 +327,7 @@
let summary = "Convert the operations from the linalg dialect into the "
"Standard dialect";
let constructor = "mlir::createConvertLinalgToStandardPass()";
- let dependentDialects = ["memref::MemRefDialect", "StandardOpsDialect"];
+ let dependentDialects = ["func::FuncDialect", "memref::MemRefDialect"];
}
//===----------------------------------------------------------------------===//
@@ -356,7 +356,7 @@
let constructor = "mlir::createConvertMathToLibmPass()";
let dependentDialects = [
"arith::ArithmeticDialect",
- "StandardOpsDialect",
+ "func::FuncDialect",
"vector::VectorDialect",
];
}
@@ -553,7 +553,7 @@
"dialect";
let constructor = "mlir::createConvertShapeToStandardPass()";
let dependentDialects = [
- "StandardOpsDialect",
+ "func::FuncDialect",
"scf::SCFDialect",
];
}
@@ -705,7 +705,7 @@
let summary = "Lower TOSA to the Standard dialect";
let dependentDialects = [
"arith::ArithmeticDialect",
- "StandardOpsDialect",
+ "func::FuncDialect",
"tensor::TensorDialect",
];
let description = [{
diff --git a/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h b/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
index 66b8226..1f649f35 100644
--- a/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
+++ b/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
@@ -74,7 +74,7 @@
}
};
-/// Collect a set of patterns to convert from the Vector dialect to SCF + std.
+/// Collect a set of patterns to convert from the Vector dialect to SCF + func.
void populateVectorToSCFConversionPatterns(
RewritePatternSet &patterns,
const VectorTransferToSCFOptions &options = VectorTransferToSCFOptions());
diff --git a/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h b/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h
index 872b1f8..af2bebb 100644
--- a/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/AffineAnalysis.h
@@ -16,7 +16,7 @@
#define MLIR_DIALECT_AFFINE_ANALYSIS_AFFINEANALYSIS_H
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Value.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td b/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td
index 3452ccd..ab45beb 100644
--- a/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td
@@ -31,7 +31,7 @@
def ArithmeticExpandOps : Pass<"arith-expand"> {
let summary = "Legalize Arithmetic ops to be convertible to LLVM.";
let constructor = "mlir::arith::createArithmeticExpandOpsPass()";
- let dependentDialects = ["StandardOpsDialect"];
+ let dependentDialects = ["func::FuncDialect"];
}
#endif // MLIR_DIALECT_ARITHMETIC_TRANSFORMS_PASSES
diff --git a/mlir/include/mlir/Dialect/ArmSVE/ArmSVEDialect.h b/mlir/include/mlir/Dialect/ArmSVE/ArmSVEDialect.h
index 47686dd..282623c 100644
--- a/mlir/include/mlir/Dialect/ArmSVE/ArmSVEDialect.h
+++ b/mlir/include/mlir/Dialect/ArmSVE/ArmSVEDialect.h
@@ -19,7 +19,7 @@
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Dialect/ArmSVE/ArmSVEDialect.h.inc"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#define GET_OP_CLASSES
#include "mlir/Dialect/ArmSVE/ArmSVE.h.inc"
diff --git a/mlir/include/mlir/Dialect/CMakeLists.txt b/mlir/include/mlir/Dialect/CMakeLists.txt
index 7dd5843..d61773d 100644
--- a/mlir/include/mlir/Dialect/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/CMakeLists.txt
@@ -9,6 +9,7 @@
add_subdirectory(ControlFlow)
add_subdirectory(DLTI)
add_subdirectory(EmitC)
+add_subdirectory(Func)
add_subdirectory(GPU)
add_subdirectory(Math)
add_subdirectory(Linalg)
@@ -23,7 +24,6 @@
add_subdirectory(Shape)
add_subdirectory(SparseTensor)
add_subdirectory(SPIRV)
-add_subdirectory(StandardOps)
add_subdirectory(Tensor)
add_subdirectory(Tosa)
add_subdirectory(Vector)
diff --git a/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td b/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td
index ba0ed63..b7ca064 100644
--- a/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td
+++ b/mlir/include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td
@@ -11,8 +11,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef STANDARD_OPS
-#define STANDARD_OPS
+#ifndef MLIR_DIALECTS_CONTROLFLOW_IR_CONTROLFLOWOPS_TD
+#define MLIR_DIALECTS_CONTROLFLOW_IR_CONTROLFLOWOPS_TD
include "mlir/IR/OpAsmInterface.td"
include "mlir/Interfaces/ControlFlowInterfaces.td"
@@ -310,4 +310,4 @@
let hasVerifier = 1;
}
-#endif // STANDARD_OPS
+#endif // MLIR_DIALECTS_CONTROLFLOW_IR_CONTROLFLOWOPS_TD
diff --git a/mlir/include/mlir/Dialect/StandardOps/CMakeLists.txt b/mlir/include/mlir/Dialect/Func/CMakeLists.txt
similarity index 100%
rename from mlir/include/mlir/Dialect/StandardOps/CMakeLists.txt
rename to mlir/include/mlir/Dialect/Func/CMakeLists.txt
diff --git a/mlir/include/mlir/Dialect/Func/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/Func/IR/CMakeLists.txt
new file mode 100644
index 0000000..08a6123
--- /dev/null
+++ b/mlir/include/mlir/Dialect/Func/IR/CMakeLists.txt
@@ -0,0 +1,8 @@
+set(LLVM_TARGET_DEFINITIONS FuncOps.td)
+mlir_tablegen(FuncOps.h.inc -gen-op-decls)
+mlir_tablegen(FuncOps.cpp.inc -gen-op-defs)
+mlir_tablegen(FuncOpsDialect.h.inc -gen-dialect-decls)
+mlir_tablegen(FuncOpsDialect.cpp.inc -gen-dialect-defs)
+add_public_tablegen_target(MLIRFuncOpsIncGen)
+
+add_mlir_doc(FuncOps FuncOps Dialects/ -gen-op-doc)
diff --git a/mlir/include/mlir/Dialect/Func/IR/FuncOps.h b/mlir/include/mlir/Dialect/Func/IR/FuncOps.h
new file mode 100644
index 0000000..8e1bf85
--- /dev/null
+++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.h
@@ -0,0 +1,32 @@
+//===- FuncOps.h - Func Dialect Operations ----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_FUNC_IR_OPS_H
+#define MLIR_DIALECT_FUNC_IR_OPS_H
+
+#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
+#include "mlir/IR/Builders.h"
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/IR/BuiltinTypes.h"
+#include "mlir/IR/Dialect.h"
+#include "mlir/IR/OpImplementation.h"
+#include "mlir/Interfaces/CallInterfaces.h"
+#include "mlir/Interfaces/ControlFlowInterfaces.h"
+#include "mlir/Interfaces/InferTypeOpInterface.h"
+#include "mlir/Interfaces/SideEffectInterfaces.h"
+
+namespace mlir {
+class PatternRewriter;
+} // namespace mlir
+
+#define GET_OP_CLASSES
+#include "mlir/Dialect/Func/IR/FuncOps.h.inc"
+
+#include "mlir/Dialect/Func/IR/FuncOpsDialect.h.inc"
+
+#endif // MLIR_DIALECT_FUNC_IR_OPS_H
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
similarity index 74%
rename from mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
rename to mlir/include/mlir/Dialect/Func/IR/FuncOps.td
index 4fa909c..a2fd773 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
@@ -1,56 +1,51 @@
-//===- Ops.td - Standard operation definitions -------------*- tablegen -*-===//
+//===- FuncOps.td - Func operation definitions -------------*- tablegen -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
-//
-// Defines some MLIR standard operations.
-//
-//===----------------------------------------------------------------------===//
-#ifndef STANDARD_OPS
-#define STANDARD_OPS
+#ifndef MLIR_DIALECT_FUNC_IR_FUNCOPS_TD
+#define MLIR_DIALECT_FUNC_IR_FUNCOPS_TD
include "mlir/IR/OpAsmInterface.td"
include "mlir/IR/SymbolInterfaces.td"
include "mlir/Interfaces/CallInterfaces.td"
-include "mlir/Interfaces/CastInterfaces.td"
include "mlir/Interfaces/ControlFlowInterfaces.td"
include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
-def StandardOps_Dialect : Dialect {
- let name = "std";
- let cppNamespace = "::mlir";
+def Func_Dialect : Dialect {
+ let name = "func";
+ let cppNamespace = "::mlir::func";
let dependentDialects = ["cf::ControlFlowDialect"];
let hasConstantMaterializer = 1;
let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
-// Base class for Standard dialect ops.
-class Std_Op<string mnemonic, list<Trait> traits = []> :
- Op<StandardOps_Dialect, mnemonic, traits>;
+// Base class for Func dialect ops.
+class Func_Op<string mnemonic, list<Trait> traits = []> :
+ Op<Func_Dialect, mnemonic, traits>;
//===----------------------------------------------------------------------===//
// CallOp
//===----------------------------------------------------------------------===//
-def CallOp : Std_Op<"call",
+def CallOp : Func_Op<"call",
[CallOpInterface, MemRefsNormalizable,
DeclareOpInterfaceMethods<SymbolUserOpInterface>]> {
let summary = "call operation";
let description = [{
- The `call` operation represents a direct call to a function that is within
- the same symbol scope as the call. The operands and result types of the
- call must match the specified function type. The callee is encoded as a
+ The `func.call` operation represents a direct call to a function that is
+ within the same symbol scope as the call. The operands and result types of
+ the call must match the specified function type. The callee is encoded as a
symbol reference attribute named "callee".
Example:
```mlir
- %2 = call @my_add(%0, %1) : (f32, f32) -> f32
+ %2 = func.call @my_add(%0, %1) : (f32, f32) -> f32
```
}];
@@ -105,7 +100,7 @@
// CallIndirectOp
//===----------------------------------------------------------------------===//
-def CallIndirectOp : Std_Op<"call_indirect", [
+def CallIndirectOp : Func_Op<"call_indirect", [
CallOpInterface,
TypesMatchWith<"callee input types match argument types",
"callee", "callee_operands",
@@ -116,19 +111,18 @@
]> {
let summary = "indirect call operation";
let description = [{
- The `call_indirect` operation represents an indirect call to a value of
- function type. Functions are first class types in MLIR, and may be passed as
- arguments and merged together with block arguments. The operands and result
- types of the call must match the specified function type.
+ The `func.call_indirect` operation represents an indirect call to a value
+ of function type. The operands and result types of the call must match the
+ specified function type.
Function values can be created with the
- [`constant` operation](#stdconstant-constantop).
+ [`func.constant` operation](#funcconstant-constantop).
Example:
```mlir
- %31 = call_indirect %15(%0, %1)
- : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32>
+ %func = func.constant @my_func : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32>
+ %result = func.call_indirect %func(%0, %1) : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32>
```
}];
@@ -160,38 +154,31 @@
}];
let hasCanonicalizeMethod = 1;
-
- let assemblyFormat =
- "$callee `(` $callee_operands `)` attr-dict `:` type($callee)";
+ let assemblyFormat = [{
+ $callee `(` $callee_operands `)` attr-dict `:` type($callee)
+ }];
}
//===----------------------------------------------------------------------===//
// ConstantOp
//===----------------------------------------------------------------------===//
-def ConstantOp : Std_Op<"constant",
+def ConstantOp : Func_Op<"constant",
[ConstantLike, NoSideEffect,
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>]> {
let summary = "constant";
let description = [{
- Syntax:
-
- ```
- operation ::= ssa-id `=` `std.constant` attribute-value `:` type
- ```
-
- The `constant` operation produces an SSA value from a symbol reference to a
- `builtin.func` operation
+ The `func.constant` operation produces an SSA value from a symbol reference
+ to a `func.func` operation
Example:
```mlir
// Reference to function @myfn.
- %2 = constant @myfn : (tensor<16xf32>, f32) -> tensor<16xf32>
+ %2 = func.constant @myfn : (tensor<16xf32>, f32) -> tensor<16xf32>
// Equivalent generic forms
- %2 = "std.constant"() {value = @myfn}
- : () -> ((tensor<16xf32>, f32) -> tensor<16xf32>)
+ %2 = "func.constant"() { value = @myfn } : () -> ((tensor<16xf32>, f32) -> tensor<16xf32>)
```
MLIR does not allow direct references to functions in SSA operands because
@@ -218,11 +205,11 @@
// ReturnOp
//===----------------------------------------------------------------------===//
-def ReturnOp : Std_Op<"return", [NoSideEffect, HasParent<"FuncOp">,
+def ReturnOp : Func_Op<"return", [NoSideEffect, HasParent<"FuncOp">,
MemRefsNormalizable, ReturnLike, Terminator]> {
- let summary = "return operation";
+ let summary = "Function return operation";
let description = [{
- The `return` operation represents a return operation within a function.
+ The `func.return` operation represents a return operation within a function.
The operation takes variable number of operands and produces no results.
The operand number and types must match the signature of the function
that contains the operation.
@@ -230,7 +217,7 @@
Example:
```mlir
- func @foo() : (i32, f8) {
+ func.func @foo() : (i32, f8) {
...
return %0, %1 : i32, f8
}
@@ -239,12 +226,12 @@
let arguments = (ins Variadic<AnyType>:$operands);
- let builders = [
- OpBuilder<(ins),
- [{ build($_builder, $_state, llvm::None); }]>];
+ let builders = [OpBuilder<(ins), [{
+ build($_builder, $_state, llvm::None);
+ }]>];
let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
let hasVerifier = 1;
}
-#endif // STANDARD_OPS
+#endif // MLIR_DIALECT_FUNC_IR_FUNCOPS_TD
diff --git a/mlir/include/mlir/Dialect/Func/Transforms/CMakeLists.txt b/mlir/include/mlir/Dialect/Func/Transforms/CMakeLists.txt
new file mode 100644
index 0000000..33c72e3
--- /dev/null
+++ b/mlir/include/mlir/Dialect/Func/Transforms/CMakeLists.txt
@@ -0,0 +1,5 @@
+set(LLVM_TARGET_DEFINITIONS Passes.td)
+mlir_tablegen(Passes.h.inc -gen-pass-decls -name Func)
+add_public_tablegen_target(MLIRFuncTransformsIncGen)
+
+add_mlir_doc(Passes FuncPasses ./ -gen-pass-doc)
diff --git a/mlir/include/mlir/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.h b/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h
similarity index 94%
rename from mlir/include/mlir/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.h
rename to mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h
index d96e176..3f811d7e 100644
--- a/mlir/include/mlir/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.h
+++ b/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h
@@ -15,8 +15,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_DIALECT_STANDARDOPS_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H
-#define MLIR_DIALECT_STANDARDOPS_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H
+#ifndef MLIR_DIALECT_FUNC_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H
+#define MLIR_DIALECT_FUNC_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H
#include "mlir/Transforms/DialectConversion.h"
@@ -88,4 +88,4 @@
} // namespace mlir
-#endif // MLIR_DIALECT_STANDARDOPS_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H
+#endif // MLIR_DIALECT_FUNC_TRANSFORMS_DECOMPOSECALLGRAPHTYPES_H
diff --git a/mlir/include/mlir/Dialect/StandardOps/Transforms/FuncConversions.h b/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h
similarity index 89%
rename from mlir/include/mlir/Dialect/StandardOps/Transforms/FuncConversions.h
rename to mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h
index 8457805..adcd308 100644
--- a/mlir/include/mlir/Dialect/StandardOps/Transforms/FuncConversions.h
+++ b/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h
@@ -1,4 +1,4 @@
-//===- FuncConversions.h - Patterns for converting std.funcs ----*- C++ -*-===//
+//===- FuncConversions.h - Patterns for converting func.func ----*- 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 @@
//
//===----------------------------------------------------------------------===//
//
-// This files contains patterns for converting standard functions.
+// This files contains patterns for converting functions.
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_DIALECT_STANDARDOPS_TRANSFORMS_FUNCCONVERSIONS_H_
-#define MLIR_DIALECT_STANDARDOPS_TRANSFORMS_FUNCCONVERSIONS_H_
+#ifndef MLIR_DIALECT_FUNC_TRANSFORMS_FUNCCONVERSIONS_H_
+#define MLIR_DIALECT_FUNC_TRANSFORMS_FUNCCONVERSIONS_H_
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/STLExtras.h"
@@ -70,4 +70,4 @@
bool isNotBranchOpInterfaceOrReturnLikeOp(Operation *op);
} // namespace mlir
-#endif // MLIR_DIALECT_STANDARDOPS_TRANSFORMS_FUNCCONVERSIONS_H_
+#endif // MLIR_DIALECT_FUNC_TRANSFORMS_FUNCCONVERSIONS_H_
diff --git a/mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.h b/mlir/include/mlir/Dialect/Func/Transforms/Passes.h
similarity index 81%
rename from mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.h
rename to mlir/include/mlir/Dialect/Func/Transforms/Passes.h
index 57bd003..5dd3059 100644
--- a/mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Func/Transforms/Passes.h
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
//
-// This header file defines prototypes that expose pass constructors in the loop
+// This header file defines prototypes that expose pass constructors in the Func
// transformation library.
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_DIALECT_STANDARDOPS_TRANSFORMS_PASSES_H
-#define MLIR_DIALECT_STANDARDOPS_TRANSFORMS_PASSES_H
+#ifndef MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_H
+#define MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_H
#include "mlir/Pass/Pass.h"
@@ -23,6 +23,7 @@
class RewritePatternSet;
+namespace func {
/// Creates an instance of func bufferization pass.
std::unique_ptr<Pass> createFuncBufferizePass();
@@ -32,8 +33,9 @@
/// Generate the code for registering passes.
#define GEN_PASS_REGISTRATION
-#include "mlir/Dialect/StandardOps/Transforms/Passes.h.inc"
+#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
+} // namespace func
} // namespace mlir
-#endif // MLIR_DIALECT_STANDARDOPS_TRANSFORMS_PASSES_H
+#endif // MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_H
diff --git a/mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td b/mlir/include/mlir/Dialect/Func/Transforms/Passes.td
similarity index 78%
rename from mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
rename to mlir/include/mlir/Dialect/Func/Transforms/Passes.td
index c871379..d928e2f 100644
--- a/mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Func/Transforms/Passes.td
@@ -1,4 +1,4 @@
-//===-- Passes.td - StandardOps pass definition file -------*- tablegen -*-===//
+//===-- Passes.td - Func pass definition file --------------*- tablegen -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,17 +6,17 @@
//
//===----------------------------------------------------------------------===//
-#ifndef MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES
-#define MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES
+#ifndef MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_TD
+#define MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_TD
include "mlir/Pass/PassBase.td"
def FuncBufferize : Pass<"func-bufferize", "ModuleOp"> {
let summary = "Bufferize func/call/return ops";
let description = [{
- A bufferize pass that bufferizes std.func and std.call ops.
+ A bufferize pass that bufferizes builtin.func and func.call ops.
- Because this pass updates std.func ops, it must be a module pass. It is
+ Because this pass updates builtin.func ops, it must be a module pass. It is
useful to keep this pass separate from other bufferizations so that the
other ones can be run at function-level in parallel.
@@ -35,9 +35,9 @@
Finally, this pass fails for unknown terminators, as we cannot decide
whether they need rewriting.
}];
- let constructor = "mlir::createFuncBufferizePass()";
+ let constructor = "mlir::func::createFuncBufferizePass()";
let dependentDialects = ["bufferization::BufferizationDialect",
"memref::MemRefDialect"];
}
-#endif // MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES
+#endif // MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_TD
diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 4c01460..54c1fa9 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -541,9 +541,9 @@
/// operand_dim_1 = dim %operand, 1 : memref<50x100xf32>
/// scf.for %k = %c0 to operand_dim_0 step %c10 {
/// scf.for %l = %c0 to operand_dim_1 step %c25 {
-/// %4 = std.subview %operand[%k, %l][%c10, %c25][%c1, %c1]
+/// %4 = memref.subview %operand[%k, %l][%c10, %c25][%c1, %c1]
/// : memref<50x100xf32> to memref<?x?xf32, #strided>
-/// %5 = std.subview %result[%k, %l][%c10, %c25][%c1, %c1]
+/// %5 = memref.subview %result[%k, %l][%c10, %c25][%c1, %c1]
/// : memref<50x100xf32> to memref<?x?xf32, #strided>
/// linalg.generic pointwise_2d_trait %4, %5 {
/// ^bb0(%operand_in: f32, %result_in: f32):
diff --git a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
index dfc2a30..310d4d2 100644
--- a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
@@ -9,10 +9,10 @@
#ifndef MLIR_DIALECT_LINALG_UTILS_UTILS_H
#define MLIR_DIALECT_LINALG_UTILS_UTILS_H
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SetVector.h"
diff --git a/mlir/include/mlir/Dialect/Math/IR/MathOps.td b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
index d0bfdf4..c636c70 100644
--- a/mlir/include/mlir/Dialect/Math/IR/MathOps.td
+++ b/mlir/include/mlir/Dialect/Math/IR/MathOps.td
@@ -732,12 +732,6 @@
def Math_TanhOp : Math_FloatUnaryOp<"tanh"> {
let summary = "hyperbolic tangent of the specified value";
let description = [{
- Syntax:
-
- ```
- operation ::= ssa-id `=` `std.tanh` ssa-use `:` type
- ```
-
The `tanh` operation computes the hyperbolic tangent. It takes one operand
and returns one result of the same type. This type may be a float scalar
type, a vector whose element type is float, or a tensor of floats. It has
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index ae4ce7d..f4e126e 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -903,7 +903,7 @@
In an `affine.if` or `affine.for` body, the indices of a load are restricted
to SSA values bound to surrounding loop induction variables,
[symbols](Affine.md/#dimensions-and-symbols), results of a
- [`constant` operation](Standard.md/#stdconstant-constantop), or the result of an
+ constant operations, or the result of an
`affine.apply` operation that can in turn take as arguments all of the
aforementioned SSA values or the recursively result of such an
`affine.apply` operation.
diff --git a/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h b/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
index 701a8c3..e7bfe73 100644
--- a/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
@@ -18,7 +18,9 @@
namespace mlir {
class AffineDialect;
-class StandardOpsDialect;
+namespace func {
+class FuncDialect;
+} // namespace func
namespace tensor {
class TensorDialect;
} // namespace tensor
diff --git a/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td b/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
index 0f2e3a9..9cf6f3d 100644
--- a/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
@@ -14,7 +14,7 @@
def ExpandOps : Pass<"memref-expand", "FuncOp"> {
let summary = "Legalize memref operations to be convertible to LLVM.";
let constructor = "mlir::memref::createExpandOpsPass()";
- let dependentDialects = ["StandardOpsDialect"];
+ let dependentDialects = ["func::FuncDialect"];
}
def FoldSubViewOps : Pass<"fold-memref-subview-ops"> {
@@ -45,7 +45,7 @@
contained in the op. Operations marked with the [MemRefsNormalizable]
(https://mlir.llvm.org/docs/Traits/#memrefsnormalizable) trait are
expected to be normalizable. Supported operations include affine
- operations, memref.alloc, memref.dealloc, and std.return.
+ operations, memref.alloc, memref.dealloc, and func.return.
Given an appropriate layout map specified in the code, this transformation
can express tiled or linearized access to multi-dimensional data
diff --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
index 61fe126..5610064 100644
--- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
+++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
@@ -314,7 +314,7 @@
```mlir
// Define an instance with single range of operands.
- %op = pdl.operation "std.return"(%allArgs : !pdl.range<value>)
+ %op = pdl.operation "func.return"(%allArgs : !pdl.range<value>)
```
2) A variadic number of either !pdl.value or !pdl.range<value>:
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/StandardOps/IR/CMakeLists.txt
deleted file mode 100644
index c1756e9..0000000
--- a/mlir/include/mlir/Dialect/StandardOps/IR/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-set(LLVM_TARGET_DEFINITIONS Ops.td)
-mlir_tablegen(Ops.h.inc -gen-op-decls)
-mlir_tablegen(Ops.cpp.inc -gen-op-defs)
-mlir_tablegen(OpsDialect.h.inc -gen-dialect-decls)
-mlir_tablegen(OpsDialect.cpp.inc -gen-dialect-defs)
-mlir_tablegen(OpsEnums.h.inc -gen-enum-decls)
-mlir_tablegen(OpsEnums.cpp.inc -gen-enum-defs)
-add_public_tablegen_target(MLIRStandardOpsIncGen)
-
-add_mlir_doc(Ops StandardOps Dialects/ -gen-op-doc)
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
deleted file mode 100644
index 6964621..0000000
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//===- Ops.h - Standard MLIR Operations -------------------------*- 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
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines convenience types for working with standard operations
-// in the MLIR operation set.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MLIR_DIALECT_STANDARDOPS_IR_OPS_H
-#define MLIR_DIALECT_STANDARDOPS_IR_OPS_H
-
-#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
-#include "mlir/IR/Builders.h"
-#include "mlir/IR/BuiltinTypes.h"
-#include "mlir/IR/Dialect.h"
-#include "mlir/IR/OpImplementation.h"
-#include "mlir/Interfaces/CallInterfaces.h"
-#include "mlir/Interfaces/CastInterfaces.h"
-#include "mlir/Interfaces/ControlFlowInterfaces.h"
-#include "mlir/Interfaces/InferTypeOpInterface.h"
-#include "mlir/Interfaces/SideEffectInterfaces.h"
-
-// Pull in all enum type definitions and utility function declarations.
-#include "mlir/Dialect/StandardOps/IR/OpsEnums.h.inc"
-
-namespace mlir {
-class AffineMap;
-class Builder;
-class FuncOp;
-class OpBuilder;
-class PatternRewriter;
-} // namespace mlir
-
-#define GET_OP_CLASSES
-#include "mlir/Dialect/StandardOps/IR/Ops.h.inc"
-
-#include "mlir/Dialect/StandardOps/IR/OpsDialect.h.inc"
-
-#endif // MLIR_DIALECT_STANDARDOPS_IR_OPS_H
diff --git a/mlir/include/mlir/Dialect/StandardOps/Transforms/CMakeLists.txt b/mlir/include/mlir/Dialect/StandardOps/Transforms/CMakeLists.txt
deleted file mode 100644
index 4cfeede..0000000
--- a/mlir/include/mlir/Dialect/StandardOps/Transforms/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set(LLVM_TARGET_DEFINITIONS Passes.td)
-mlir_tablegen(Passes.h.inc -gen-pass-decls -name Standard)
-add_public_tablegen_target(MLIRStandardTransformsIncGen)
-
-add_mlir_doc(Passes StandardPasses ./ -gen-pass-doc)
diff --git a/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h b/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h
index b0508c0..218aa12 100644
--- a/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h
+++ b/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h
@@ -9,7 +9,7 @@
#ifndef MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
#define MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td b/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td
index 0de4d32..8a92977 100644
--- a/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td
@@ -24,7 +24,7 @@
let constructor = "createTosaInferShapesPass()";
let dependentDialects = [
- "StandardOpsDialect",
+ "func::FuncDialect",
"tensor::TensorDialect",
"tosa::TosaDialect",
];
diff --git a/mlir/include/mlir/Dialect/Tosa/Utils/CoversionUtils.h b/mlir/include/mlir/Dialect/Tosa/Utils/CoversionUtils.h
index 0848979..7182bb7 100644
--- a/mlir/include/mlir/Dialect/Tosa/Utils/CoversionUtils.h
+++ b/mlir/include/mlir/Dialect/Tosa/Utils/CoversionUtils.h
@@ -14,7 +14,7 @@
#define DIALECT_TOSA_UTILS_COVERSION_UTILS_H_
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/IR/PatternMatch.h"
diff --git a/mlir/include/mlir/InitAllDialects.h b/mlir/include/mlir/InitAllDialects.h
index 7cc54c0..9487876 100644
--- a/mlir/include/mlir/InitAllDialects.h
+++ b/mlir/include/mlir/InitAllDialects.h
@@ -26,6 +26,7 @@
#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
#include "mlir/Dialect/DLTI/DLTI.h"
#include "mlir/Dialect/EmitC/IR/EmitC.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
@@ -44,7 +45,6 @@
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.h"
#include "mlir/Dialect/Tensor/IR/TensorTilingInterfaceImpl.h"
@@ -71,6 +71,7 @@
complex::ComplexDialect,
DLTIDialect,
emitc::EmitCDialect,
+ func::FuncDialect,
gpu::GPUDialect,
LLVM::LLVMDialect,
linalg::LinalgDialect,
@@ -82,7 +83,6 @@
pdl_interp::PDLInterpDialect,
quant::QuantizationDialect,
spirv::SPIRVDialect,
- StandardOpsDialect,
arm_sve::ArmSVEDialect,
vector::VectorDialect,
NVVM::NVVMDialect,
diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h
index eb74ca0..ccbb74d 100644
--- a/mlir/include/mlir/InitAllPasses.h
+++ b/mlir/include/mlir/InitAllPasses.h
@@ -19,6 +19,7 @@
#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "mlir/Dialect/Func/Transforms/Passes.h"
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h"
#include "mlir/Dialect/Linalg/Passes.h"
@@ -29,7 +30,6 @@
#include "mlir/Dialect/Shape/Transforms/Passes.h"
#include "mlir/Dialect/SparseTensor/Pipelines/Passes.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/Transforms/Passes.h"
#include "mlir/Dialect/Tensor/Transforms/Passes.h"
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/Dialect/Vector/Transforms/Passes.h"
@@ -58,6 +58,7 @@
registerAsyncPasses();
arith::registerArithmeticPasses();
bufferization::registerBufferizationPasses();
+ func::registerFuncPasses();
registerGPUPasses();
registerGpuSerializeToCubinPass();
registerGpuSerializeToHsacoPass();
@@ -69,7 +70,6 @@
registerSCFPasses();
registerShapePasses();
spirv::registerSPIRVPasses();
- registerStandardPasses();
tensor::registerTensorPasses();
tosa::registerTosaOptPasses();
vector::registerVectorPasses();
diff --git a/mlir/lib/CAPI/Dialect/CMakeLists.txt b/mlir/lib/CAPI/Dialect/CMakeLists.txt
index f66f7b0..9822f05 100644
--- a/mlir/lib/CAPI/Dialect/CMakeLists.txt
+++ b/mlir/lib/CAPI/Dialect/CMakeLists.txt
@@ -80,13 +80,13 @@
MLIRSparseTensorTransforms
)
-add_mlir_upstream_c_api_library(MLIRCAPIStandard
- Standard.cpp
+add_mlir_upstream_c_api_library(MLIRCAPIFunc
+ Func.cpp
PARTIAL_SOURCES_INTENDED
LINK_LIBS PUBLIC
MLIRCAPIIR
- MLIRStandard
+ MLIRFunc
)
add_mlir_upstream_c_api_library(MLIRCAPITensor
diff --git a/mlir/lib/CAPI/Dialect/Standard.cpp b/mlir/lib/CAPI/Dialect/Func.cpp
similarity index 60%
rename from mlir/lib/CAPI/Dialect/Standard.cpp
rename to mlir/lib/CAPI/Dialect/Func.cpp
index 57083a8..a49d2f4 100644
--- a/mlir/lib/CAPI/Dialect/Standard.cpp
+++ b/mlir/lib/CAPI/Dialect/Func.cpp
@@ -1,4 +1,4 @@
-//===- Standard.cpp - C Interface for Standard dialect --------------------===//
+//===- Func.cpp - C Interface for Func 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,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir-c/Dialect/Standard.h"
+#include "mlir-c/Dialect/Func.h"
#include "mlir/CAPI/Registration.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
-MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Standard, std, mlir::StandardOpsDialect)
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Func, func, mlir::func::FuncDialect)
diff --git a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
index 7c91af4..78d8fd2 100644
--- a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
+++ b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
@@ -16,9 +16,9 @@
#include "../PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/IntegerSet.h"
@@ -553,9 +553,9 @@
populateAffineToStdConversionPatterns(patterns);
populateAffineToVectorConversionPatterns(patterns);
ConversionTarget target(getContext());
- target
- .addLegalDialect<arith::ArithmeticDialect, memref::MemRefDialect,
- scf::SCFDialect, StandardOpsDialect, VectorDialect>();
+ target.addLegalDialect<arith::ArithmeticDialect, func::FuncDialect,
+ memref::MemRefDialect, scf::SCFDialect,
+ VectorDialect>();
if (failed(applyPartialConversion(getOperation(), target,
std::move(patterns))))
signalPassFailure();
diff --git a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
index 9ad3f6b..36969a0 100644
--- a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
@@ -14,11 +14,11 @@
MLIRAffine
MLIRAffineUtils
MLIRArithmetic
+ MLIRFunc
MLIRIR
MLIRMemRef
MLIRSCF
MLIRPass
- MLIRStandard
MLIRTransforms
MLIRVector
)
diff --git a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
index a709a97..6b2007a 100644
--- a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
+++ b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
@@ -14,10 +14,10 @@
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Async/IR/Async.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/LLVMIR/FunctionCallUtils.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/Dialect/StandardOps/Transforms/FuncConversions.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Pass/Pass.h"
@@ -549,8 +549,8 @@
// Tokens creation maps to a simple function call.
if (resultType.isa<TokenType>()) {
- rewriter.replaceOpWithNewOp<CallOp>(op, kCreateToken,
- converter->convertType(resultType));
+ rewriter.replaceOpWithNewOp<func::CallOp>(
+ op, kCreateToken, converter->convertType(resultType));
return success();
}
@@ -574,8 +574,8 @@
return rewriter.create<LLVM::PtrToIntOp>(loc, i64, gep);
};
- rewriter.replaceOpWithNewOp<CallOp>(op, kCreateValue, resultType,
- sizeOf(value));
+ rewriter.replaceOpWithNewOp<func::CallOp>(op, kCreateValue, resultType,
+ sizeOf(value));
return success();
}
@@ -601,9 +601,9 @@
TypeConverter *converter = getTypeConverter();
Type resultType = op.getResult().getType();
- rewriter.replaceOpWithNewOp<CallOp>(op, kCreateGroup,
- converter->convertType(resultType),
- adaptor.getOperands());
+ rewriter.replaceOpWithNewOp<func::CallOp>(
+ op, kCreateGroup, converter->convertType(resultType),
+ adaptor.getOperands());
return success();
}
};
@@ -627,8 +627,8 @@
.Case<TokenType>([](Type) { return kEmplaceToken; })
.Case<ValueType>([](Type) { return kEmplaceValue; });
- rewriter.replaceOpWithNewOp<CallOp>(op, apiFuncName, TypeRange(),
- adaptor.getOperands());
+ rewriter.replaceOpWithNewOp<func::CallOp>(op, apiFuncName, TypeRange(),
+ adaptor.getOperands());
return success();
}
@@ -653,8 +653,8 @@
.Case<TokenType>([](Type) { return kSetTokenError; })
.Case<ValueType>([](Type) { return kSetValueError; });
- rewriter.replaceOpWithNewOp<CallOp>(op, apiFuncName, TypeRange(),
- adaptor.getOperands());
+ rewriter.replaceOpWithNewOp<func::CallOp>(op, apiFuncName, TypeRange(),
+ adaptor.getOperands());
return success();
}
@@ -679,8 +679,8 @@
.Case<GroupType>([](Type) { return kIsGroupError; })
.Case<ValueType>([](Type) { return kIsValueError; });
- rewriter.replaceOpWithNewOp<CallOp>(op, apiFuncName, rewriter.getI1Type(),
- adaptor.getOperands());
+ rewriter.replaceOpWithNewOp<func::CallOp>(
+ op, apiFuncName, rewriter.getI1Type(), adaptor.getOperands());
return success();
}
};
@@ -704,8 +704,8 @@
.Case<ValueType>([](Type) { return kAwaitValue; })
.Case<GroupType>([](Type) { return kAwaitGroup; });
- rewriter.create<CallOp>(op->getLoc(), apiFuncName, TypeRange(),
- adaptor.getOperands());
+ rewriter.create<func::CallOp>(op->getLoc(), apiFuncName, TypeRange(),
+ adaptor.getOperands());
rewriter.eraseOp(op);
return success();
@@ -741,8 +741,9 @@
auto resumePtr = rewriter.create<LLVM::AddressOfOp>(
op->getLoc(), LLVM::LLVMPointerType::get(resumeFnTy), kResume);
- rewriter.create<CallOp>(op->getLoc(), apiFuncName, TypeRange(),
- ValueRange({operand, handle, resumePtr.getRes()}));
+ rewriter.create<func::CallOp>(
+ op->getLoc(), apiFuncName, TypeRange(),
+ ValueRange({operand, handle, resumePtr.getRes()}));
rewriter.eraseOp(op);
return success();
@@ -770,7 +771,7 @@
// Call async runtime API to execute a coroutine in the managed thread.
auto coroHdl = adaptor.handle();
- rewriter.replaceOpWithNewOp<CallOp>(
+ rewriter.replaceOpWithNewOp<func::CallOp>(
op, TypeRange(), kExecute, ValueRange({coroHdl, resumePtr.getRes()}));
return success();
@@ -795,8 +796,8 @@
// Get a pointer to the async value storage from the runtime.
auto i8Ptr = AsyncAPI::opaquePointerType(rewriter.getContext());
auto storage = adaptor.storage();
- auto storagePtr = rewriter.create<CallOp>(loc, kGetValueStorage,
- TypeRange(i8Ptr), storage);
+ auto storagePtr = rewriter.create<func::CallOp>(loc, kGetValueStorage,
+ TypeRange(i8Ptr), storage);
// Cast from i8* to the LLVM pointer type.
auto valueType = op.value().getType();
@@ -838,8 +839,8 @@
// Get a pointer to the async value storage from the runtime.
auto i8Ptr = AsyncAPI::opaquePointerType(rewriter.getContext());
auto storage = adaptor.storage();
- auto storagePtr = rewriter.create<CallOp>(loc, kGetValueStorage,
- TypeRange(i8Ptr), storage);
+ auto storagePtr = rewriter.create<func::CallOp>(loc, kGetValueStorage,
+ TypeRange(i8Ptr), storage);
// Cast from i8* to the LLVM pointer type.
auto valueType = op.result().getType();
@@ -878,7 +879,7 @@
return rewriter.notifyMatchFailure(op, "only token type is supported");
// Replace with a runtime API function call.
- rewriter.replaceOpWithNewOp<CallOp>(
+ rewriter.replaceOpWithNewOp<func::CallOp>(
op, kAddTokenToGroup, rewriter.getI64Type(), adaptor.getOperands());
return success();
@@ -902,8 +903,8 @@
ConversionPatternRewriter &rewriter) const override {
// Replace with a runtime API function call.
- rewriter.replaceOpWithNewOp<CallOp>(op, kGetNumWorkerThreads,
- rewriter.getIndexType());
+ rewriter.replaceOpWithNewOp<func::CallOp>(op, kGetNumWorkerThreads,
+ rewriter.getIndexType());
return success();
}
@@ -932,8 +933,8 @@
rewriter.getI64IntegerAttr(op.count()));
auto operand = adaptor.operand();
- rewriter.replaceOpWithNewOp<CallOp>(op, TypeRange(), apiFunctionName,
- ValueRange({operand, count}));
+ rewriter.replaceOpWithNewOp<func::CallOp>(op, TypeRange(), apiFunctionName,
+ ValueRange({operand, count}));
return success();
}
@@ -961,14 +962,14 @@
//===----------------------------------------------------------------------===//
namespace {
-class ReturnOpOpConversion : public OpConversionPattern<ReturnOp> {
+class ReturnOpOpConversion : public OpConversionPattern<func::ReturnOp> {
public:
using OpConversionPattern::OpConversionPattern;
LogicalResult
- matchAndRewrite(ReturnOp op, OpAdaptor adaptor,
+ matchAndRewrite(func::ReturnOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
- rewriter.replaceOpWithNewOp<ReturnOp>(op, adaptor.getOperands());
+ rewriter.replaceOpWithNewOp<func::ReturnOp>(op, adaptor.getOperands());
return success();
}
};
@@ -1032,8 +1033,8 @@
converter, ctx);
ConversionTarget target(*ctx);
- target
- .addLegalOp<arith::ConstantOp, ConstantOp, UnrealizedConversionCastOp>();
+ target.addLegalOp<arith::ConstantOp, func::ConstantOp,
+ UnrealizedConversionCastOp>();
target.addLegalDialect<LLVM::LLVMDialect>();
// All operations from Async dialect must be lowered to the runtime API and
@@ -1043,9 +1044,10 @@
// Add dynamic legality constraints to apply conversions defined above.
target.addDynamicallyLegalOp<FuncOp>(
[&](FuncOp op) { return converter.isSignatureLegal(op.getType()); });
- target.addDynamicallyLegalOp<ReturnOp>(
- [&](ReturnOp op) { return converter.isLegal(op.getOperandTypes()); });
- target.addDynamicallyLegalOp<CallOp>([&](CallOp op) {
+ target.addDynamicallyLegalOp<func::ReturnOp>([&](func::ReturnOp op) {
+ return converter.isLegal(op.getOperandTypes());
+ });
+ target.addDynamicallyLegalOp<func::CallOp>([&](func::CallOp op) {
return converter.isSignatureLegal(op.getCalleeType());
});
diff --git a/mlir/lib/Conversion/AsyncToLLVM/CMakeLists.txt b/mlir/lib/Conversion/AsyncToLLVM/CMakeLists.txt
index f86c652..c797998 100644
--- a/mlir/lib/Conversion/AsyncToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/AsyncToLLVM/CMakeLists.txt
@@ -13,9 +13,9 @@
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRAsync
+ MLIRFuncTransforms
MLIRLLVMCommonConversion
MLIRLLVMIR
- MLIRStandardOpsTransforms
MLIRStandardToLLVM
MLIRTransforms
)
diff --git a/mlir/lib/Conversion/ComplexToLLVM/CMakeLists.txt b/mlir/lib/Conversion/ComplexToLLVM/CMakeLists.txt
index 8f6a0d7..a02f97d 100644
--- a/mlir/lib/Conversion/ComplexToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/ComplexToLLVM/CMakeLists.txt
@@ -12,8 +12,8 @@
LINK_LIBS PUBLIC
MLIRComplex
+ MLIRFuncTransforms
MLIRLLVMCommonConversion
MLIRLLVMIR
- MLIRStandardOpsTransforms
MLIRTransforms
)
diff --git a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
index c061495..5e2f707 100644
--- a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
+++ b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
@@ -13,8 +13,8 @@
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
using namespace mlir;
using namespace mlir::LLVM;
diff --git a/mlir/lib/Conversion/ComplexToStandard/CMakeLists.txt b/mlir/lib/Conversion/ComplexToStandard/CMakeLists.txt
index 8579ec8..b592d3d 100644
--- a/mlir/lib/Conversion/ComplexToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/ComplexToStandard/CMakeLists.txt
@@ -10,8 +10,8 @@
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRComplex
+ MLIRFunc
MLIRIR
MLIRMath
- MLIRStandard
MLIRTransforms
)
diff --git a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
index 63f862d..ae27bba 100644
--- a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
+++ b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
@@ -14,8 +14,8 @@
#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Math/IR/Math.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -652,7 +652,7 @@
populateComplexToStandardConversionPatterns(patterns);
ConversionTarget target(getContext());
- target.addLegalDialect<arith::ArithmeticDialect, StandardOpsDialect,
+ target.addLegalDialect<arith::ArithmeticDialect, func::FuncDialect,
math::MathDialect>();
target.addLegalOp<complex::CreateOp, complex::ImOp, complex::ReOp>();
if (failed(applyPartialConversion(function, target, std::move(patterns))))
diff --git a/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp b/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
index 2ba8295..cc97ef7 100644
--- a/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
+++ b/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
@@ -29,7 +29,7 @@
#define PASS_NAME "convert-cf-to-llvm"
namespace {
-/// Lower `std.assert`. The default lowering calls the `abort` function if the
+/// Lower `cf.assert`. The default lowering calls the `abort` function if the
/// assertion is violated and has no effect otherwise. The failure message is
/// ignored by the default lowering but should be propagated by any custom
/// lowering.
diff --git a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
index 9192602..f0577a7 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "GPUOpsLowering.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Builders.h"
#include "llvm/Support/FormatVariadic.h"
diff --git a/mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h b/mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h
index b3f3dd9..97006b1 100644
--- a/mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h
+++ b/mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h
@@ -16,7 +16,7 @@
namespace mlir {
// Rewriting that replaces Op with XOp, YOp, or ZOp depending on the dimension
-// that Op operates on. Op is assumed to return an `std.index` value and
+// that Op operates on. Op is assumed to return an `index` value and
// XOp, YOp and ZOp are assumed to return an `llvm.i32` value. Depending on
// `indexBitwidth`, sign-extend or truncate the resulting value to match the
// bitwidth expected by the consumers of the value.
diff --git a/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h b/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
index 00230c9..7a707e5 100644
--- a/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
+++ b/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h
@@ -9,9 +9,9 @@
#define MLIR_CONVERSION_GPUCOMMON_OPTOFUNCCALLLOWERING_H_
#include "mlir/Conversion/LLVMCommon/Pattern.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Builders.h"
namespace mlir {
@@ -24,7 +24,7 @@
/// function called and then the result casted back.
///
/// Example with NVVM:
-/// %exp_f32 = std.exp %arg_f32 : f32
+/// %exp_f32 = math.exp %arg_f32 : f32
///
/// will be transformed into
/// llvm.call @__nv_expf(%arg_f32) : (f32) -> f32
diff --git a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
index c2249ae..8ac1039 100644
--- a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
@@ -6,13 +6,13 @@
MLIRConversionPassIncGen
LINK_LIBS PUBLIC
+ MLIRFunc
MLIRGPUOps
MLIRIR
MLIRLLVMIR
MLIRPass
MLIRSPIRV
MLIRSPIRVSerialization
- MLIRStandard
MLIRSupport
MLIRTransforms
MLIRTranslation
diff --git a/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp b/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
index e106ebf..c879226 100644
--- a/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
+++ b/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
@@ -15,10 +15,10 @@
#include "../PassDetail.h"
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
@@ -170,7 +170,7 @@
gpuLaunchOperands.end());
// Create vulkan launch call op.
- auto vulkanLaunchCallOp = builder.create<CallOp>(
+ auto vulkanLaunchCallOp = builder.create<func::CallOp>(
loc, TypeRange{}, SymbolRefAttr::get(builder.getContext(), kVulkanLaunch),
vulkanLaunchOperands);
diff --git a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
index c654a30..f8d81c5 100644
--- a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
+++ b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
@@ -7,12 +7,12 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/Transforms/DialectConversion.h"
diff --git a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
index 7b3afe8..cfa93c7 100644
--- a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
+++ b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
@@ -10,11 +10,11 @@
#include "../PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
using namespace mlir;
using namespace mlir::linalg;
@@ -102,7 +102,7 @@
// TODO: Add support for more complex library call signatures that include
// indices or captured values.
- rewriter.replaceOpWithNewOp<mlir::CallOp>(
+ rewriter.replaceOpWithNewOp<func::CallOp>(
op, libraryCallName.getValue(), TypeRange(),
createTypeCanonicalizedMemRefOperands(rewriter, op->getLoc(),
op->getOperands()));
@@ -129,9 +129,9 @@
auto module = getOperation();
ConversionTarget target(getContext());
target.addLegalDialect<AffineDialect, arith::ArithmeticDialect,
- memref::MemRefDialect, scf::SCFDialect,
- StandardOpsDialect>();
- target.addLegalOp<ModuleOp, FuncOp, ReturnOp>();
+ func::FuncDialect, memref::MemRefDialect,
+ scf::SCFDialect>();
+ target.addLegalOp<ModuleOp, FuncOp, func::ReturnOp>();
RewritePatternSet patterns(&getContext());
populateLinalgToStandardConversionPatterns(patterns);
if (failed(applyFullConversion(module, target, std::move(patterns))))
diff --git a/mlir/lib/Conversion/MathToLibm/CMakeLists.txt b/mlir/lib/Conversion/MathToLibm/CMakeLists.txt
index c195aa2..2e283f8 100644
--- a/mlir/lib/Conversion/MathToLibm/CMakeLists.txt
+++ b/mlir/lib/Conversion/MathToLibm/CMakeLists.txt
@@ -13,8 +13,8 @@
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRDialectUtils
+ MLIRFuncTransforms
MLIRMath
- MLIRStandardOpsTransforms
MLIRVector
MLIRVectorUtils
)
diff --git a/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp b/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
index 450f04b..569625f 100644
--- a/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
+++ b/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
@@ -10,8 +10,8 @@
#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Math/IR/Math.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
@@ -107,8 +107,8 @@
}
assert(isa<FunctionOpInterface>(SymbolTable::lookupSymbolIn(module, name)));
- rewriter.replaceOpWithNewOp<CallOp>(op, name, op.getType(),
- op->getOperands());
+ rewriter.replaceOpWithNewOp<func::CallOp>(op, name, op.getType(),
+ op->getOperands());
return success();
}
@@ -142,7 +142,7 @@
ConversionTarget target(getContext());
target.addLegalDialect<arith::ArithmeticDialect, BuiltinDialect,
- StandardOpsDialect, vector::VectorDialect>();
+ func::FuncDialect, vector::VectorDialect>();
target.addIllegalDialect<math::MathDialect>();
if (failed(applyPartialConversion(module, target, std::move(patterns))))
signalPassFailure();
diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
index 56413c4..c0d9a29 100644
--- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
+++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
@@ -1753,7 +1753,7 @@
// AtomicRMWOpLowering
//===----------------------------------------------------------------------===//
-/// Try to match the kind of a std.atomic_rmw to determine whether to use a
+/// Try to match the kind of a memref.atomic_rmw to determine whether to use a
/// lowering to llvm.atomicrmw or fallback to llvm.cmpxchg.
static Optional<LLVM::AtomicBinOp>
matchSimpleAtomicOp(memref::AtomicRMWOp atomicOp) {
diff --git a/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp b/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
index 68fed9b..dc23a6e 100644
--- a/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
+++ b/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
@@ -9,9 +9,9 @@
#include "../PassDetail.h"
#include "mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
diff --git a/mlir/lib/Conversion/PassDetail.h b/mlir/lib/Conversion/PassDetail.h
index 99841f0..6eba811 100644
--- a/mlir/lib/Conversion/PassDetail.h
+++ b/mlir/lib/Conversion/PassDetail.h
@@ -15,7 +15,6 @@
namespace mlir {
class AffineDialect;
-class StandardOpsDialect;
// Forward declaration from Dialect.h
template <typename ConcreteDialect>
@@ -42,6 +41,10 @@
class GPUModuleOp;
} // namespace gpu
+namespace func {
+class FuncDialect;
+} // namespace func
+
namespace LLVM {
class LLVMDialect;
} // namespace LLVM
diff --git a/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt b/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt
index b787ddf..fd26f31 100644
--- a/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt
+++ b/mlir/lib/Conversion/SCFToGPU/CMakeLists.txt
@@ -13,12 +13,12 @@
MLIRAffineToStandard
MLIRArithmetic
MLIRComplex
+ MLIRFunc
MLIRGPUTransforms
MLIRIR
MLIRLinalg
MLIRMemRef
MLIRPass
- MLIRStandard
MLIRSupport
MLIRTransforms
)
diff --git a/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
index 99a8b838..523d234 100644
--- a/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
+++ b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
@@ -17,11 +17,11 @@
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/ParallelLoopMapper.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
diff --git a/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp b/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp
index 6acfd38..5223484 100644
--- a/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp
+++ b/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp
@@ -12,9 +12,9 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/ArrayRef.h"
diff --git a/mlir/lib/Conversion/SCFToOpenMP/CMakeLists.txt b/mlir/lib/Conversion/SCFToOpenMP/CMakeLists.txt
index 2e26b75..c6ef843 100644
--- a/mlir/lib/Conversion/SCFToOpenMP/CMakeLists.txt
+++ b/mlir/lib/Conversion/SCFToOpenMP/CMakeLists.txt
@@ -13,9 +13,9 @@
LINK_LIBS PUBLIC
MLIRAnalysis
MLIRArithmetic
+ MLIRFunc
MLIRLLVMIR
MLIROpenMP
MLIRSCF
- MLIRStandard
MLIRTransforms
)
diff --git a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
index c9c5017..6cb90ed 100644
--- a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
+++ b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
@@ -16,11 +16,11 @@
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Transforms/DialectConversion.h"
diff --git a/mlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt
index 615c6b2..2f94127 100644
--- a/mlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt
@@ -14,10 +14,10 @@
MLIRSPIRV
MLIRSPIRVConversion
MLIRStandardToSPIRV
+ MLIRFunc
MLIRIR
MLIRPass
MLIRSCF
- MLIRStandard
MLIRSupport
MLIRTransforms
)
diff --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
index 9f1f93f..8673998 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
@@ -20,10 +20,10 @@
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h"
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Transforms/DialectConversion.h"
diff --git a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
index 14ae384..0120bbc 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
@@ -13,11 +13,11 @@
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Support/LogicalResult.h"
diff --git a/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp b/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp
index f24ae5b..25d5d5b 100644
--- a/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp
+++ b/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp
@@ -10,9 +10,9 @@
#include "../PassDetail.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
index a7cf8a8..bdeba08 100644
--- a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
+++ b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
@@ -10,9 +10,9 @@
#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
@@ -668,7 +668,7 @@
// Setup target legality.
MLIRContext &ctx = getContext();
ConversionTarget target(ctx);
- target.addLegalDialect<arith::ArithmeticDialect, StandardOpsDialect,
+ target.addLegalDialect<arith::ArithmeticDialect, func::FuncDialect,
SCFDialect, tensor::TensorDialect>();
target.addLegalOp<CstrRequireOp, FuncOp, ModuleOp>();
diff --git a/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt b/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
index ec31d81..feb42b1 100644
--- a/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
@@ -16,9 +16,9 @@
MLIRArithmeticToLLVM
MLIRControlFlowToLLVM
MLIRDataLayoutInterfaces
+ MLIRFunc
MLIRLLVMCommonConversion
MLIRLLVMIR
MLIRMath
- MLIRStandard
MLIRTransforms
)
diff --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
index 6caaa0b..a98d89e 100644
--- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -20,9 +20,9 @@
#include "mlir/Conversion/LLVMCommon/VectorPattern.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/FunctionCallUtils.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BlockAndValueMapping.h"
@@ -55,7 +55,7 @@
for (const auto &attr : attrs) {
if (attr.getName() == SymbolTable::getSymbolAttrName() ||
attr.getName() == FunctionOpInterface::getTypeAttrName() ||
- attr.getName() == "std.varargs" ||
+ attr.getName() == "func.varargs" ||
(filterArgAttrs &&
attr.getName() == FunctionOpInterface::getArgDictAttrName()))
continue;
@@ -228,7 +228,7 @@
ConversionPatternRewriter &rewriter) const {
// Convert the original function arguments. They are converted using the
// LLVMTypeConverter provided to this legalization pattern.
- auto varargsAttr = funcOp->getAttrOfType<BoolAttr>("std.varargs");
+ auto varargsAttr = funcOp->getAttrOfType<BoolAttr>("func.varargs");
TypeConverter::SignatureConversion result(funcOp.getNumArguments());
auto llvmType = getTypeConverter()->convertFunctionSignature(
funcOp.getType(), varargsAttr && varargsAttr.getValue(), result);
@@ -388,11 +388,11 @@
}
};
-struct ConstantOpLowering : public ConvertOpToLLVMPattern<ConstantOp> {
- using ConvertOpToLLVMPattern<ConstantOp>::ConvertOpToLLVMPattern;
+struct ConstantOpLowering : public ConvertOpToLLVMPattern<func::ConstantOp> {
+ using ConvertOpToLLVMPattern<func::ConstantOp>::ConvertOpToLLVMPattern;
LogicalResult
- matchAndRewrite(ConstantOp op, OpAdaptor adaptor,
+ matchAndRewrite(func::ConstantOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
auto type = typeConverter->convertType(op.getResult().getType());
if (!type || !LLVM::isCompatibleType(type))
@@ -474,11 +474,12 @@
}
};
-struct CallOpLowering : public CallOpInterfaceLowering<CallOp> {
+struct CallOpLowering : public CallOpInterfaceLowering<func::CallOp> {
using Super::Super;
};
-struct CallIndirectOpLowering : public CallOpInterfaceLowering<CallIndirectOp> {
+struct CallIndirectOpLowering
+ : public CallOpInterfaceLowering<func::CallIndirectOp> {
using Super::Super;
};
@@ -515,11 +516,11 @@
// can only return 0 or 1 value, we pack multiple values into a structure type.
// Emit `UndefOp` followed by `InsertValueOp`s to create such structure if
// necessary before returning it
-struct ReturnOpLowering : public ConvertOpToLLVMPattern<ReturnOp> {
- using ConvertOpToLLVMPattern<ReturnOp>::ConvertOpToLLVMPattern;
+struct ReturnOpLowering : public ConvertOpToLLVMPattern<func::ReturnOp> {
+ using ConvertOpToLLVMPattern<func::ReturnOp>::ConvertOpToLLVMPattern;
LogicalResult
- matchAndRewrite(ReturnOp op, OpAdaptor adaptor,
+ matchAndRewrite(func::ReturnOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
Location loc = op.getLoc();
unsigned numArguments = op.getNumOperands();
diff --git a/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt b/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
index 979780a..3589e98 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
+++ b/mlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
@@ -12,6 +12,7 @@
LINK_LIBS PUBLIC
MLIRArithmeticToSPIRV
MLIRControlFlowToSPIRV
+ MLIRFunc
MLIRIR
MLIRMathToSPIRV
MLIRMemRef
@@ -20,6 +21,5 @@
MLIRSPIRVConversion
MLIRSupport
MLIRTransformUtils
- MLIRStandard
MLIRTensor
)
diff --git a/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
index 36d39c8..e72863c 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
+++ b/mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
@@ -11,11 +11,11 @@
//===----------------------------------------------------------------------===//
#include "../SPIRVCommon/Pattern.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/Support/LogicalResult.h"
@@ -36,13 +36,13 @@
namespace {
-/// Converts std.return to spv.Return.
-class ReturnOpPattern final : public OpConversionPattern<ReturnOp> {
+/// Converts func.return to spv.Return.
+class ReturnOpPattern final : public OpConversionPattern<func::ReturnOp> {
public:
- using OpConversionPattern<ReturnOp>::OpConversionPattern;
+ using OpConversionPattern<func::ReturnOp>::OpConversionPattern;
LogicalResult
- matchAndRewrite(ReturnOp returnOp, OpAdaptor adaptor,
+ matchAndRewrite(func::ReturnOp returnOp, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override;
};
@@ -114,7 +114,7 @@
//===----------------------------------------------------------------------===//
LogicalResult
-ReturnOpPattern::matchAndRewrite(ReturnOp returnOp, OpAdaptor adaptor,
+ReturnOpPattern::matchAndRewrite(func::ReturnOp returnOp, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const {
if (returnOp.getNumOperands() > 1)
return failure();
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
index dad77e6..c7cef41 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
@@ -12,10 +12,10 @@
#include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/Utils/Utils.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
index a7fe498..a3fd8b5 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
@@ -12,10 +12,10 @@
#include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/Utils/Utils.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp
index ccf6424..391b4ba 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp
@@ -13,10 +13,10 @@
#include "../PassDetail.h"
#include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
@@ -34,14 +34,14 @@
public:
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<arith::ArithmeticDialect, linalg::LinalgDialect,
- math::MathDialect, StandardOpsDialect,
- tensor::TensorDialect, scf::SCFDialect>();
+ math::MathDialect, func::FuncDialect, tensor::TensorDialect,
+ scf::SCFDialect>();
}
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
ConversionTarget target(getContext());
- target.addLegalDialect<linalg::LinalgDialect, StandardOpsDialect,
+ target.addLegalDialect<linalg::LinalgDialect, func::FuncDialect,
tosa::TosaDialect, tensor::TensorDialect,
scf::SCFDialect>();
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
index 583ea05..e8ceac2 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
@@ -13,10 +13,10 @@
#include "../PassDetail.h"
#include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
@@ -35,14 +35,14 @@
public:
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<arith::ArithmeticDialect, linalg::LinalgDialect,
- math::MathDialect, StandardOpsDialect,
- tensor::TensorDialect, scf::SCFDialect>();
+ math::MathDialect, func::FuncDialect, tensor::TensorDialect,
+ scf::SCFDialect>();
}
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
ConversionTarget target(getContext());
- target.addLegalDialect<linalg::LinalgDialect, StandardOpsDialect,
+ target.addLegalDialect<linalg::LinalgDialect, func::FuncDialect,
tensor::TensorDialect, scf::SCFDialect>();
target.addIllegalDialect<tosa::TosaDialect>();
diff --git a/mlir/lib/Conversion/TosaToSCF/CMakeLists.txt b/mlir/lib/Conversion/TosaToSCF/CMakeLists.txt
index 189c25c..62d3e86 100644
--- a/mlir/lib/Conversion/TosaToSCF/CMakeLists.txt
+++ b/mlir/lib/Conversion/TosaToSCF/CMakeLists.txt
@@ -11,8 +11,8 @@
LINK_LIBS PUBLIC
MLIRIR
+ MLIRFunc
MLIRSCF
- MLIRStandard
MLIRPass
MLIRTensor
MLIRTosa
diff --git a/mlir/lib/Conversion/TosaToStandard/CMakeLists.txt b/mlir/lib/Conversion/TosaToStandard/CMakeLists.txt
index e57ab20..4946be6 100644
--- a/mlir/lib/Conversion/TosaToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/TosaToStandard/CMakeLists.txt
@@ -11,8 +11,8 @@
LINK_LIBS PUBLIC
MLIRArithmetic
+ MLIRFunc
MLIRIR
- MLIRStandard
MLIRPass
MLIRTosa
MLIRTosaTransforms
diff --git a/mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp b/mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp
index 6e1c4e9..0dec3ff 100644
--- a/mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp
+++ b/mlir/lib/Conversion/TosaToStandard/TosaToStandard.cpp
@@ -12,7 +12,7 @@
#include "mlir/Conversion/TosaToStandard/TosaToStandard.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/IR/PatternMatch.h"
@@ -69,7 +69,7 @@
return rewriter.getIntegerAttr(type, value);
}
-// This converts the TOSA ApplyScale operator to a set of StandardOps ops,
+// This converts the TOSA ApplyScale operator to a set of arithmetic ops,
// using 64-bit operations to perform the necessary multiply, bias, and shift.
// Multiple types are used to use minimal bit width operations.
class ApplyScaleOpConverter : public OpRewritePattern<tosa::ApplyScaleOp> {
diff --git a/mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp b/mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
index 072df36..fb1e9f3 100644
--- a/mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
+++ b/mlir/lib/Conversion/TosaToStandard/TosaToStandardPass.cpp
@@ -13,7 +13,7 @@
#include "../PassDetail.h"
#include "mlir/Conversion/TosaToStandard/TosaToStandard.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
@@ -36,7 +36,7 @@
target.addIllegalOp<tosa::SliceOp>();
target.addIllegalOp<tosa::ApplyScaleOp>();
target.addLegalDialect<arith::ArithmeticDialect>();
- target.addLegalDialect<StandardOpsDialect>();
+ target.addLegalDialect<func::FuncDialect>();
target.addLegalDialect<tensor::TensorDialect>();
mlir::tosa::populateTosaToStandardConversionPatterns(&patterns);
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index 2487dd9..99bb415 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -10,10 +10,10 @@
#include "mlir/Conversion/LLVMCommon/VectorPattern.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/FunctionCallUtils.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Support/MathExtras.h"
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
index 0045266..cc45813 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
@@ -18,9 +18,9 @@
#include "mlir/Dialect/ArmNeon/ArmNeonDialect.h"
#include "mlir/Dialect/ArmSVE/ArmSVEDialect.h"
#include "mlir/Dialect/ArmSVE/Transforms.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h"
#include "mlir/Dialect/X86Vector/Transforms.h"
#include "mlir/Dialect/X86Vector/X86VectorDialect.h"
@@ -88,7 +88,7 @@
LLVMConversionTarget target(getContext());
target.addLegalDialect<arith::ArithmeticDialect>();
target.addLegalDialect<memref::MemRefDialect>();
- target.addLegalDialect<StandardOpsDialect>();
+ target.addLegalDialect<func::FuncDialect>();
target.addLegalOp<UnrealizedConversionCastOp>();
if (armNeon) {
// TODO: we may or may not want to include in-dialect lowering to
diff --git a/mlir/lib/Conversion/VectorToROCDL/VectorToROCDL.cpp b/mlir/lib/Conversion/VectorToROCDL/VectorToROCDL.cpp
index 34d268b..70203f9 100644
--- a/mlir/lib/Conversion/VectorToROCDL/VectorToROCDL.cpp
+++ b/mlir/lib/Conversion/VectorToROCDL/VectorToROCDL.cpp
@@ -18,10 +18,10 @@
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
diff --git a/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp b/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp
index 5e60bed..9ce623b 100644
--- a/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp
+++ b/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp
@@ -11,8 +11,8 @@
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/AMX/AMXDialect.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/PatternMatch.h"
diff --git a/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
index e1c4899..8609aa2 100644
--- a/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
@@ -18,7 +18,7 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/IntegerSet.h"
diff --git a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
index 30f95dd..b46d91f 100644
--- a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
@@ -17,7 +17,7 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/Support/LLVM.h"
diff --git a/mlir/lib/Dialect/Affine/Analysis/NestedMatcher.cpp b/mlir/lib/Dialect/Affine/Analysis/NestedMatcher.cpp
index c38cdb7..90a9e9d 100644
--- a/mlir/lib/Dialect/Affine/Analysis/NestedMatcher.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/NestedMatcher.cpp
@@ -10,7 +10,7 @@
#include "mlir/Dialect/Affine/Analysis/NestedMatcher.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
diff --git a/mlir/lib/Dialect/Affine/Analysis/Utils.cpp b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
index 0eb5289..e9eb3d5 100644
--- a/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
@@ -18,7 +18,7 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/IntegerSet.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Debug.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
index 587a0d2..1b32935 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
@@ -25,8 +25,8 @@
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/Support/CommandLine.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
index bd33152..c480746 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
@@ -82,7 +82,7 @@
} else if (isa<AffineDmaStartOp, AffineDmaWaitOp>(op)) {
// TODO: Support DMA ops.
return false;
- } else if (!isa<arith::ConstantOp, ConstantOp>(op)) {
+ } else if (!isa<arith::ConstantOp, func::ConstantOp>(op)) {
// Register op in the set of ops that have users.
opsWithUsers.insert(&op);
if (isa<AffineMapAccessInterface>(op)) {
diff --git a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
index f4536a8..6faf612 100644
--- a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
@@ -26,12 +26,12 @@
MLIRAffineAnalysis
MLIRAffineUtils
MLIRArithmetic
+ MLIRFunc
MLIRIR
MLIRMemRef
MLIRPass
MLIRSCFUtils
MLIRSideEffectInterfaces
- MLIRStandard
MLIRTransformUtils
MLIRVector
MLIRVectorUtils
diff --git a/mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp b/mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
index 42ab362..478ca9f 100644
--- a/mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
+++ b/mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
@@ -9,7 +9,7 @@
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -197,7 +197,7 @@
arith::populateArithmeticExpandOpsPatterns(patterns);
- target.addLegalDialect<arith::ArithmeticDialect, StandardOpsDialect>();
+ target.addLegalDialect<arith::ArithmeticDialect, func::FuncDialect>();
// clang-format off
target.addIllegalOp<
arith::CeilDivSIOp,
diff --git a/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h b/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h
index 0947804..8db4f12 100644
--- a/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h
+++ b/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h
@@ -13,12 +13,14 @@
namespace mlir {
-class StandardOpsDialect;
-
namespace bufferization {
class BufferizationDialect;
} // namespace bufferization
+namespace func {
+class FuncDialect;
+} // namespace func
+
namespace memref {
class MemRefDialect;
} // namespace memref
diff --git a/mlir/lib/Dialect/ArmSVE/Transforms/CMakeLists.txt b/mlir/lib/Dialect/ArmSVE/Transforms/CMakeLists.txt
index 80f6e30..7871cb0 100644
--- a/mlir/lib/Dialect/ArmSVE/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/ArmSVE/Transforms/CMakeLists.txt
@@ -6,8 +6,8 @@
LINK_LIBS PUBLIC
MLIRArmSVE
+ MLIRFunc
MLIRIR
MLIRLLVMCommonConversion
MLIRLLVMIR
- MLIRStandard
)
diff --git a/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp b/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp
index 0145ec3..c019b5c 100644
--- a/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp
+++ b/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp
@@ -71,9 +71,9 @@
// Populate conversion patterns
// clang-format off
- patterns.add<ForwardOperands<CallOp>,
- ForwardOperands<CallIndirectOp>,
- ForwardOperands<ReturnOp>>(converter,
+ patterns.add<ForwardOperands<func::CallOp>,
+ ForwardOperands<func::CallIndirectOp>,
+ ForwardOperands<func::ReturnOp>>(converter,
&converter.getContext());
patterns.add<SdotOpLowering,
SmmlaOpLowering,
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
index c4ba141..62ddf2f 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
@@ -17,8 +17,8 @@
#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Dialect/Async/Transforms.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/Matchers.h"
@@ -431,7 +431,7 @@
b.create<scf::ForOp>(blockFirstCoord[0], blockEndCoord[0], c1, ValueRange(),
workLoopBuilder(0));
- b.create<ReturnOp>(ValueRange());
+ b.create<func::ReturnOp>(ValueRange());
return {op.getNumLoops(), func, std::move(computeFuncType.captures)};
}
@@ -541,8 +541,8 @@
operands[1] = midIndex;
operands[2] = end;
- executeBuilder.create<CallOp>(executeLoc, func.sym_name(),
- func.getCallableResults(), operands);
+ executeBuilder.create<func::CallOp>(executeLoc, func.sym_name(),
+ func.getCallableResults(), operands);
executeBuilder.create<async::YieldOp>(executeLoc, ValueRange());
};
@@ -562,9 +562,10 @@
SmallVector<Value> computeFuncOperands = {blockStart};
computeFuncOperands.append(forwardedInputs.begin(), forwardedInputs.end());
- b.create<CallOp>(computeFunc.func.sym_name(),
- computeFunc.func.getCallableResults(), computeFuncOperands);
- b.create<ReturnOp>(ValueRange());
+ b.create<func::CallOp>(computeFunc.func.sym_name(),
+ computeFunc.func.getCallableResults(),
+ computeFuncOperands);
+ b.create<func::ReturnOp>(ValueRange());
return func;
}
@@ -608,9 +609,9 @@
SmallVector<Value> operands = {c0, blockSize};
appendBlockComputeOperands(operands);
- b.create<CallOp>(parallelComputeFunction.func.sym_name(),
- parallelComputeFunction.func.getCallableResults(),
- operands);
+ b.create<func::CallOp>(parallelComputeFunction.func.sym_name(),
+ parallelComputeFunction.func.getCallableResults(),
+ operands);
b.create<scf::YieldOp>();
};
@@ -627,8 +628,9 @@
SmallVector<Value> operands = {group, c0, blockCount, blockSize};
appendBlockComputeOperands(operands);
- b.create<CallOp>(asyncDispatchFunction.sym_name(),
- asyncDispatchFunction.getCallableResults(), operands);
+ b.create<func::CallOp>(asyncDispatchFunction.sym_name(),
+ asyncDispatchFunction.getCallableResults(),
+ operands);
// Wait for the completion of all parallel compute operations.
b.create<AwaitAllOp>(group);
@@ -685,9 +687,9 @@
// Call parallel compute function inside the async.execute region.
auto executeBodyBuilder = [&](OpBuilder &executeBuilder,
Location executeLoc, ValueRange executeArgs) {
- executeBuilder.create<CallOp>(executeLoc, compute.sym_name(),
- compute.getCallableResults(),
- computeFuncOperands(iv));
+ executeBuilder.create<func::CallOp>(executeLoc, compute.sym_name(),
+ compute.getCallableResults(),
+ computeFuncOperands(iv));
executeBuilder.create<async::YieldOp>(executeLoc, ValueRange());
};
@@ -702,8 +704,8 @@
b.create<scf::ForOp>(c1, blockCount, c1, ValueRange(), loopBuilder);
// Call parallel compute function for the first block in the caller thread.
- b.create<CallOp>(compute.sym_name(), compute.getCallableResults(),
- computeFuncOperands(c0));
+ b.create<func::CallOp>(compute.sym_name(), compute.getCallableResults(),
+ computeFuncOperands(c0));
// Wait for the completion of all async compute operations.
b.create<AwaitAllOp>(group);
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
index 3fd80ea..18c2f2e 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
@@ -16,7 +16,7 @@
#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
@@ -317,7 +317,7 @@
Location loc = value.getLoc();
for (Operation *user : value.getUsers()) {
- if (!isa<CallOp>(user))
+ if (!isa<func::CallOp>(user))
continue;
// Add a reference before the function call to pass the value at `+1`
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
index 025dab5..14fe91a 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
@@ -13,7 +13,7 @@
#include "PassDetail.h"
#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Dialect/Async/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Support/Debug.h"
@@ -139,7 +139,7 @@
break;
// Find the first function call user of the reference counted value.
- Operation *functionCall = dyn_cast<CallOp>(user);
+ Operation *functionCall = dyn_cast<func::CallOp>(user);
if (functionCall &&
(!firstFunctionCallUser ||
functionCall->isBeforeInBlock(firstFunctionCallUser))) {
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index d1d3e4f..3f0d089 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -17,8 +17,8 @@
#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/PatternMatch.h"
@@ -175,7 +175,7 @@
// This will be the return value of a coroutine ramp function.
SmallVector<Value, 4> ret{retToken};
ret.insert(ret.end(), retValues.begin(), retValues.end());
- builder.create<ReturnOp>(ret);
+ builder.create<func::ReturnOp>(ret);
// `async.await` op lowering will create resume blocks for async
// continuations, and will conditionally branch to cleanup or suspend blocks.
@@ -327,7 +327,7 @@
// Replace the original `async.execute` with a call to outlined function.
{
ImplicitLocOpBuilder callBuilder(loc, execute);
- auto callOutlinedFunc = callBuilder.create<CallOp>(
+ auto callOutlinedFunc = callBuilder.create<func::CallOp>(
func.getName(), execute.getResultTypes(), functionInputs.getArrayRef());
execute.replaceAllUsesWith(callOutlinedFunc.getResults());
execute.erase();
@@ -561,7 +561,7 @@
};
//===----------------------------------------------------------------------===//
-// Convert std.assert operation to cf.cond_br into `set_error` block.
+// Convert cf.assert operation to cf.cond_br into `set_error` block.
//===----------------------------------------------------------------------===//
class AssertOpLowering : public OpConversionPattern<cf::AssertOp> {
@@ -618,7 +618,7 @@
func.insertResult(0, TokenType::get(ctx), {});
for (Block &block : func.getBlocks()) {
Operation *terminator = block.getTerminator();
- if (auto returnOp = dyn_cast<ReturnOp>(*terminator)) {
+ if (auto returnOp = dyn_cast<func::ReturnOp>(*terminator)) {
ImplicitLocOpBuilder builder(loc, returnOp);
builder.create<YieldOp>(returnOp.getOperands());
returnOp.erase();
@@ -631,10 +631,10 @@
///
/// The invocation of this function is safe only when call ops are traversed in
/// reverse order of how they appear in a single block. See `funcsToCoroutines`.
-static void rewriteCallsiteForCoroutine(CallOp oldCall, FuncOp func) {
+static void rewriteCallsiteForCoroutine(func::CallOp oldCall, FuncOp func) {
auto loc = func.getLoc();
ImplicitLocOpBuilder callBuilder(loc, oldCall);
- auto newCall = callBuilder.create<CallOp>(
+ auto newCall = callBuilder.create<func::CallOp>(
func.getName(), func.getCallableResults(), oldCall.getArgOperands());
// Await on the async token and all the value results and unwrap the latter.
@@ -716,7 +716,7 @@
});
// Rewrite the callsites to await on results of the newly created coroutine.
for (Operation *op : users) {
- if (CallOp call = dyn_cast<mlir::CallOp>(*op)) {
+ if (func::CallOp call = dyn_cast<func::CallOp>(*op)) {
FuncOp caller = call->getParentOfType<FuncOp>();
rewriteCallsiteForCoroutine(call, func); // Careful, erases the call op.
addToWorklist(caller);
@@ -794,7 +794,7 @@
return !walkResult.wasInterrupted();
});
runtimeTarget.addLegalOp<cf::AssertOp, arith::XOrIOp, arith::ConstantOp,
- ConstantOp, cf::BranchOp, cf::CondBranchOp>();
+ func::ConstantOp, cf::BranchOp, cf::CondBranchOp>();
// Assertions must be converted to runtime errors inside async functions.
runtimeTarget.addDynamicallyLegalOp<cf::AssertOp>(
diff --git a/mlir/lib/Dialect/Async/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Async/Transforms/CMakeLists.txt
index e5f9c75..de74c61 100644
--- a/mlir/lib/Dialect/Async/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Async/Transforms/CMakeLists.txt
@@ -14,11 +14,11 @@
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRAsync
+ MLIRFunc
MLIRIR
MLIRPass
MLIRSCF
MLIRSCFToControlFlow
- MLIRStandard
MLIRTransforms
MLIRTransformUtils
)
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
index de3a2e1..e233ef7 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
@@ -8,8 +8,8 @@
#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Operation.h"
#include "mlir/Pass/Pass.h"
@@ -62,7 +62,7 @@
// out-params.
static void updateReturnOps(FuncOp func,
ArrayRef<BlockArgument> appendedEntryArgs) {
- func.walk([&](ReturnOp op) {
+ func.walk([&](func::ReturnOp op) {
SmallVector<Value, 6> copyIntoOutParams;
SmallVector<Value, 6> keepAsReturnOperands;
for (Value operand : op.getOperands()) {
@@ -75,7 +75,7 @@
for (auto t : llvm::zip(copyIntoOutParams, appendedEntryArgs))
builder.create<memref::CopyOp>(op.getLoc(), std::get<0>(t),
std::get<1>(t));
- builder.create<ReturnOp>(op.getLoc(), keepAsReturnOperands);
+ builder.create<func::ReturnOp>(op.getLoc(), keepAsReturnOperands);
op.erase();
});
}
@@ -84,7 +84,7 @@
// temporary buffers for newly introduced out params.
static LogicalResult updateCalls(ModuleOp module) {
bool didFail = false;
- module.walk([&](CallOp op) {
+ module.walk([&](func::CallOp op) {
SmallVector<Value, 6> replaceWithNewCallResults;
SmallVector<Value, 6> replaceWithOutParams;
for (OpResult result : op.getResults()) {
@@ -112,8 +112,8 @@
newOperands.append(outParams.begin(), outParams.end());
auto newResultTypes = llvm::to_vector<6>(llvm::map_range(
replaceWithNewCallResults, [](Value v) { return v.getType(); }));
- auto newCall = builder.create<CallOp>(op.getLoc(), op.getCalleeAttr(),
- newResultTypes, newOperands);
+ auto newCall = builder.create<func::CallOp>(op.getLoc(), op.getCalleeAttr(),
+ newResultTypes, newOperands);
for (auto t : llvm::zip(replaceWithNewCallResults, newCall.getResults()))
std::get<0>(t).replaceAllUsesWith(std::get<1>(t));
op.erase();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
index a10d322..24ecadb 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
@@ -13,7 +13,7 @@
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Operation.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
@@ -175,10 +175,9 @@
BufferizationOptions::OpFilterEntry::FilterFn filterFn =
[&](Operation *op) {
- // Disallow non-std dialect ops. I.e., no ops related to function
+ // Disallow non-func dialect ops. I.e., no ops related to function
// calls.
- if (op->getDialect()->getNamespace() ==
- StandardOpsDialect::getDialectNamespace())
+ if (isa<func::FuncDialect>(op->getDialect()))
return false;
// Filter may be specified via options.
if (this->dialectFilter.hasValue())
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Bufferization/Transforms/CMakeLists.txt
index 56fc326b..c722921 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Bufferization/Transforms/CMakeLists.txt
@@ -15,10 +15,10 @@
LINK_LIBS PUBLIC
MLIRBufferization
MLIRControlFlowInterfaces
+ MLIRFunc
MLIRInferTypeOpInterface
MLIRIR
MLIRMemRef
MLIRPass
- MLIRStandard
MLIRTransforms
)
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h b/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h
index 37f8811..d695f2a 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h
+++ b/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h
@@ -13,12 +13,14 @@
namespace mlir {
-class StandardOpsDialect;
-
namespace bufferization {
class BufferizationDialect;
} // namespace bufferization
+namespace func {
+class FuncDialect;
+} // namespace func
+
namespace memref {
class MemRefDialect;
} // namespace memref
diff --git a/mlir/lib/Dialect/CMakeLists.txt b/mlir/lib/Dialect/CMakeLists.txt
index 9d6a30c..766dd26 100644
--- a/mlir/lib/Dialect/CMakeLists.txt
+++ b/mlir/lib/Dialect/CMakeLists.txt
@@ -9,6 +9,7 @@
add_subdirectory(ControlFlow)
add_subdirectory(DLTI)
add_subdirectory(EmitC)
+add_subdirectory(Func)
add_subdirectory(GPU)
add_subdirectory(Linalg)
add_subdirectory(LLVMIR)
@@ -23,7 +24,6 @@
add_subdirectory(Shape)
add_subdirectory(SparseTensor)
add_subdirectory(SPIRV)
-add_subdirectory(StandardOps)
add_subdirectory(Tensor)
add_subdirectory(Tosa)
add_subdirectory(Utils)
diff --git a/mlir/include/mlir/Dialect/StandardOps/CMakeLists.txt b/mlir/lib/Dialect/Func/CMakeLists.txt
similarity index 100%
copy from mlir/include/mlir/Dialect/StandardOps/CMakeLists.txt
copy to mlir/lib/Dialect/Func/CMakeLists.txt
diff --git a/mlir/lib/Dialect/Func/IR/CMakeLists.txt b/mlir/lib/Dialect/Func/IR/CMakeLists.txt
new file mode 100644
index 0000000..0045a9a
--- /dev/null
+++ b/mlir/lib/Dialect/Func/IR/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_mlir_dialect_library(MLIRFunc
+ FuncOps.cpp
+
+ ADDITIONAL_HEADER_DIRS
+ ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Func
+
+ DEPENDS
+ MLIRFuncOpsIncGen
+
+ LINK_LIBS PUBLIC
+ MLIRCallInterfaces
+ MLIRControlFlow
+ MLIRControlFlowInterfaces
+ MLIRInferTypeOpInterface
+ MLIRIR
+ MLIRSideEffectInterfaces
+ )
diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/Func/IR/FuncOps.cpp
similarity index 86%
rename from mlir/lib/Dialect/StandardOps/IR/Ops.cpp
rename to mlir/lib/Dialect/Func/IR/FuncOps.cpp
index cc30451..b1a557b 100644
--- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
+++ b/mlir/lib/Dialect/Func/IR/FuncOps.cpp
@@ -1,4 +1,4 @@
-//===- Ops.cpp - Standard MLIR Operations ---------------------------------===//
+//===- FuncOps.cpp - Func Dialect Operations ------------------------------===//
//
// 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,9 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Dialect/CommonFolders.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
-#include "mlir/IR/AffineExpr.h"
-#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
@@ -30,33 +27,30 @@
#include "llvm/Support/raw_ostream.h"
#include <numeric>
-#include "mlir/Dialect/StandardOps/IR/OpsDialect.cpp.inc"
-
-// Pull in all enum type definitions and utility function declarations.
-#include "mlir/Dialect/StandardOps/IR/OpsEnums.cpp.inc"
+#include "mlir/Dialect/Func/IR/FuncOpsDialect.cpp.inc"
using namespace mlir;
+using namespace mlir::func;
//===----------------------------------------------------------------------===//
-// StandardOpsDialect Interfaces
+// FuncDialect Interfaces
//===----------------------------------------------------------------------===//
namespace {
-/// This class defines the interface for handling inlining with standard
-/// operations.
-struct StdInlinerInterface : public DialectInlinerInterface {
+/// This class defines the interface for handling inlining with func operations.
+struct FuncInlinerInterface : public DialectInlinerInterface {
using DialectInlinerInterface::DialectInlinerInterface;
//===--------------------------------------------------------------------===//
// Analysis Hooks
//===--------------------------------------------------------------------===//
- /// All call operations within standard ops can be inlined.
+ /// All call operations can be inlined.
bool isLegalToInline(Operation *call, Operation *callable,
bool wouldBeCloned) const final {
return true;
}
- /// All operations within standard ops can be inlined.
+ /// All operations can be inlined.
bool isLegalToInline(Operation *, Region *, bool,
BlockAndValueMapping &) const final {
return true;
@@ -69,7 +63,7 @@
/// Handle the given inlined terminator by replacing it with a new operation
/// as necessary.
void handleTerminator(Operation *op, Block *newDest) const final {
- // Only "std.return" needs to be handled here.
+ // Only return needs to be handled here.
auto returnOp = dyn_cast<ReturnOp>(op);
if (!returnOp)
return;
@@ -84,7 +78,7 @@
/// as necessary.
void handleTerminator(Operation *op,
ArrayRef<Value> valuesToRepl) const final {
- // Only "std.return" needs to be handled here.
+ // Only return needs to be handled here.
auto returnOp = cast<ReturnOp>(op);
// Replace the values directly with the return operands.
@@ -96,24 +90,21 @@
} // namespace
//===----------------------------------------------------------------------===//
-// StandardOpsDialect
+// FuncDialect
//===----------------------------------------------------------------------===//
-void StandardOpsDialect::initialize() {
+void FuncDialect::initialize() {
addOperations<
#define GET_OP_LIST
-#include "mlir/Dialect/StandardOps/IR/Ops.cpp.inc"
+#include "mlir/Dialect/Func/IR/FuncOps.cpp.inc"
>();
- addInterfaces<StdInlinerInterface>();
+ addInterfaces<FuncInlinerInterface>();
}
/// Materialize a single constant operation from a given attribute value with
/// the desired resultant type.
-Operation *StandardOpsDialect::materializeConstant(OpBuilder &builder,
- Attribute value, Type type,
- Location loc) {
- if (arith::ConstantOp::isBuildableWith(value, type))
- return builder.create<arith::ConstantOp>(loc, type, value);
+Operation *FuncDialect::materializeConstant(OpBuilder &builder, Attribute value,
+ Type type, Location loc) {
if (ConstantOp::isBuildableWith(value, type))
return builder.create<ConstantOp>(loc, type,
value.cast<FlatSymbolRefAttr>());
@@ -247,4 +238,4 @@
//===----------------------------------------------------------------------===//
#define GET_OP_CLASSES
-#include "mlir/Dialect/StandardOps/IR/Ops.cpp.inc"
+#include "mlir/Dialect/Func/IR/FuncOps.cpp.inc"
diff --git a/mlir/lib/Dialect/StandardOps/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Func/Transforms/CMakeLists.txt
similarity index 63%
rename from mlir/lib/Dialect/StandardOps/Transforms/CMakeLists.txt
rename to mlir/lib/Dialect/Func/Transforms/CMakeLists.txt
index 3ee725b..dfc429c 100644
--- a/mlir/lib/Dialect/StandardOps/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Func/Transforms/CMakeLists.txt
@@ -1,23 +1,23 @@
-add_mlir_dialect_library(MLIRStandardOpsTransforms
+add_mlir_dialect_library(MLIRFuncTransforms
DecomposeCallGraphTypes.cpp
FuncBufferize.cpp
FuncConversions.cpp
ADDITIONAL_HEADER_DIRS
- ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/StandardOps/Transforms
+ ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Func/Transforms
DEPENDS
- MLIRStandardTransformsIncGen
+ MLIRFuncTransformsIncGen
LINK_LIBS PUBLIC
MLIRAffine
MLIRArithmeticTransforms
MLIRBufferization
MLIRBufferizationTransforms
+ MLIRFunc
MLIRIR
MLIRMemRef
MLIRPass
MLIRSCF
- MLIRStandard
MLIRTransforms
)
diff --git a/mlir/lib/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.cpp b/mlir/lib/Dialect/Func/Transforms/DecomposeCallGraphTypes.cpp
similarity index 98%
rename from mlir/lib/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.cpp
rename to mlir/lib/Dialect/Func/Transforms/DecomposeCallGraphTypes.cpp
index f9d9c5c..d3df225 100644
--- a/mlir/lib/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.cpp
+++ b/mlir/lib/Dialect/Func/Transforms/DecomposeCallGraphTypes.cpp
@@ -6,11 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BuiltinOps.h"
using namespace mlir;
+using namespace mlir::func;
//===----------------------------------------------------------------------===//
// ValueDecomposer
diff --git a/mlir/lib/Dialect/StandardOps/Transforms/FuncBufferize.cpp b/mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp
similarity index 85%
rename from mlir/lib/Dialect/StandardOps/Transforms/FuncBufferize.cpp
rename to mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp
index 9351b67..15208b5 100644
--- a/mlir/lib/Dialect/StandardOps/Transforms/FuncBufferize.cpp
+++ b/mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp
@@ -1,4 +1,4 @@
-//===- Bufferize.cpp - Bufferization for std ops --------------------------===//
+//===- Bufferize.cpp - Bufferization for func 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,19 +6,20 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements bufferization of std.func's and std.call's.
+// This file implements bufferization of builtin.func's and func.call's.
//
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/Dialect/StandardOps/Transforms/FuncConversions.h"
-#include "mlir/Dialect/StandardOps/Transforms/Passes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
+#include "mlir/Dialect/Func/Transforms/Passes.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
+using namespace mlir::func;
namespace {
struct FuncBufferizePass : public FuncBufferizeBase<FuncBufferizePass> {
@@ -59,6 +60,6 @@
};
} // namespace
-std::unique_ptr<Pass> mlir::createFuncBufferizePass() {
+std::unique_ptr<Pass> mlir::func::createFuncBufferizePass() {
return std::make_unique<FuncBufferizePass>();
}
diff --git a/mlir/lib/Dialect/StandardOps/Transforms/FuncConversions.cpp b/mlir/lib/Dialect/Func/Transforms/FuncConversions.cpp
similarity index 95%
rename from mlir/lib/Dialect/StandardOps/Transforms/FuncConversions.cpp
rename to mlir/lib/Dialect/Func/Transforms/FuncConversions.cpp
index ee614fd..c1e69d0 100644
--- a/mlir/lib/Dialect/StandardOps/Transforms/FuncConversions.cpp
+++ b/mlir/lib/Dialect/Func/Transforms/FuncConversions.cpp
@@ -1,4 +1,4 @@
-//===- FuncConversions.cpp - Standard Function conversions ----------------===//
+//===- FuncConversions.cpp - Function conversions -------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,15 +6,16 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/StandardOps/Transforms/FuncConversions.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
+using namespace mlir::func;
namespace {
-/// Converts the operand and result types of the Standard's CallOp, used
-/// together with the FuncOpSignatureConversion.
+/// Converts the operand and result types of the CallOp, used together with the
+/// FuncOpSignatureConversion.
struct CallOpSignatureConversion : public OpConversionPattern<CallOp> {
using OpConversionPattern<CallOp>::OpConversionPattern;
diff --git a/mlir/lib/Dialect/StandardOps/Transforms/PassDetail.h b/mlir/lib/Dialect/Func/Transforms/PassDetail.h
similarity index 68%
rename from mlir/lib/Dialect/StandardOps/Transforms/PassDetail.h
rename to mlir/lib/Dialect/Func/Transforms/PassDetail.h
index eadd026..d6020f8 100644
--- a/mlir/lib/Dialect/StandardOps/Transforms/PassDetail.h
+++ b/mlir/lib/Dialect/Func/Transforms/PassDetail.h
@@ -1,4 +1,4 @@
-//===- PassDetail.h - GPU Pass class details --------------------*- C++ -*-===//
+//===- PassDetail.h - Func Pass class details -------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef DIALECT_STANDARD_TRANSFORMS_PASSDETAIL_H_
-#define DIALECT_STANDARD_TRANSFORMS_PASSDETAIL_H_
+#ifndef DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Pass/Pass.h"
@@ -25,8 +25,8 @@
} // namespace memref
#define GEN_PASS_CLASSES
-#include "mlir/Dialect/StandardOps/Transforms/Passes.h.inc"
+#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
} // namespace mlir
-#endif // DIALECT_STANDARD_TRANSFORMS_PASSDETAIL_H_
+#endif // DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index b08468c..a2e706c 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -69,6 +69,7 @@
MLIRArithmetic
MLIRAsync
MLIRDataLayoutInterfaces
+ MLIRFunc
MLIRGPUOps
MLIRIR
MLIRLLVMIR
@@ -76,7 +77,6 @@
MLIRMemRef
MLIRPass
MLIRSCF
- MLIRStandard
MLIRSupport
MLIRTransformUtils
)
diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index 3b0f514..5278ad9 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -14,11 +14,11 @@
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/DLTI/DLTI.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/GPU/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/SymbolTable.h"
@@ -60,8 +60,8 @@
/// operations may not have side-effects, as otherwise sinking (and hence
/// duplicating them) is not legal.
static bool isLikelyAnIndexComputation(Operation *op) {
- return isa<arith::ConstantOp, ConstantOp, memref::DimOp, arith::SelectOp,
- arith::CmpIOp>(op);
+ return isa<arith::ConstantOp, func::ConstantOp, memref::DimOp,
+ arith::SelectOp, arith::CmpIOp>(op);
}
/// For a given operation `op`, computes whether it is beneficial to sink the
diff --git a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
index 6e62e4a..2fccf2d 100644
--- a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
@@ -7,8 +7,8 @@
LINK_LIBS PUBLIC
MLIRAffineAnalysis
MLIRAnalysis
+ MLIRFunc
MLIRIR
MLIRLinalg
MLIRMemRef
- MLIRStandard
)
diff --git a/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp b/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
index ee5c6da..46d4f67 100644
--- a/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
+++ b/mlir/lib/Dialect/Linalg/Analysis/DependenceAnalysis.cpp
@@ -12,8 +12,8 @@
#include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "llvm/Support/CommandLine.h"
diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/CMakeLists.txt b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/CMakeLists.txt
index 74104ec..066204d 100644
--- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/CMakeLists.txt
@@ -17,8 +17,8 @@
LINK_LIBS PUBLIC
MLIRBufferization
MLIRBufferizationTransforms
+ MLIRFunc
+ MLIRFuncTransforms
MLIRIR
MLIRMemRef
- MLIRStandard
- MLIRStandardOpsTransforms
)
diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp
index 4abfec9..5daa764 100644
--- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp
+++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp
@@ -76,8 +76,8 @@
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Operation.h"
using namespace mlir;
@@ -122,7 +122,7 @@
getModuleBufferizationState(const BufferizationState &state) {
Optional<const ModuleBufferizationState *> maybeState =
state.getDialectState<ModuleBufferizationState>(
- StandardOpsDialect::getDialectNamespace());
+ func::FuncDialect::getDialectNamespace());
assert(maybeState.hasValue() && "ModuleBufferizationState does not exist");
return **maybeState;
}
@@ -131,7 +131,7 @@
static ModuleBufferizationState &
getModuleBufferizationState(BufferizationState &state) {
return state.getOrCreateDialectState<ModuleBufferizationState>(
- StandardOpsDialect::getDialectNamespace());
+ func::FuncDialect::getDialectNamespace());
}
/// Return the state (phase) of analysis of the FuncOp.
@@ -147,10 +147,10 @@
/// Return the unique ReturnOp that terminates `funcOp`.
/// Return nullptr if there is no such unique ReturnOp.
-static ReturnOp getAssumedUniqueReturnOp(FuncOp funcOp) {
- ReturnOp returnOp;
+static func::ReturnOp getAssumedUniqueReturnOp(FuncOp funcOp) {
+ func::ReturnOp returnOp;
for (Block &b : funcOp.body()) {
- if (auto candidateOp = dyn_cast<ReturnOp>(b.getTerminator())) {
+ if (auto candidateOp = dyn_cast<func::ReturnOp>(b.getTerminator())) {
if (returnOp)
return nullptr;
returnOp = candidateOp;
@@ -192,7 +192,7 @@
// Support only single return-terminated block in the function.
auto funcOp = cast<FuncOp>(op);
- ReturnOp returnOp = getAssumedUniqueReturnOp(funcOp);
+ func::ReturnOp returnOp = getAssumedUniqueReturnOp(funcOp);
assert(returnOp && "expected func with single return op");
for (OpOperand &returnVal : returnOp->getOpOperands())
@@ -350,7 +350,7 @@
static void equivalenceAnalysis(FuncOp funcOp,
BufferizationAliasInfo &aliasInfo,
ModuleBufferizationState &moduleState) {
- funcOp->walk([&](CallOp callOp) {
+ funcOp->walk([&](func::CallOp callOp) {
FuncOp calledFunction = getCalledFunction(callOp);
assert(calledFunction && "could not retrieved called FuncOp");
@@ -424,7 +424,7 @@
}
// Support only single return-terminated block in the function.
- ReturnOp returnOp = getAssumedUniqueReturnOp(funcOp);
+ func::ReturnOp returnOp = getAssumedUniqueReturnOp(funcOp);
assert(returnOp && "expected func with single return op");
// 1. For each FuncOp result, keep track of which inplace argument it reuses.
@@ -454,7 +454,7 @@
funcOp.getContext(), funcOp.getType().getInputs(), retValues.getTypes(),
state.getOptions());
OpBuilder b(returnOp);
- b.create<ReturnOp>(returnOp.getLoc(), returnValues);
+ b.create<func::ReturnOp>(returnOp.getLoc(), returnValues);
returnOp->erase();
// 3. Rewrite the bbArgs.
@@ -528,7 +528,7 @@
DenseMap<FuncOp, unsigned> numberCallOpsContainedInFuncOp;
WalkResult res = moduleOp.walk([&](FuncOp funcOp) -> WalkResult {
if (!funcOp.body().empty()) {
- ReturnOp returnOp = getAssumedUniqueReturnOp(funcOp);
+ func::ReturnOp returnOp = getAssumedUniqueReturnOp(funcOp);
if (!returnOp)
return funcOp->emitError()
<< "cannot bufferize a FuncOp with tensors and "
@@ -538,7 +538,7 @@
numberCallOpsContainedInFuncOp[funcOp] = 0;
return funcOp.walk([&](CallOpInterface callOp) -> WalkResult {
// Only support CallOp for now.
- if (!isa<CallOp>(callOp.getOperation()))
+ if (!isa<func::CallOp>(callOp.getOperation()))
return callOp->emitError() << "expected a CallOp";
FuncOp calledFunction = getCalledFunction(callOp);
assert(calledFunction && "could not retrieved called FuncOp");
@@ -690,10 +690,11 @@
}
struct CallOpInterface
- : public BufferizableOpInterface::ExternalModel<CallOpInterface, CallOp> {
+ : public BufferizableOpInterface::ExternalModel<CallOpInterface,
+ func::CallOp> {
bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand,
const BufferizationState &state) const {
- CallOp callOp = cast<CallOp>(op);
+ func::CallOp callOp = cast<func::CallOp>(op);
FuncOp funcOp = getCalledFunction(callOp);
assert(funcOp && "expected CallOp to a FuncOp");
@@ -709,7 +710,7 @@
bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand,
const BufferizationState &state) const {
- CallOp callOp = cast<CallOp>(op);
+ func::CallOp callOp = cast<func::CallOp>(op);
FuncOp funcOp = getCalledFunction(callOp);
assert(funcOp && "expected CallOp to a FuncOp");
@@ -726,7 +727,7 @@
SmallVector<OpResult>
getAliasingOpResult(Operation *op, OpOperand &opOperand,
const BufferizationState &state) const {
- CallOp callOp = cast<CallOp>(op);
+ func::CallOp callOp = cast<func::CallOp>(op);
FuncOp funcOp = getCalledFunction(callOp);
assert(funcOp && "expected CallOp to a FuncOp");
const ModuleBufferizationState &moduleState =
@@ -746,7 +747,7 @@
SmallVector<OpOperand *>
getAliasingOpOperand(Operation *op, OpResult opResult,
const BufferizationState &state) const {
- CallOp callOp = cast<CallOp>(op);
+ func::CallOp callOp = cast<func::CallOp>(op);
FuncOp funcOp = getCalledFunction(callOp);
assert(funcOp && "expected CallOp to a FuncOp");
const ModuleBufferizationState &moduleState =
@@ -774,12 +775,11 @@
/// bufferization to allow FuncOp that are inplaceable to write inPlace.
LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
const BufferizationState &state) const {
- CallOp callOp = cast<CallOp>(op);
+ func::CallOp callOp = cast<func::CallOp>(op);
unsigned numResults = callOp.getNumResults();
unsigned numOperands = callOp->getNumOperands();
FuncOp funcOp = getCalledFunction(callOp);
- assert(isa<CallOp>(callOp.getOperation()) && funcOp &&
- "expected CallOp to a FuncOp");
+ assert(funcOp && "expected CallOp to a FuncOp");
const ModuleBufferizationState &moduleState =
getModuleBufferizationState(state);
@@ -885,7 +885,7 @@
}
// 4. Create the new CallOp.
- Operation *newCallOp = rewriter.create<CallOp>(
+ Operation *newCallOp = rewriter.create<func::CallOp>(
callOp.getLoc(), funcOp.sym_name(), resultTypes, newOperands);
newCallOp->setAttrs(callOp->getAttrs());
// Get replacement values for non-tensor / non-equivalent results.
@@ -904,7 +904,7 @@
struct ReturnOpInterface
: public BufferizableOpInterface::ExternalModel<ReturnOpInterface,
- ReturnOp> {
+ func::ReturnOp> {
bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand,
const BufferizationState &state) const {
return true;
@@ -924,7 +924,7 @@
LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
const BufferizationState &state) const {
#ifndef NDEBUG
- auto returnOp = cast<ReturnOp>(op);
+ auto returnOp = cast<func::ReturnOp>(op);
assert(isa<FuncOp>(returnOp->getParentOp()) &&
"only support FuncOp parent for ReturnOp");
#endif // NDEBUG
@@ -967,8 +967,8 @@
void mlir::linalg::comprehensive_bufferize::std_ext::
registerModuleBufferizationExternalModels(DialectRegistry ®istry) {
- registry.addOpInterface<CallOp, std_ext::CallOpInterface>();
- registry.addOpInterface<ReturnOp, std_ext::ReturnOpInterface>();
+ registry.addOpInterface<func::CallOp, std_ext::CallOpInterface>();
+ registry.addOpInterface<func::ReturnOp, std_ext::ReturnOpInterface>();
registry.addOpInterface<FuncOp, std_ext::FuncOpInterface>();
}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
index 42bb8dc..31d3f8b 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
@@ -12,12 +12,12 @@
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
+#include "mlir/Dialect/Func/Transforms/Passes.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/Math/IR/Math.h"
-#include "mlir/Dialect/StandardOps/Transforms/Passes.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/BuiltinDialect.h"
@@ -178,9 +178,9 @@
ConversionTarget target(context);
bufferization::BufferizeTypeConverter typeConverter;
- // Mark all Standard operations legal.
+ // Mark certain operations legal.
target.addLegalDialect<arith::ArithmeticDialect, AffineDialect,
- memref::MemRefDialect, StandardOpsDialect,
+ func::FuncDialect, memref::MemRefDialect,
tensor::TensorDialect>();
target.addIllegalOp<InitTensorOp>();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
index a688eb5..f1fbbf3 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
@@ -39,6 +39,8 @@
MLIRArithmeticTransforms
MLIRBufferization
MLIRComplex
+ MLIRFunc
+ MLIRFuncTransforms
MLIRInferTypeOpInterface
MLIRIR
MLIRMemRef
@@ -51,8 +53,6 @@
MLIRSCFUtils
MLIRPass
MLIRSparseTensor
- MLIRStandard
- MLIRStandardOpsTransforms
MLIRStandardToLLVM
MLIRTensor
MLIRTensorTilingInterfaceImpl
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferizePass.cpp b/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferizePass.cpp
index d7869b4..449a7eb 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferizePass.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferizePass.cpp
@@ -49,7 +49,7 @@
.insert<bufferization::BufferizationDialect, linalg::LinalgDialect,
memref::MemRefDialect, tensor::TensorDialect,
vector::VectorDialect, scf::SCFDialect,
- arith::ArithmeticDialect, StandardOpsDialect, AffineDialect>();
+ arith::ArithmeticDialect, func::FuncDialect, AffineDialect>();
affine_ext::registerBufferizableOpInterfaceExternalModels(registry);
arith::registerBufferizableOpInterfaceExternalModels(registry);
linalg::registerBufferizableOpInterfaceExternalModels(registry);
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
index afe82ff..9a87871 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
@@ -8,9 +8,9 @@
#include "PassDetail.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
+#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Passes.h"
-#include "mlir/Dialect/StandardOps/Transforms/FuncConversions.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/Transforms/DialectConversion.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
index 68fdd91..c7ff94c 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
@@ -10,10 +10,10 @@
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
diff --git a/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp b/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
index da45a6c..f2a5937 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
@@ -12,11 +12,11 @@
#include "mlir/Dialect/Linalg/Transforms/HoistPadding.h"
#include "mlir/Analysis/SliceAnalysis.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
@@ -368,7 +368,7 @@
}
static bool isDefinedOutsideOrConstant(scf::ForOp outer, Value v) {
- return outer.isDefinedOutsideOfLoop(v) || v.getDefiningOp<ConstantOp>();
+ return outer.isDefinedOutsideOfLoop(v) || v.getDefiningOp<func::ConstantOp>();
}
/// Return the current iteration number in the loop (iv - lb).ceilDiv(step).
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
index 8650d57..4e3c7c8 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
@@ -15,11 +15,11 @@
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
index 0d8632d..c9d337b 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
@@ -365,7 +365,7 @@
// 2. Constant ops don't get vectorized but rather broadcasted at their users.
// Clone so that the constant is not confined to the linalgOp block .
- if (isa<arith::ConstantOp, ConstantOp>(op))
+ if (isa<arith::ConstantOp, func::ConstantOp>(op))
return VectorizationResult{VectorizationStatus::NewOp, b.clone(*op)};
// 3. Only ElementwiseMappable are allowed in the generic vectorization.
@@ -428,8 +428,8 @@
if (!llvm::hasSingleElement(r))
return false;
for (Operation &op : r.front()) {
- if (!(isa<arith::ConstantOp, ConstantOp, linalg::YieldOp, linalg::IndexOp>(
- op) ||
+ if (!(isa<arith::ConstantOp, func::ConstantOp, linalg::YieldOp,
+ linalg::IndexOp>(op) ||
OpTrait::hasElementwiseMappableTraits(&op)) ||
llvm::any_of(op.getResultTypes(),
[](Type type) { return !type.isIntOrIndexOrFloat(); }))
diff --git a/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
index dacabad..510ddef 100644
--- a/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
@@ -9,11 +9,11 @@
MLIRAffineAnalysis
MLIRAffineUtils
MLIRArithmetic
+ MLIRFunc
MLIRIR
MLIRLinalg
MLIRSCF
MLIRPass
- MLIRStandard
MLIRTensorUtils
MLIRTransformUtils
)
diff --git a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
index 3dfb336..3a54d66 100644
--- a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
@@ -19,10 +19,10 @@
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/Utils/Utils.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
diff --git a/mlir/lib/Dialect/Math/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Math/Transforms/CMakeLists.txt
index 96bb17e..2fb4c5e 100644
--- a/mlir/lib/Dialect/Math/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Math/Transforms/CMakeLists.txt
@@ -9,10 +9,10 @@
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRDialectUtils
+ MLIRFunc
MLIRIR
MLIRMath
MLIRPass
- MLIRStandard
MLIRTransforms
MLIRX86Vector
MLIRVector
diff --git a/mlir/lib/Dialect/Math/Transforms/ExpandTanh.cpp b/mlir/lib/Dialect/Math/Transforms/ExpandTanh.cpp
index 9416ac5..7b6f969 100644
--- a/mlir/lib/Dialect/Math/Transforms/ExpandTanh.cpp
+++ b/mlir/lib/Dialect/Math/Transforms/ExpandTanh.cpp
@@ -11,9 +11,9 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/Math/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Builders.h"
#include "mlir/Transforms/DialectConversion.h"
diff --git a/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt b/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
index d27f02e..ceaede2 100644
--- a/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
@@ -6,7 +6,6 @@
${PROJECT_SOURCE_DIR}/inlude/mlir/Dialect/MemRefDialect
DEPENDS
- MLIRStandardOpsIncGen
MLIRMemRefOpsIncGen
LINK_COMPONENTS
diff --git a/mlir/lib/Dialect/MemRef/Transforms/CMakeLists.txt b/mlir/lib/Dialect/MemRef/Transforms/CMakeLists.txt
index 834346d..79789f6 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/MemRef/Transforms/CMakeLists.txt
@@ -16,11 +16,11 @@
MLIRAffine
MLIRAffineUtils
MLIRArithmetic
+ MLIRFunc
MLIRInferTypeOpInterface
MLIRLoopLikeInterface
MLIRMemRef
MLIRPass
- MLIRStandard
MLIRTensor
MLIRTransforms
MLIRVector
diff --git a/mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp b/mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
index ca490a2..7c969d3 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
@@ -16,9 +16,9 @@
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -129,7 +129,7 @@
ConversionTarget target(ctx);
target.addLegalDialect<arith::ArithmeticDialect, memref::MemRefDialect,
- StandardOpsDialect>();
+ func::FuncDialect>();
target.addDynamicallyLegalOp<memref::AtomicRMWOp>(
[](memref::AtomicRMWOp op) {
return op.kind() != arith::AtomicRMWKind::maxf &&
diff --git a/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp b/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
index 8993611..3ac9038 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
@@ -125,7 +125,7 @@
}
// Functions called by this function.
- funcOp.walk([&](CallOp callOp) {
+ funcOp.walk([&](func::CallOp callOp) {
StringAttr callee = callOp.getCalleeAttr().getAttr();
for (FuncOp &funcOp : normalizableFuncs) {
// We compare FuncOp and callee's name.
@@ -161,7 +161,7 @@
return false;
if (funcOp
- .walk([&](CallOp callOp) -> WalkResult {
+ .walk([&](func::CallOp callOp) -> WalkResult {
for (unsigned resIndex :
llvm::seq<unsigned>(0, callOp.getNumResults())) {
Value oldMemRef = callOp.getResult(resIndex);
@@ -206,7 +206,7 @@
// Traverse ReturnOps to check if an update to the return type in the
// function signature is required.
- funcOp.walk([&](ReturnOp returnOp) {
+ funcOp.walk([&](func::ReturnOp returnOp) {
for (const auto &operandEn : llvm::enumerate(returnOp.getOperands())) {
Type opType = operandEn.value().getType();
MemRefType memrefType = opType.dyn_cast<MemRefType>();
@@ -249,12 +249,12 @@
// that the non-CallOp has no memrefs to be replaced.
// TODO: Handle cases where a non-CallOp symbol use of a function deals with
// memrefs.
- auto callOp = dyn_cast<CallOp>(userOp);
+ auto callOp = dyn_cast<func::CallOp>(userOp);
if (!callOp)
continue;
Operation *newCallOp =
- builder.create<CallOp>(userOp->getLoc(), callOp.getCalleeAttr(),
- resultTypes, userOp->getOperands());
+ builder.create<func::CallOp>(userOp->getLoc(), callOp.getCalleeAttr(),
+ resultTypes, userOp->getOperands());
bool replacingMemRefUsesFailed = false;
bool returnTypeChanged = false;
for (unsigned resIndex : llvm::seq<unsigned>(0, userOp->getNumResults())) {
@@ -391,7 +391,8 @@
// `updateFunctionSignature()`.
funcOp.walk([&](Operation *op) {
if (op->hasTrait<OpTrait::MemRefsNormalizable>() &&
- op->getNumResults() > 0 && !isa<CallOp>(op) && !funcOp.isExternal()) {
+ op->getNumResults() > 0 && !isa<func::CallOp>(op) &&
+ !funcOp.isExternal()) {
// Create newOp containing normalized memref in the operation result.
Operation *newOp = createOpResultsNormalized(funcOp, op);
// When all of the operation results have no memrefs or memrefs without
diff --git a/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h b/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h
index d1e5baa..318469f 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h
+++ b/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h
@@ -14,7 +14,6 @@
namespace mlir {
class AffineDialect;
-class StandardOpsDialect;
// Forward declaration from Dialect.h
template <typename ConcreteDialect>
@@ -24,6 +23,10 @@
class ArithmeticDialect;
} // namespace arith
+namespace func {
+class FuncDialect;
+} // namespace func
+
namespace memref {
class MemRefDialect;
} // namespace memref
diff --git a/mlir/lib/Dialect/SCF/CMakeLists.txt b/mlir/lib/Dialect/SCF/CMakeLists.txt
index 4288c0c..595e8f79 100644
--- a/mlir/lib/Dialect/SCF/CMakeLists.txt
+++ b/mlir/lib/Dialect/SCF/CMakeLists.txt
@@ -10,10 +10,10 @@
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRBufferization
+ MLIRFunc
MLIRIR
MLIRLoopLikeInterface
MLIRSideEffectInterfaces
- MLIRStandard
)
add_subdirectory(Transforms)
diff --git a/mlir/lib/Dialect/SCF/SCF.cpp b/mlir/lib/Dialect/SCF/SCF.cpp
index f35d748..ab00578 100644
--- a/mlir/lib/Dialect/SCF/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/SCF.cpp
@@ -10,7 +10,7 @@
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
diff --git a/mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp b/mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
index b31593b..d680303 100644
--- a/mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
@@ -9,11 +9,11 @@
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
diff --git a/mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt b/mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt
index 4858954..df087e57 100644
--- a/mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt
@@ -24,12 +24,12 @@
MLIRBufferization
MLIRBufferizationTransforms
MLIRDialectUtils
+ MLIRFunc
MLIRIR
MLIRMemRef
MLIRPass
MLIRSCF
MLIRSCFUtils
- MLIRStandard
MLIRSupport
MLIRTensor
MLIRTransforms
diff --git a/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp b/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp
index faf0da1..aab11e7 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp
@@ -12,10 +12,10 @@
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
index 493a1b8..4c2df93 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
@@ -12,10 +12,10 @@
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Support/MathExtras.h"
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp
index 34e79c7..5e1dbf1 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp
@@ -12,11 +12,11 @@
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
using namespace mlir;
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
index 503c9b0..106100a 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
@@ -15,11 +15,11 @@
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
#include "mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/BlockAndValueMapping.h"
diff --git a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
index f4f8751..5435186 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
@@ -11,11 +11,11 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/OpDefinition.h"
diff --git a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
index 8e35efa..5cee4ac 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
@@ -13,11 +13,11 @@
#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
using namespace mlir;
using namespace mlir::scf;
diff --git a/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp b/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
index 3a963c7..50bc4f5 100644
--- a/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
@@ -7,10 +7,10 @@
//===----------------------------------------------------------------------===//
#include "PassDetail.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
diff --git a/mlir/lib/Dialect/SCF/Utils/CMakeLists.txt b/mlir/lib/Dialect/SCF/Utils/CMakeLists.txt
index bad518f..6ad4606 100644
--- a/mlir/lib/Dialect/SCF/Utils/CMakeLists.txt
+++ b/mlir/lib/Dialect/SCF/Utils/CMakeLists.txt
@@ -11,9 +11,9 @@
MLIRAnalysis
MLIRArithmetic
MLIRDialectUtils
+ MLIRFunc
MLIRIR
MLIRSCF
- MLIRStandard
MLIRSupport
MLIRTransforms
)
diff --git a/mlir/lib/Dialect/SCF/Utils/Utils.cpp b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
index 83766b1..f1f34ea 100644
--- a/mlir/lib/Dialect/SCF/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/SCF/Utils/Utils.cpp
@@ -13,8 +13,8 @@
#include "mlir/Dialect/SCF/Utils/Utils.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/PatternMatch.h"
@@ -147,8 +147,8 @@
outlinedFuncBlockArgs.take_front(numOriginalBlockArguments));
// Explicitly set up a new ReturnOp terminator.
rewriter.setInsertionPointToEnd(outlinedFuncBody);
- rewriter.create<ReturnOp>(loc, originalTerminator->getResultTypes(),
- originalTerminator->getOperands());
+ rewriter.create<func::ReturnOp>(loc, originalTerminator->getResultTypes(),
+ originalTerminator->getOperands());
}
// Reconstruct the block that was deleted and add a
@@ -164,7 +164,8 @@
SmallVector<Value> callValues;
llvm::append_range(callValues, newBlock->getArguments());
llvm::append_range(callValues, outlinedValues);
- Operation *call = rewriter.create<CallOp>(loc, outlinedFunc, callValues);
+ Operation *call =
+ rewriter.create<func::CallOp>(loc, outlinedFunc, callValues);
// `originalTerminator` was moved to `outlinedFuncBody` and is still valid.
// Clone `originalTerminator` to take the callOp results then erase it from
diff --git a/mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp b/mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp
index e9e7f00..a0e93f8 100644
--- a/mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp
+++ b/mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp
@@ -8,9 +8,9 @@
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
#include "mlir/Dialect/Shape/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
@@ -66,8 +66,8 @@
populateShapeRewritePatterns(patterns);
ConversionTarget target(getContext());
- target.addLegalDialect<arith::ArithmeticDialect, ShapeDialect,
- StandardOpsDialect>();
+ target.addLegalDialect<arith::ArithmeticDialect, func::FuncDialect,
+ ShapeDialect>();
target.addIllegalOp<NumElementsOp>();
if (failed(mlir::applyPartialConversion(getOperation(), target,
std::move(patterns))))
diff --git a/mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt b/mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt
index e76261f..f5c4733 100644
--- a/mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt
+++ b/mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt
@@ -8,6 +8,7 @@
MLIRArithmeticTransforms
MLIRAffineToStandard
MLIRBufferizationTransforms
+ MLIRFuncTransforms
MLIRLinalgTransforms
MLIRMathToLLVM
MLIRMemRefToLLVM
@@ -16,7 +17,6 @@
MLIRSCFToControlFlow
MLIRSparseTensor
MLIRSparseTensorTransforms
- MLIRStandardOpsTransforms
MLIRTensorTransforms
MLIRVectorToLLVM
MLIRVectorTransforms
diff --git a/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp b/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
index ff6577a..6d0d674 100644
--- a/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
@@ -11,10 +11,10 @@
#include "mlir/Conversion/Passes.h"
#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "mlir/Dialect/Func/Transforms/Passes.h"
#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/Transforms/Passes.h"
#include "mlir/Dialect/Tensor/Transforms/Passes.h"
#include "mlir/Dialect/Vector/Transforms/Passes.h"
#include "mlir/Pass/PassManager.h"
@@ -38,7 +38,7 @@
pm.addNestedPass<FuncOp>(createConvertLinalgToLoopsPass());
pm.addNestedPass<FuncOp>(createConvertVectorToSCFPass());
pm.addNestedPass<FuncOp>(createConvertSCFToCFPass());
- pm.addPass(createFuncBufferizePass());
+ pm.addPass(func::createFuncBufferizePass());
pm.addPass(arith::createConstantBufferizePass());
pm.addNestedPass<FuncOp>(createTensorBufferizePass());
pm.addNestedPass<FuncOp>(
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/CMakeLists.txt b/mlir/lib/Dialect/SparseTensor/Transforms/CMakeLists.txt
index 15d57bc..51d7bd4 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/CMakeLists.txt
@@ -13,6 +13,7 @@
LINK_LIBS PUBLIC
MLIRArithmetic
MLIRBufferization
+ MLIRFunc
MLIRIR
MLIRLLVMIR
MLIRLinalg
@@ -22,7 +23,6 @@
MLIRSCF
MLIRSCFTransforms
MLIRSCFUtils
- MLIRStandard
MLIRSparseTensor
MLIRSparseTensorUtils
MLIRTensor
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
index 07875fc..ce76ef2 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
@@ -17,13 +17,13 @@
#include "CodegenUtils.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/ExecutionEngine/SparseTensorUtils.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -71,21 +71,24 @@
}
/// Creates a `CallOp` to the function reference returned by `getFunc()`.
-static CallOp createFuncCall(OpBuilder &builder, Operation *op, StringRef name,
- TypeRange resultType, ValueRange operands,
- EmitCInterface emitCInterface) {
+static func::CallOp createFuncCall(OpBuilder &builder, Operation *op,
+ StringRef name, TypeRange resultType,
+ ValueRange operands,
+ EmitCInterface emitCInterface) {
auto fn = getFunc(op, name, resultType, operands, emitCInterface);
- return builder.create<CallOp>(op->getLoc(), resultType, fn, operands);
+ return builder.create<func::CallOp>(op->getLoc(), resultType, fn, operands);
}
/// Replaces the `op` with a `CallOp` to the function reference returned
/// by `getFunc()`.
-static CallOp replaceOpWithFuncCall(PatternRewriter &rewriter, Operation *op,
- StringRef name, TypeRange resultType,
- ValueRange operands,
- EmitCInterface emitCInterface) {
+static func::CallOp replaceOpWithFuncCall(PatternRewriter &rewriter,
+ Operation *op, StringRef name,
+ TypeRange resultType,
+ ValueRange operands,
+ EmitCInterface emitCInterface) {
auto fn = getFunc(op, name, resultType, operands, emitCInterface);
- return rewriter.replaceOpWithNewOp<CallOp>(op, resultType, fn, operands);
+ return rewriter.replaceOpWithNewOp<func::CallOp>(op, resultType, fn,
+ operands);
}
/// Generates dimension size call.
@@ -357,13 +360,13 @@
//===----------------------------------------------------------------------===//
/// Sparse conversion rule for returns.
-class SparseReturnConverter : public OpConversionPattern<ReturnOp> {
+class SparseReturnConverter : public OpConversionPattern<func::ReturnOp> {
public:
using OpConversionPattern::OpConversionPattern;
LogicalResult
- matchAndRewrite(ReturnOp op, OpAdaptor adaptor,
+ matchAndRewrite(func::ReturnOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
- rewriter.replaceOpWithNewOp<ReturnOp>(op, adaptor.getOperands());
+ rewriter.replaceOpWithNewOp<func::ReturnOp>(op, adaptor.getOperands());
return success();
}
};
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
index 62bec93..d51be6b 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
@@ -7,11 +7,11 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/Transforms/FuncConversions.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
using namespace mlir;
@@ -84,11 +84,12 @@
// all sparse tensor types have been fully rewritten.
target.addDynamicallyLegalOp<FuncOp>(
[&](FuncOp op) { return converter.isSignatureLegal(op.getType()); });
- target.addDynamicallyLegalOp<CallOp>([&](CallOp op) {
+ target.addDynamicallyLegalOp<func::CallOp>([&](func::CallOp op) {
return converter.isSignatureLegal(op.getCalleeType());
});
- target.addDynamicallyLegalOp<ReturnOp>(
- [&](ReturnOp op) { return converter.isLegal(op.getOperandTypes()); });
+ target.addDynamicallyLegalOp<func::ReturnOp>([&](func::ReturnOp op) {
+ return converter.isLegal(op.getOperandTypes());
+ });
target.addDynamicallyLegalOp<tensor::DimOp>([&](tensor::DimOp op) {
return converter.isLegal(op.getOperandTypes());
});
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
index 427ee30..1f7246b 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
@@ -15,6 +15,7 @@
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
@@ -23,7 +24,6 @@
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/SparseTensor/Transforms/Passes.h"
#include "mlir/Dialect/SparseTensor/Utils/Merger.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/TensorEncoding.h"
diff --git a/mlir/lib/Dialect/StandardOps/CMakeLists.txt b/mlir/lib/Dialect/StandardOps/CMakeLists.txt
deleted file mode 100644
index f1689ab..0000000
--- a/mlir/lib/Dialect/StandardOps/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-add_mlir_dialect_library(MLIRStandard
- IR/Ops.cpp
-
- ADDITIONAL_HEADER_DIRS
- ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/StandardOps
-
- DEPENDS
- MLIRStandardOpsIncGen
-
- LINK_LIBS PUBLIC
- MLIRArithmetic
- MLIRCallInterfaces
- MLIRCastInterfaces
- MLIRControlFlow
- MLIRControlFlowInterfaces
- MLIRInferTypeOpInterface
- MLIRIR
- MLIRSideEffectInterfaces
- MLIRVectorInterfaces
- )
-
-add_subdirectory(Transforms)
diff --git a/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
index 41b11ea..a28913c 100644
--- a/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
@@ -15,9 +15,9 @@
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.h"
#include "mlir/Dialect/Tensor/Transforms/Passes.h"
diff --git a/mlir/lib/Dialect/Tosa/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Tosa/Transforms/CMakeLists.txt
index 8b10f9d..e98d3df 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Tosa/Transforms/CMakeLists.txt
@@ -13,8 +13,8 @@
MLIRTosaPassIncGen
LINK_LIBS PUBLIC
+ MLIRFunc
MLIRPass
MLIRTosa
- MLIRStandard
MLIRTransformUtils
)
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
index c238302..67531ba 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/DataFlowAnalysis.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
@@ -224,7 +224,7 @@
// being replaceable if it is used by a ReturnOp or a TosaOp.
bool replaceable = true;
for (auto *user : result.getUsers()) {
- if (isa<ReturnOp>(user))
+ if (isa<func::ReturnOp>(user))
continue;
if (user->getDialect()->getNamespace() ==
TosaDialect::getDialectNamespace())
@@ -287,7 +287,7 @@
// Insert UnrealizedConversionCasts to guarantee ReturnOp agress with
// the FuncOp type.
- func.walk([&](ReturnOp op) {
+ func.walk([&](func::ReturnOp op) {
FuncOp parent = dyn_cast<FuncOp>(op->getParentOp());
if (!parent)
return;
@@ -315,7 +315,7 @@
}
if (castAdded) {
- rewriter.replaceOpWithNewOp<ReturnOp>(op, castedValues);
+ rewriter.replaceOpWithNewOp<func::ReturnOp>(op, castedValues);
}
});
}
diff --git a/mlir/lib/Dialect/Vector/Utils/CMakeLists.txt b/mlir/lib/Dialect/Vector/Utils/CMakeLists.txt
index a251986..c195440 100644
--- a/mlir/lib/Dialect/Vector/Utils/CMakeLists.txt
+++ b/mlir/lib/Dialect/Vector/Utils/CMakeLists.txt
@@ -9,9 +9,9 @@
MLIRAffineAnalysis
MLIRArithmetic
MLIRDialectUtils
+ MLIRFunc
MLIRIR
MLIRMemRef
- MLIRStandard
MLIRTensor
MLIRVector
MLIRVectorInterfaces
diff --git a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
index 5388b7b..774b1f3 100644
--- a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
+++ b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
@@ -15,8 +15,8 @@
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/Builders.h"
@@ -283,7 +283,7 @@
superVectorType = transfer.getVectorType();
mustDivide = true;
} else if (op.getNumResults() == 0) {
- if (!isa<ReturnOp>(op)) {
+ if (!isa<func::ReturnOp>(op)) {
op.emitError("NYI: assuming only return operations can have 0 "
" results at this point");
}
diff --git a/mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp b/mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp
index 0fbd54b..bdd8d1f 100644
--- a/mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp
+++ b/mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp
@@ -12,7 +12,6 @@
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/X86Vector/X86VectorDialect.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/PatternMatch.h"
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 7d758fd..f067a04b 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -77,9 +77,9 @@
LINK_LIBS PUBLIC
${dialect_libs}
MLIRExecutionEngine
+ MLIRFunc
MLIRIR
MLIRParser
- MLIRStandard
MLIRLLVMToLLVMIRTranslation
MLIRTargetLLVMIRExport
MLIRTransforms
diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp
index 7273897..89a6b27 100644
--- a/mlir/lib/IR/Operation.cpp
+++ b/mlir/lib/IR/Operation.cpp
@@ -608,8 +608,8 @@
name = name.drop_front(defaultDialect.size() + 1);
// TODO: remove this special case (and update test/IR/parser.mlir)
else if ((defaultDialect.empty() || defaultDialect == "builtin") &&
- name.startswith("std."))
- name = name.drop_front(4);
+ name.startswith("func."))
+ name = name.drop_front(5);
p.getStream() << name;
}
diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp
index 54e4e76..7a48aa9 100644
--- a/mlir/lib/Parser/Parser.cpp
+++ b/mlir/lib/Parser/Parser.cpp
@@ -1672,8 +1672,9 @@
// default dialect (set through OpAsmOpInterface).
opInfo = RegisteredOperationName::lookup(
Twine(defaultDialect + "." + opName).str(), getContext());
- if (!opInfo && getContext()->getOrLoadDialect("std")) {
- opInfo = RegisteredOperationName::lookup(Twine("std." + opName).str(),
+ // FIXME: Remove this in favor of using default dialects.
+ if (!opInfo && getContext()->getOrLoadDialect("func")) {
+ opInfo = RegisteredOperationName::lookup(Twine("func." + opName).str(),
getContext());
}
if (opInfo) {
diff --git a/mlir/lib/Target/Cpp/CMakeLists.txt b/mlir/lib/Target/Cpp/CMakeLists.txt
index da34dcc..8263ef4 100644
--- a/mlir/lib/Target/Cpp/CMakeLists.txt
+++ b/mlir/lib/Target/Cpp/CMakeLists.txt
@@ -9,10 +9,10 @@
MLIRArithmetic
MLIRControlFlow
MLIREmitC
+ MLIRFunc
MLIRIR
MLIRMath
MLIRSCF
- MLIRStandard
MLIRSupport
MLIRTranslation
)
diff --git a/mlir/lib/Target/Cpp/TranslateRegistration.cpp b/mlir/lib/Target/Cpp/TranslateRegistration.cpp
index 889637b..8257409 100644
--- a/mlir/lib/Target/Cpp/TranslateRegistration.cpp
+++ b/mlir/lib/Target/Cpp/TranslateRegistration.cpp
@@ -9,9 +9,9 @@
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
#include "mlir/Dialect/EmitC/IR/EmitC.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Dialect.h"
#include "mlir/Target/Cpp/CppEmitter.h"
@@ -44,8 +44,8 @@
registry.insert<arith::ArithmeticDialect,
cf::ControlFlowDialect,
emitc::EmitCDialect,
+ func::FuncDialect,
math::MathDialect,
- StandardOpsDialect,
scf::SCFDialect>();
// clang-format on
});
diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
index 69b6cbf..ce1483b 100644
--- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp
+++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
@@ -8,8 +8,8 @@
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/EmitC/IR/EmitC.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h"
@@ -238,7 +238,7 @@
}
static LogicalResult printOperation(CppEmitter &emitter,
- mlir::ConstantOp constantOp) {
+ func::ConstantOp constantOp) {
Operation *operation = constantOp.getOperation();
Attribute value = constantOp.getValueAttr();
@@ -311,7 +311,7 @@
return success();
}
-static LogicalResult printOperation(CppEmitter &emitter, mlir::CallOp callOp) {
+static LogicalResult printOperation(CppEmitter &emitter, func::CallOp callOp) {
if (failed(emitter.emitAssignPrefix(*callOp.getOperation())))
return failure();
@@ -545,7 +545,8 @@
return success();
}
-static LogicalResult printOperation(CppEmitter &emitter, ReturnOp returnOp) {
+static LogicalResult printOperation(CppEmitter &emitter,
+ func::ReturnOp returnOp) {
raw_ostream &os = emitter.ostream();
os << "return";
switch (returnOp.getNumOperands()) {
@@ -909,17 +910,22 @@
LogicalResult CppEmitter::emitOperation(Operation &op, bool trailingSemicolon) {
LogicalResult status =
llvm::TypeSwitch<Operation *, LogicalResult>(&op)
+ // Builtin ops.
+ .Case<FuncOp, ModuleOp>(
+ [&](auto op) { return printOperation(*this, op); })
+ // CF ops.
+ .Case<cf::BranchOp, cf::CondBranchOp>(
+ [&](auto op) { return printOperation(*this, op); })
// EmitC ops.
.Case<emitc::ApplyOp, emitc::CallOp, emitc::ConstantOp,
emitc::IncludeOp, emitc::VariableOp>(
[&](auto op) { return printOperation(*this, op); })
+ // Func ops.
+ .Case<func::CallOp, func::ConstantOp, func::ReturnOp>(
+ [&](auto op) { return printOperation(*this, op); })
// SCF ops.
.Case<scf::ForOp, scf::IfOp, scf::YieldOp>(
[&](auto op) { return printOperation(*this, op); })
- // Standard ops.
- .Case<cf::BranchOp, mlir::CallOp, cf::CondBranchOp, mlir::ConstantOp,
- FuncOp, ModuleOp, ReturnOp>(
- [&](auto op) { return printOperation(*this, op); })
// Arithmetic ops.
.Case<arith::ConstantOp>(
[&](auto op) { return printOperation(*this, op); })
diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt
index bf379e9..1477ffe 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -83,6 +83,15 @@
declare_mlir_dialect_python_bindings(
ADD_TO_PARENT MLIRPythonSources.Dialects
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
+ TD_FILE dialects/FuncOps.td
+ SOURCES
+ dialects/func.py
+ dialects/_func_ops_ext.py
+ DIALECT_NAME func)
+
+declare_mlir_dialect_python_bindings(
+ ADD_TO_PARENT MLIRPythonSources.Dialects
+ ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
TD_FILE dialects/GPUOps.td
SOURCES_GLOB dialects/gpu/*.py
DIALECT_NAME gpu)
@@ -167,15 +176,6 @@
declare_mlir_dialect_python_bindings(
ADD_TO_PARENT MLIRPythonSources.Dialects
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
- TD_FILE dialects/StandardOps.td
- SOURCES
- dialects/std.py
- dialects/_std_ops_ext.py
- DIALECT_NAME std)
-
-declare_mlir_dialect_python_bindings(
- ADD_TO_PARENT MLIRPythonSources.Dialects
- ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
TD_FILE dialects/TensorOps.td
SOURCES dialects/tensor.py
DIALECT_NAME tensor)
@@ -232,7 +232,7 @@
MLIRCAPIRegistration # TODO: See about dis-aggregating
# Dialects
- MLIRCAPIStandard
+ MLIRCAPIFunc
)
declare_mlir_python_extension(MLIRPythonExtension.Dialects.Linalg.Pybind
diff --git a/mlir/python/mlir/dialects/StandardOps.td b/mlir/python/mlir/dialects/FuncOps.td
similarity index 70%
rename from mlir/python/mlir/dialects/StandardOps.td
rename to mlir/python/mlir/dialects/FuncOps.td
index 5b7caab..1728091 100644
--- a/mlir/python/mlir/dialects/StandardOps.td
+++ b/mlir/python/mlir/dialects/FuncOps.td
@@ -1,4 +1,4 @@
-//===-- StandardOps.td - Entry point for StandardOps bind --*- tablegen -*-===//
+//===-- FuncOps.td - Entry point for Func bind -------------*- tablegen -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,15 +6,15 @@
//
//===----------------------------------------------------------------------===//
//
-// This is the main file from which the Python bindings for the Standard
-// dialect are generated.
+// This is the main file from which the Python bindings for the Func dialect
+// are generated.
//
//===----------------------------------------------------------------------===//
-#ifndef PYTHON_BINDINGS_STANDARD_OPS
-#define PYTHON_BINDINGS_STANDARD_OPS
+#ifndef PYTHON_BINDINGS_FUNC
+#define PYTHON_BINDINGS_FUNC
include "mlir/Bindings/Python/Attributes.td"
-include "mlir/Dialect/StandardOps/IR/Ops.td"
+include "mlir/Dialect/Func/IR/FuncOps.td"
#endif
diff --git a/mlir/python/mlir/dialects/_builtin_ops_ext.py b/mlir/python/mlir/dialects/_builtin_ops_ext.py
index 78f8c95..a3a1474 100644
--- a/mlir/python/mlir/dialects/_builtin_ops_ext.py
+++ b/mlir/python/mlir/dialects/_builtin_ops_ext.py
@@ -162,7 +162,7 @@
"""
def decorator(f):
- from . import std
+ from . import func
# Introspect the callable for optional features.
sig = inspect.signature(f)
has_arg_func_op = False
@@ -208,15 +208,15 @@
return_values = return_values.results
else:
return_values = list(return_values)
- std.ReturnOp(return_values)
+ func.ReturnOp(return_values)
# Recompute the function type.
return_types = [v.type for v in return_values]
function_type = FunctionType.get(inputs=inputs, results=return_types)
func_op.attributes["type"] = TypeAttr.get(function_type)
def emit_call_op(*call_args):
- call_op = std.CallOp(return_types, FlatSymbolRefAttr.get(symbol_name),
- call_args)
+ call_op = func.CallOp(return_types, FlatSymbolRefAttr.get(symbol_name),
+ call_args)
if return_types is None:
return None
elif len(return_types) == 1:
diff --git a/mlir/python/mlir/dialects/_std_ops_ext.py b/mlir/python/mlir/dialects/_func_ops_ext.py
similarity index 97%
rename from mlir/python/mlir/dialects/_std_ops_ext.py
rename to mlir/python/mlir/dialects/_func_ops_ext.py
index f4cb618..8505626 100644
--- a/mlir/python/mlir/dialects/_std_ops_ext.py
+++ b/mlir/python/mlir/dialects/_func_ops_ext.py
@@ -46,8 +46,8 @@
For example
f = builtin.FuncOp("foo", ...)
- std.CallOp(f, [args])
- std.CallOp([result_types], "foo", [args])
+ func.CallOp(f, [args])
+ func.CallOp([result_types], "foo", [args])
In all cases, the location and insertion point may be specified as keyword
arguments if not provided by the surrounding context managers.
diff --git a/mlir/python/mlir/dialects/std.py b/mlir/python/mlir/dialects/func.py
similarity index 87%
rename from mlir/python/mlir/dialects/std.py
rename to mlir/python/mlir/dialects/func.py
index 8e55807..dc554c2 100644
--- a/mlir/python/mlir/dialects/std.py
+++ b/mlir/python/mlir/dialects/func.py
@@ -2,4 +2,4 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-from ._std_ops_gen import *
+from ._func_ops_gen import *
diff --git a/mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py b/mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py
index 453a3e8..ff5c405 100644
--- a/mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py
+++ b/mlir/python/mlir/dialects/linalg/opdsl/lang/emitter.py
@@ -6,8 +6,8 @@
from .....ir import *
+from .... import func
from .... import linalg
-from .... import std
from .... import math
from .... import arith
from ...._ods_common import get_op_result_or_value as _get_op_result_or_value, get_op_results_or_values as _get_op_results_or_values
diff --git a/mlir/test/CAPI/CMakeLists.txt b/mlir/test/CAPI/CMakeLists.txt
index 9610df6..8a7a567 100644
--- a/mlir/test/CAPI/CMakeLists.txt
+++ b/mlir/test/CAPI/CMakeLists.txt
@@ -34,7 +34,7 @@
ir.c
LINK_LIBS PRIVATE
MLIRCAPIIR
- MLIRCAPIStandard
+ MLIRCAPIFunc
MLIRCAPIRegistration
)
diff --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c
index c8d2739..f2769d3 100644
--- a/mlir/test/CAPI/ir.c
+++ b/mlir/test/CAPI/ir.c
@@ -16,7 +16,7 @@
#include "mlir-c/BuiltinAttributes.h"
#include "mlir-c/BuiltinTypes.h"
#include "mlir-c/Diagnostics.h"
-#include "mlir-c/Dialect/Standard.h"
+#include "mlir-c/Dialect/Func.h"
#include "mlir-c/IntegerSet.h"
#include "mlir-c/Registration.h"
#include "mlir-c/Support.h"
@@ -161,7 +161,7 @@
populateLoopBody(ctx, loopBody, location, funcBody);
MlirOperationState retState = mlirOperationStateGet(
- mlirStringRefCreateFromCString("std.return"), location);
+ mlirStringRefCreateFromCString("func.return"), location);
MlirOperation ret = mlirOperationCreate(&retState);
mlirBlockAppendOwnedOperation(funcBody, ret);
@@ -837,10 +837,10 @@
const char data[] = "abcdefghijklmnopqestuvwxyz";
MlirAttribute opaque =
- mlirOpaqueAttrGet(ctx, mlirStringRefCreateFromCString("std"), 3, data,
+ mlirOpaqueAttrGet(ctx, mlirStringRefCreateFromCString("func"), 3, data,
mlirNoneTypeGet(ctx));
if (!mlirAttributeIsAOpaque(opaque) ||
- !stringIsEqual("std", mlirOpaqueAttrGetDialectNamespace(opaque)))
+ !stringIsEqual("func", mlirOpaqueAttrGetDialectNamespace(opaque)))
return 4;
MlirStringRef opaqueData = mlirOpaqueAttrGetData(opaque);
@@ -848,7 +848,7 @@
strncmp(data, opaqueData.data, opaqueData.length))
return 5;
mlirAttributeDump(opaque);
- // CHECK: #std.abc
+ // CHECK: #func.abc
MlirAttribute string =
mlirStringAttrGet(ctx, mlirStringRefCreate(data + 3, 2));
@@ -1514,7 +1514,7 @@
if (mlirContextGetNumLoadedDialects(ctx) != 1)
return 1;
- MlirDialectHandle stdHandle = mlirGetDialectHandle__std__();
+ MlirDialectHandle stdHandle = mlirGetDialectHandle__func__();
MlirDialect std = mlirContextGetOrLoadDialect(
ctx, mlirDialectHandleGetNamespace(stdHandle));
@@ -1546,10 +1546,10 @@
mlirContextIsRegisteredOperation(
ctx, mlirStringRefCreateFromCString("cf.cond_br")));
- // CHECK: std.not_existing_op is_registered: 0
- fprintf(stderr, "std.not_existing_op is_registered: %d\n",
+ // CHECK: func.not_existing_op is_registered: 0
+ fprintf(stderr, "func.not_existing_op is_registered: %d\n",
mlirContextIsRegisteredOperation(
- ctx, mlirStringRefCreateFromCString("std.not_existing_op")));
+ ctx, mlirStringRefCreateFromCString("func.not_existing_op")));
// CHECK: not_existing_dialect.not_existing_op is_registered: 0
fprintf(stderr, "not_existing_dialect.not_existing_op is_registered: %d\n",
@@ -1674,7 +1674,7 @@
MlirContext ctx = mlirContextCreate();
mlirRegisterAllDialects(ctx);
- mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("std"));
+ mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("func"));
MlirLocation loc = mlirLocationUnknownGet(ctx);
MlirType indexType = mlirIndexTypeGet(ctx);
MlirStringRef valueStringRef = mlirStringRefCreateFromCString("value");
@@ -1923,7 +1923,7 @@
return 1;
}
- MlirDialectHandle stdHandle = mlirGetDialectHandle__std__();
+ MlirDialectHandle stdHandle = mlirGetDialectHandle__func__();
mlirDialectHandleInsertDialect(stdHandle, registry);
MlirContext ctx = mlirContextCreate();
diff --git a/mlir/test/CAPI/pass.c b/mlir/test/CAPI/pass.c
index c497448..d83d44d 100644
--- a/mlir/test/CAPI/pass.c
+++ b/mlir/test/CAPI/pass.c
@@ -43,7 +43,7 @@
// CHECK-LABEL: Operations encountered:
// CHECK: arith.addi , 1
// CHECK: builtin.func , 1
- // CHECK: std.return , 1
+ // CHECK: func.return , 1
{
MlirPassManager pm = mlirPassManagerCreate(ctx);
MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
@@ -85,7 +85,7 @@
// CHECK-LABEL: Operations encountered:
// CHECK: arith.addi , 1
// CHECK: builtin.func , 1
- // CHECK: std.return , 1
+ // CHECK: func.return , 1
{
MlirPassManager pm = mlirPassManagerCreate(ctx);
MlirOpPassManager nestedFuncPm = mlirPassManagerGetNestedUnder(
@@ -101,7 +101,7 @@
// CHECK-LABEL: Operations encountered:
// CHECK: arith.addf , 1
// CHECK: builtin.func , 1
- // CHECK: std.return , 1
+ // CHECK: func.return , 1
{
MlirPassManager pm = mlirPassManagerCreate(ctx);
MlirOpPassManager nestedModulePm = mlirPassManagerGetNestedUnder(
diff --git a/mlir/test/Conversion/ArithmeticToLLVM/arith-to-llvm.mlir b/mlir/test/Conversion/ArithmeticToLLVM/arith-to-llvm.mlir
index 14c0c3b..be285b7 100644
--- a/mlir/test/Conversion/ArithmeticToLLVM/arith-to-llvm.mlir
+++ b/mlir/test/Conversion/ArithmeticToLLVM/arith-to-llvm.mlir
@@ -324,7 +324,7 @@
%0 = arith.constant dense<[0, 1, 2, 3]> : vector<4xindex>
// CHECK: %[[V:.*]] = llvm.add %{{.*}}, %[[CST]] : vector<4xi64>
%1 = arith.addi %arg0, %0 : vector<4xindex>
- std.return
+ func.return
}
// -----
@@ -347,7 +347,7 @@
// CHECK: %[[CMP:.*]] = llvm.fcmp "olt" %[[EXTRACT1]], %[[EXTRACT2]] : vector<3xf32>
// CHECK: %[[INSERT:.*]] = llvm.insertvalue %[[CMP]], %2[0] : !llvm.array<4 x vector<3xi1>>
%0 = arith.cmpf olt, %arg0, %arg1 : vector<4x3xf32>
- std.return
+ func.return
}
// -----
@@ -358,7 +358,7 @@
// CHECK: %[[ARG1:.*]] = builtin.unrealized_conversion_cast
// CHECK: %[[CMP:.*]] = llvm.icmp "ult" %[[ARG0]], %[[ARG1]] : vector<1xi32>
%0 = arith.cmpi ult, %arg0, %arg1 : vector<i32>
- std.return
+ func.return
}
// -----
@@ -372,7 +372,7 @@
// CHECK: %[[CMP:.*]] = llvm.icmp "ult" %[[EXTRACT1]], %[[EXTRACT2]] : vector<3xi32>
// CHECK: %[[INSERT:.*]] = llvm.insertvalue %[[CMP]], %2[0] : !llvm.array<4 x vector<3xi1>>
%0 = arith.cmpi ult, %arg0, %arg1 : vector<4x3xi32>
- std.return
+ func.return
}
// -----
diff --git a/mlir/test/Conversion/ArithmeticToLLVM/convert-nd-vector-to-llvmir.mlir b/mlir/test/Conversion/ArithmeticToLLVM/convert-nd-vector-to-llvmir.mlir
index 1d40ba6..d754235 100644
--- a/mlir/test/Conversion/ArithmeticToLLVM/convert-nd-vector-to-llvmir.mlir
+++ b/mlir/test/Conversion/ArithmeticToLLVM/convert-nd-vector-to-llvmir.mlir
@@ -208,5 +208,5 @@
// CHECK: %[[SELECT:.*]] = llvm.select %[[EXTRACT1]], %[[EXTRACT2]], %[[EXTRACT3]] : vector<3xi1>, vector<3xi32>
// CHECK: %[[INSERT:.*]] = llvm.insertvalue %[[SELECT]], %{{.*}}[0] : !llvm.array<4 x vector<3xi32>>
%0 = arith.select %arg0, %arg1, %arg2 : vector<4x3xi1>, vector<4x3xi32>
- std.return
+ func.return
}
diff --git a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
index 3c75bb9..6e6f0a9 100644
--- a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
+++ b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
@@ -49,7 +49,7 @@
// CHECK: = llvm.sext %{{.*}} : i32 to i64
%gDimZ = gpu.grid_dim z
- std.return %tIdX, %tIdY, %tIdZ, %bDimX, %bDimY, %bDimZ,
+ func.return %tIdX, %tIdY, %tIdZ, %bDimX, %bDimY, %bDimZ,
%bIdX, %bIdY, %bIdZ, %gDimX, %gDimY, %gDimZ
: index, index, index, index, index, index,
index, index, index, index, index, index
@@ -67,7 +67,7 @@
%0 = arith.addi %idx, %idx : index
// CHECK: llvm.return %{{.*}} : i64
// CHECK32: llvm.return %{{.*}} : i32
- std.return %0 : index
+ func.return %0 : index
}
}
@@ -140,7 +140,7 @@
// CHECK: nvvm.shfl.sync idx {{.*}} {return_value_and_is_valid} : f32 -> !llvm.struct<(f32, i1)>
%shfli, %predi = gpu.shuffle idx %arg0, %arg1, %arg2 : f32
- std.return %shfl, %shflu, %shfld, %shfli : f32, f32,f32, f32
+ func.return %shfl, %shflu, %shfld, %shfli : f32, f32,f32, f32
}
}
@@ -151,7 +151,7 @@
builtin.func @gpu_sync() {
// CHECK: nvvm.barrier0
gpu.barrier
- std.return
+ func.return
}
}
@@ -166,7 +166,7 @@
// CHECK: llvm.call @__nv_fabsf(%{{.*}}) : (f32) -> f32
%result64 = math.abs %arg_f64 : f64
// CHECK: llvm.call @__nv_fabs(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -181,7 +181,7 @@
// CHECK: llvm.call @__nv_ceilf(%{{.*}}) : (f32) -> f32
%result64 = math.ceil %arg_f64 : f64
// CHECK: llvm.call @__nv_ceil(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -196,7 +196,7 @@
// CHECK: llvm.call @__nv_floorf(%{{.*}}) : (f32) -> f32
%result64 = math.floor %arg_f64 : f64
// CHECK: llvm.call @__nv_floor(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -211,7 +211,7 @@
// CHECK: llvm.call @__nv_cosf(%{{.*}}) : (f32) -> f32
%result64 = math.cos %arg_f64 : f64
// CHECK: llvm.call @__nv_cos(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -225,7 +225,7 @@
// CHECK: llvm.call @__nv_expf(%{{.*}}) : (f32) -> f32
%result64 = math.exp %arg_f64 : f64
// CHECK: llvm.call @__nv_exp(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -239,7 +239,7 @@
// CHECK: llvm.call @__nv_exp2f(%{{.*}}) : (f32) -> f32
%result64 = math.exp2 %arg_f64 : f64
// CHECK: llvm.call @__nv_exp2(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -254,7 +254,7 @@
// CHECK: llvm.call @__nv_logf(%{{.*}}) : (f32) -> f32
%result64 = math.log %arg_f64 : f64
// CHECK: llvm.call @__nv_log(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -269,7 +269,7 @@
// CHECK: llvm.call @__nv_log10f(%{{.*}}) : (f32) -> f32
%result64 = math.log10 %arg_f64 : f64
// CHECK: llvm.call @__nv_log10(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -284,7 +284,7 @@
// CHECK: llvm.call @__nv_log1pf(%{{.*}}) : (f32) -> f32
%result64 = math.log1p %arg_f64 : f64
// CHECK: llvm.call @__nv_log1p(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -299,7 +299,7 @@
// CHECK: llvm.call @__nv_log2f(%{{.*}}) : (f32) -> f32
%result64 = math.log2 %arg_f64 : f64
// CHECK: llvm.call @__nv_log2(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -314,7 +314,7 @@
// CHECK: llvm.call @__nv_sinf(%{{.*}}) : (f32) -> f32
%result64 = math.sin %arg_f64 : f64
// CHECK: llvm.call @__nv_sin(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -333,7 +333,7 @@
// CHECK: llvm.call @__nv_tanhf(%{{.*}}) : (f32) -> f32
%result64 = math.tanh %arg_f64 : f64
// CHECK: llvm.call @__nv_tanh(%{{.*}}) : (f64) -> f64
- std.return %result16, %result32, %result64 : f16, f32, f64
+ func.return %result16, %result32, %result64 : f16, f32, f64
}
}
@@ -353,7 +353,7 @@
// CHECK: llvm.call @__nv_rsqrtf(%{{.*}}) : (f32) -> f32
%result64 = math.rsqrt %arg_f64 : f64
// CHECK: llvm.call @__nv_rsqrt(%{{.*}}) : (f64) -> f64
- std.return %result16, %result32, %result64 : f16, f32, f64
+ func.return %result16, %result32, %result64 : f16, f32, f64
}
}
@@ -373,7 +373,7 @@
// CHECK: llvm.call @__nv_sqrtf(%{{.*}}) : (f32) -> f32
%result64 = math.sqrt %arg_f64 : f64
// CHECK: llvm.call @__nv_sqrt(%{{.*}}) : (f64) -> f64
- std.return %result16, %result32, %result64 : f16, f32, f64
+ func.return %result16, %result32, %result64 : f16, f32, f64
}
}
@@ -393,7 +393,7 @@
// CHECK: llvm.call @__nv_atanf(%{{.*}}) : (f32) -> f32
%result64 = math.atan %arg_f64 : f64
// CHECK: llvm.call @__nv_atan(%{{.*}}) : (f64) -> f64
- std.return %result16, %result32, %result64 : f16, f32, f64
+ func.return %result16, %result32, %result64 : f16, f32, f64
}
}
@@ -414,7 +414,7 @@
// CHECK: llvm.call @__nv_atan2f(%{{.*}}) : (f32, f32) -> f32
%result64 = math.atan2 %arg_f64, %arg_f64 : f64
// CHECK: llvm.call @__nv_atan2(%{{.*}}) : (f64, f64) -> f64
- std.return %result16, %result32, %result64 : f16, f32, f64
+ func.return %result16, %result32, %result64 : f16, f32, f64
}
}
@@ -432,7 +432,7 @@
// CHECK: llvm.call @__nv_expf(%{{.*}}) : (f32) -> f32
%result64 = math.exp %arg_f64 : f64
// CHECK: llvm.call @__nv_exp(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
"test.finish" () : () -> ()
}) : () -> ()
@@ -449,7 +449,7 @@
// CHECK: llvm.call @__nv_expm1f(%{{.*}}) : (f32) -> f32
%result64 = math.expm1 %arg_f64 : f64
// CHECK: llvm.call @__nv_expm1(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -464,7 +464,7 @@
// CHECK: llvm.call @__nv_powf(%{{.*}}, %{{.*}}) : (f32, f32) -> f32
%result64 = math.powf %arg_f64, %arg_f64 : f64
// CHECK: llvm.call @__nv_pow(%{{.*}}, %{{.*}}) : (f64, f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
diff --git a/mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir b/mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
index 42da06e..89c1ee0 100644
--- a/mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
+++ b/mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
@@ -49,7 +49,7 @@
// CHECK: = llvm.sext %{{.*}} : i32 to i64
%gDimZ = gpu.grid_dim z
- std.return %tIdX, %tIdY, %tIdZ, %bDimX, %bDimY, %bDimZ,
+ func.return %tIdX, %tIdY, %tIdZ, %bDimX, %bDimY, %bDimZ,
%bIdX, %bIdY, %bIdZ, %gDimX, %gDimY, %gDimZ
: index, index, index, index, index, index,
index, index, index, index, index, index
@@ -67,7 +67,7 @@
%0 = arith.addi %idx, %idx : index
// CHECK: llvm.return %{{.*}} : i64
// CHECK32: llvm.return %{{.*}} : i32
- std.return %0 : index
+ func.return %0 : index
}
}
@@ -78,7 +78,7 @@
builtin.func @gpu_sync() {
// CHECK: rocdl.barrier
gpu.barrier
- std.return
+ func.return
}
}
@@ -93,7 +93,7 @@
// CHECK: llvm.call @__ocml_fabs_f32(%{{.*}}) : (f32) -> f32
%result64 = math.abs %arg_f64 : f64
// CHECK: llvm.call @__ocml_fabs_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -108,7 +108,7 @@
// CHECK: llvm.call @__ocml_ceil_f32(%{{.*}}) : (f32) -> f32
%result64 = math.ceil %arg_f64 : f64
// CHECK: llvm.call @__ocml_ceil_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -123,7 +123,7 @@
// CHECK: llvm.call @__ocml_floor_f32(%{{.*}}) : (f32) -> f32
%result64 = math.floor %arg_f64 : f64
// CHECK: llvm.call @__ocml_floor_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -138,7 +138,7 @@
// CHECK: llvm.call @__ocml_cos_f32(%{{.*}}) : (f32) -> f32
%result64 = math.cos %arg_f64 : f64
// CHECK: llvm.call @__ocml_cos_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -155,7 +155,7 @@
// CHECK: llvm.call @__ocml_exp_f32(%{{.*}}) : (f32) -> f32
%result64 = math.exp %arg_f64 : f64
// CHECK: llvm.call @__ocml_exp_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -172,7 +172,7 @@
// CHECK: llvm.call @__ocml_exp2_f32(%{{.*}}) : (f32) -> f32
%result64 = math.exp2 %arg_f64 : f64
// CHECK: llvm.call @__ocml_exp2_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -192,7 +192,7 @@
// CHECK: llvm.call @__ocml_exp_f32(%{{.*}}) : (f32) -> f32
%result64 = math.exp %arg_f64 : f64
// CHECK: llvm.call @__ocml_exp_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
"test.finish" () : () -> ()
}) : () -> ()
@@ -211,7 +211,7 @@
// CHECK: llvm.call @__ocml_expm1_f32(%{{.*}}) : (f32) -> f32
%result64 = math.expm1 %arg_f64 : f64
// CHECK: llvm.call @__ocml_expm1_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -226,7 +226,7 @@
// CHECK: llvm.call @__ocml_log_f32(%{{.*}}) : (f32) -> f32
%result64 = math.log %arg_f64 : f64
// CHECK: llvm.call @__ocml_log_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -241,7 +241,7 @@
// CHECK: llvm.call @__ocml_log1p_f32(%{{.*}}) : (f32) -> f32
%result64 = math.log1p %arg_f64 : f64
// CHECK: llvm.call @__ocml_log1p_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -256,7 +256,7 @@
// CHECK: llvm.call @__ocml_log10_f32(%{{.*}}) : (f32) -> f32
%result64 = math.log10 %arg_f64 : f64
// CHECK: llvm.call @__ocml_log10_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -271,7 +271,7 @@
// CHECK: llvm.call @__ocml_log2_f32(%{{.*}}) : (f32) -> f32
%result64 = math.log2 %arg_f64 : f64
// CHECK: llvm.call @__ocml_log2_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -291,7 +291,7 @@
// CHECK: llvm.call @__ocml_rsqrt_f32(%{{.*}}) : (f32) -> f32
%result64 = math.rsqrt %arg_f64 : f64
// CHECK: llvm.call @__ocml_rsqrt_f64(%{{.*}}) : (f64) -> f64
- std.return %result16, %result32, %result64 : f16, f32, f64
+ func.return %result16, %result32, %result64 : f16, f32, f64
}
}
@@ -311,7 +311,7 @@
// CHECK: llvm.call @__ocml_sqrt_f32(%{{.*}}) : (f32) -> f32
%result64 = math.sqrt %arg_f64 : f64
// CHECK: llvm.call @__ocml_sqrt_f64(%{{.*}}) : (f64) -> f64
- std.return %result16, %result32, %result64 : f16, f32, f64
+ func.return %result16, %result32, %result64 : f16, f32, f64
}
}
@@ -326,7 +326,7 @@
// CHECK: llvm.call @__ocml_tanh_f32(%{{.*}}) : (f32) -> f32
%result64 = math.tanh %arg_f64 : f64
// CHECK: llvm.call @__ocml_tanh_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -341,7 +341,7 @@
// CHECK: llvm.call @__ocml_atan_f32(%{{.*}}) : (f32) -> f32
%result64 = math.atan %arg_f64 : f64
// CHECK: llvm.call @__ocml_atan_f64(%{{.*}}) : (f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -356,7 +356,7 @@
// CHECK: llvm.call @__ocml_atan2_f32(%{{.*}}) : (f32, f32) -> f32
%result64 = math.atan2 %arg_f64, %arg_f64 : f64
// CHECK: llvm.call @__ocml_atan2_f64(%{{.*}}) : (f64, f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
@@ -371,7 +371,7 @@
// CHECK: llvm.call @__ocml_pow_f32(%{{.*}}, %{{.*}}) : (f32, f32) -> f32
%result64 = math.powf %arg_f64, %arg_f64 : f64
// CHECK: llvm.call @__ocml_pow_f64(%{{.*}}, %{{.*}}) : (f64, f64) -> f64
- std.return %result32, %result64 : f32, f64
+ func.return %result32, %result64 : f32, f64
}
}
diff --git a/mlir/test/Conversion/MathToLLVM/math-to-llvm.mlir b/mlir/test/Conversion/MathToLLVM/math-to-llvm.mlir
index b2de213..002c3cd 100644
--- a/mlir/test/Conversion/MathToLLVM/math-to-llvm.mlir
+++ b/mlir/test/Conversion/MathToLLVM/math-to-llvm.mlir
@@ -10,7 +10,7 @@
%19 = math.sqrt %arg0 : f32
// CHECK: = "llvm.intr.sqrt"(%{{.*}}) : (f64) -> f64
%20 = math.sqrt %arg4 : f64
- std.return
+ func.return
}
// -----
@@ -22,7 +22,7 @@
// CHECK: %[[ADD:.*]] = llvm.fadd %[[ONE]], %arg0 : f32
// CHECK: %[[LOG:.*]] = "llvm.intr.log"(%[[ADD]]) : (f32) -> f32
%0 = math.log1p %arg0 : f32
- std.return
+ func.return
}
// -----
@@ -35,7 +35,7 @@
// CHECK: %[[LOG:.*]] = "llvm.intr.log"(%[[ADD]]) : (vector<3xf32>) -> vector<3xf32>
// CHECK: %[[INSERT:.*]] = llvm.insertvalue %[[LOG]], %{{.*}}[0] : !llvm.array<4 x vector<3xf32>>
%0 = math.log1p %arg0 : vector<4x3xf32>
- std.return
+ func.return
}
// -----
@@ -47,7 +47,7 @@
// CHECK: %[[EXP:.*]] = "llvm.intr.exp"(%arg0) : (f32) -> f32
// CHECK: %[[SUB:.*]] = llvm.fsub %[[EXP]], %[[ONE]] : f32
%0 = math.expm1 %arg0 : f32
- std.return
+ func.return
}
// -----
@@ -59,7 +59,7 @@
// CHECK: %[[SQRT:.*]] = "llvm.intr.sqrt"(%arg0) : (f32) -> f32
// CHECK: %[[DIV:.*]] = llvm.fdiv %[[ONE]], %[[SQRT]] : f32
%0 = math.rsqrt %arg0 : f32
- std.return
+ func.return
}
// -----
@@ -69,7 +69,7 @@
func @sine(%arg0 : f32) {
// CHECK: "llvm.intr.sin"(%arg0) : (f32) -> f32
%0 = math.sin %arg0 : f32
- std.return
+ func.return
}
// -----
@@ -80,7 +80,7 @@
// CHECK: %[[ZERO:.+]] = llvm.mlir.constant(false) : i1
// CHECK: "llvm.intr.ctlz"(%arg0, %[[ZERO]]) : (i32, i1) -> i32
%0 = math.ctlz %arg0 : i32
- std.return
+ func.return
}
// -----
@@ -91,7 +91,7 @@
// CHECK: %[[ZERO:.+]] = llvm.mlir.constant(false) : i1
// CHECK: "llvm.intr.cttz"(%arg0, %[[ZERO]]) : (i32, i1) -> i32
%0 = math.cttz %arg0 : i32
- std.return
+ func.return
}
// -----
@@ -102,7 +102,7 @@
// CHECK: %[[ZERO:.+]] = llvm.mlir.constant(false) : i1
// CHECK: "llvm.intr.cttz"(%arg0, %[[ZERO]]) : (vector<4xi32>, i1) -> vector<4xi32>
%0 = math.cttz %arg0 : vector<4xi32>
- std.return
+ func.return
}
// -----
@@ -112,7 +112,7 @@
func @ctpop(%arg0 : i32) {
// CHECK: "llvm.intr.ctpop"(%arg0) : (i32) -> i32
%0 = math.ctpop %arg0 : i32
- std.return
+ func.return
}
// -----
@@ -122,7 +122,7 @@
func @ctpop_vector(%arg0 : vector<3xi32>) {
// CHECK: "llvm.intr.ctpop"(%arg0) : (vector<3xi32>) -> vector<3xi32>
%0 = math.ctpop %arg0 : vector<3xi32>
- std.return
+ func.return
}
// -----
@@ -134,7 +134,7 @@
// CHECK: %[[SQRT:.*]] = "llvm.intr.sqrt"(%arg0) : (f64) -> f64
// CHECK: %[[DIV:.*]] = llvm.fdiv %[[ONE]], %[[SQRT]] : f64
%0 = math.rsqrt %arg0 : f64
- std.return
+ func.return
}
// -----
@@ -146,7 +146,7 @@
// CHECK: %[[SQRT:.*]] = "llvm.intr.sqrt"(%arg0) : (vector<4xf32>) -> vector<4xf32>
// CHECK: %[[DIV:.*]] = llvm.fdiv %[[ONE]], %[[SQRT]] : vector<4xf32>
%0 = math.rsqrt %arg0 : vector<4xf32>
- std.return
+ func.return
}
// -----
@@ -159,7 +159,7 @@
// CHECK: %[[DIV:.*]] = llvm.fdiv %[[ONE]], %[[SQRT]] : vector<3xf32>
// CHECK: %[[INSERT:.*]] = llvm.insertvalue %[[DIV]], %{{.*}}[0] : !llvm.array<4 x vector<3xf32>>
%0 = math.rsqrt %arg0 : vector<4x3xf32>
- std.return
+ func.return
}
// -----
@@ -169,6 +169,6 @@
func @powf(%arg0 : f64) {
// CHECK: %[[POWF:.*]] = "llvm.intr.pow"(%arg0, %arg0) : (f64, f64) -> f64
%0 = math.powf %arg0, %arg0 : f64
- std.return
+ func.return
}
diff --git a/mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir b/mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
index 85c6ca1..32f9c2f 100644
--- a/mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
+++ b/mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
@@ -571,7 +571,7 @@
%1 = arith.constant 7 : index
// CHECK: llvm.load %{{.*}} : !llvm.ptr<f32, 5>
%2 = memref.load %0[%1] : memref<32xf32, affine_map<(d0) -> (d0)>, 5>
- std.return
+ func.return
}
// -----
diff --git a/mlir/test/Conversion/ShapeToStandard/shape-to-standard.mlir b/mlir/test/Conversion/ShapeToStandard/shape-to-standard.mlir
index 97d4c9f..5ebee9a 100644
--- a/mlir/test/Conversion/ShapeToStandard/shape-to-standard.mlir
+++ b/mlir/test/Conversion/ShapeToStandard/shape-to-standard.mlir
@@ -74,7 +74,7 @@
// -----
-// Express `get_extent` as `std.tensor.extract`.
+// Express `get_extent` as `tensor.extract`.
// CHECK-LABEL: @get_extent_from_extent_tensor
// CHECK-SAME: (%[[EXTENTS:.*]]: tensor<?xindex>, %[[IDX:.*]]: index) -> index
func @get_extent_from_extent_tensor(%extents : tensor<?xindex>, %idx : index)
diff --git a/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir b/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
index 479ccaa..e774b90 100644
--- a/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
@@ -454,7 +454,7 @@
func @ceilf(%arg0 : f32) {
// CHECK: "llvm.intr.ceil"(%arg0) : (f32) -> f32
%0 = math.ceil %arg0 : f32
- std.return
+ func.return
}
// -----
@@ -464,7 +464,7 @@
func @floorf(%arg0 : f32) {
// CHECK: "llvm.intr.floor"(%arg0) : (f32) -> f32
%0 = math.floor %arg0 : f32
- std.return
+ func.return
}
// -----
@@ -507,7 +507,7 @@
%0 = math.fma %arg0, %arg0, %arg0 : f32
// CHECK: %[[V:.*]] = "llvm.intr.fma"(%[[ARG1]], %[[ARG1]], %[[ARG1]]) : (vector<4xf32>, vector<4xf32>, vector<4xf32>) -> vector<4xf32>
%1 = math.fma %arg1, %arg1, %arg1 : vector<4xf32>
- std.return
+ func.return
}
// -----
@@ -521,10 +521,10 @@
]
^bb1:
%c_1 = arith.constant 1 : i32
- std.return %c_1 : i32
+ func.return %c_1 : i32
^bb3:
%c_42 = arith.constant 42 : i32
- std.return %c_42: i32
+ func.return %c_42: i32
}
// CHECK: llvm.switch %arg0 : i8, ^bb1 [
// CHECK-NEXT: 42: ^bb1,
diff --git a/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir b/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
index 4fc94af..2f313e3 100644
--- a/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
+++ b/mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
@@ -264,7 +264,7 @@
// -----
//===----------------------------------------------------------------------===//
-// std.cmpf
+// arith.cmpf
//===----------------------------------------------------------------------===//
module attributes {
@@ -348,7 +348,7 @@
// -----
//===----------------------------------------------------------------------===//
-// std.cmpi
+// arith.cmpi
//===----------------------------------------------------------------------===//
module attributes {
@@ -849,7 +849,7 @@
// -----
//===----------------------------------------------------------------------===//
-// std.return
+// func.return
//===----------------------------------------------------------------------===//
module attributes {
diff --git a/mlir/test/Dialect/Arithmetic/ops.mlir b/mlir/test/Dialect/Arithmetic/ops.mlir
index 3a79342..af8588d 100644
--- a/mlir/test/Dialect/Arithmetic/ops.mlir
+++ b/mlir/test/Dialect/Arithmetic/ops.mlir
@@ -903,8 +903,8 @@
// CHECK: %c42_i32_0 = arith.constant 42 : i32
%1 = arith.constant 42 : i32
- // CHECK: %c43 = arith.constant {crazy = "std.foo"} 43 : index
- %2 = arith.constant {crazy = "std.foo"} 43: index
+ // CHECK: %c43 = arith.constant {crazy = "func.foo"} 43 : index
+ %2 = arith.constant {crazy = "func.foo"} 43: index
// CHECK: %cst = arith.constant 4.300000e+01 : bf16
%3 = arith.constant 43.0 : bf16
diff --git a/mlir/test/Dialect/Tensor/invalid.mlir b/mlir/test/Dialect/Tensor/invalid.mlir
index 5c48a08..3aaa18e7 100644
--- a/mlir/test/Dialect/Tensor/invalid.mlir
+++ b/mlir/test/Dialect/Tensor/invalid.mlir
@@ -91,7 +91,7 @@
func @tensor.generate(%m : index, %n : index)
-> tensor<?x3x?xf32> {
- // expected-error @+2 {{op expects regions to end with 'tensor.yield', found 'std.return'}}
+ // expected-error @+2 {{op expects regions to end with 'tensor.yield', found 'func.return'}}
// expected-note @+1 {{in custom textual format, the absence of terminator implies 'tensor.yield'}}
%tnsr = tensor.generate %m, %n {
^bb0(%i : index, %j : index, %k : index):
diff --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir
index 55280b2..74dde5c 100644
--- a/mlir/test/IR/core-ops.mlir
+++ b/mlir/test/IR/core-ops.mlir
@@ -205,7 +205,7 @@
// CHECK-LABEL: func @return_op(%arg0: i32) -> i32 {
func @return_op(%a : i32) -> i32 {
// CHECK: return %arg0 : i32
- "std.return" (%a) : (i32)->()
+ "func.return" (%a) : (i32)->()
}
// CHECK-LABEL: func @calls(%arg0: i32) {
@@ -215,7 +215,7 @@
// CHECK: %1 = call @return_op(%0) : (i32) -> i32
%y = call @return_op(%x) : (i32) -> i32
// CHECK: %2 = call @return_op(%0) : (i32) -> i32
- %z = "std.call"(%x) {callee = @return_op} : (i32) -> i32
+ %z = "func.call"(%x) {callee = @return_op} : (i32) -> i32
// CHECK: %f = constant @affine_apply : () -> ()
%f = constant @affine_apply : () -> ()
@@ -230,7 +230,7 @@
%2 = call_indirect %f_0(%arg0) : (i32) -> i32
// CHECK: %4 = call_indirect %f_0(%arg0) : (i32) -> i32
- %3 = "std.call_indirect"(%f_0, %arg0) : ((i32) -> i32, i32) -> i32
+ %3 = "func.call_indirect"(%f_0, %arg0) : ((i32) -> i32, i32) -> i32
return
}
diff --git a/mlir/test/IR/generic-visitors-interrupt.mlir b/mlir/test/IR/generic-visitors-interrupt.mlir
index 3b4cb04..35099f0 100644
--- a/mlir/test/IR/generic-visitors-interrupt.mlir
+++ b/mlir/test/IR/generic-visitors-interrupt.mlir
@@ -108,7 +108,7 @@
// CHECK: step 0 op 'builtin.module' before all regions
// CHECK: step 1 op 'builtin.func' before all regions
// CHECK: step 2 op 'arith.addf' before all regions
-// CHECK: step 3 op 'std.return' before all regions
+// CHECK: step 3 op 'func.return' before all regions
// CHECK: step 4 op 'builtin.func' after all regions
// CHECK: step 5 op 'builtin.module' after all regions
@@ -131,7 +131,7 @@
// CHECK: step 4 op 'foo' before region #1
// CHECK: step 5 op 'bar1' before all regions
// CHECK: step 6 op 'arith.addf' before all regions
-// CHECK: step 7 op 'std.return' before all regions
+// CHECK: step 7 op 'func.return' before all regions
// CHECK: step 8 op 'builtin.func' after all regions
// CHECK: step 9 op 'builtin.module' after all regions
@@ -152,6 +152,6 @@
// CHECK: step 2 op 'foo' before all regions
// CHECK: step 3 op 'bar0' before all regions
// CHECK: step 4 op 'arith.addf' before all regions
-// CHECK: step 5 op 'std.return' before all regions
+// CHECK: step 5 op 'func.return' before all regions
// CHECK: step 6 op 'builtin.func' after all regions
// CHECK: step 7 op 'builtin.module' after all regions
diff --git a/mlir/test/IR/generic-visitors.mlir b/mlir/test/IR/generic-visitors.mlir
index c87bd55..b14cf93 100644
--- a/mlir/test/IR/generic-visitors.mlir
+++ b/mlir/test/IR/generic-visitors.mlir
@@ -36,7 +36,7 @@
// CHECK: step 14 op 'use3' before all regions
// CHECK: step 15 op 'scf.yield' before all regions
// CHECK: step 16 op 'scf.for' after all regions
-// CHECK: step 17 op 'std.return' before all regions
+// CHECK: step 17 op 'func.return' before all regions
// CHECK: step 18 op 'builtin.func' after all regions
// CHECK: step 19 op 'builtin.module' after all regions
diff --git a/mlir/test/IR/invalid-ops.mlir b/mlir/test/IR/invalid-ops.mlir
index 8415126..b5a0f10 100644
--- a/mlir/test/IR/invalid-ops.mlir
+++ b/mlir/test/IR/invalid-ops.mlir
@@ -37,8 +37,8 @@
// -----
func @unknown_std_op() {
- // expected-error@+1 {{unregistered operation 'std.foo_bar_op' found in dialect ('std') that does not allow unknown operations}}
- %0 = "std.foo_bar_op"() : () -> index
+ // expected-error@+1 {{unregistered operation 'func.foo_bar_op' found in dialect ('func') that does not allow unknown operations}}
+ %0 = "func.foo_bar_op"() : () -> index
return
}
@@ -98,7 +98,7 @@
func @return_not_in_function() {
"foo.region"() ({
- // expected-error@+1 {{'std.return' op expects parent op 'builtin.func'}}
+ // expected-error@+1 {{'func.return' op expects parent op 'builtin.func'}}
return
}): () -> ()
return
diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir
index c510ed6..bd422f9 100644
--- a/mlir/test/IR/invalid.mlir
+++ b/mlir/test/IR/invalid.mlir
@@ -355,13 +355,13 @@
func @resulterror() -> i32 {
^bb42:
- return // expected-error {{'std.return' op has 0 operands, but enclosing function (@resulterror) returns 1}}
+ return // expected-error {{'func.return' op has 0 operands, but enclosing function (@resulterror) returns 1}}
}
// -----
func @func_resulterror() -> i32 {
- return // expected-error {{'std.return' op has 0 operands, but enclosing function (@func_resulterror) returns 1}}
+ return // expected-error {{'func.return' op has 0 operands, but enclosing function (@func_resulterror) returns 1}}
}
// -----
@@ -536,7 +536,7 @@
func @return_inside_loop() {
affine.for %i = 1 to 100 {
- // expected-error@-1 {{op expects regions to end with 'affine.yield', found 'std.return'}}
+ // expected-error@-1 {{op expects regions to end with 'affine.yield', found 'func.return'}}
// expected-note@-2 {{in custom textual format, the absence of terminator implies}}
return
}
diff --git a/mlir/test/IR/op-stats.mlir b/mlir/test/IR/op-stats.mlir
index 19a4af2..7f1cd0d 100644
--- a/mlir/test/IR/op-stats.mlir
+++ b/mlir/test/IR/op-stats.mlir
@@ -31,6 +31,6 @@
// CHECK-LABEL: Operations encountered
// CHECK: arith.addf , 6
+// CHECK: func.return , 1
// CHECK: long_op_name , 1
-// CHECK: std.return , 1
// CHECK: xla.add , 17
diff --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir
index 5e47d37..67c18a7 100644
--- a/mlir/test/IR/parser.mlir
+++ b/mlir/test/IR/parser.mlir
@@ -456,11 +456,11 @@
^bb2(%a : i17):
%true = arith.constant true
// CHECK: return %{{.*}}, %{{.*}} : i1, i17
- "std.return"(%true, %a) : (i1, i17) -> ()
+ "func.return"(%true, %a) : (i1, i17) -> ()
^bb3(%b : i1, %c : i17):
// CHECK: return %{{.*}}, %{{.*}} : i1, i17
- "std.return"(%b, %c) : (i1, i17) -> ()
+ "func.return"(%b, %c) : (i1, i17) -> ()
}
// CHECK-LABEL: func @condbr_simple
@@ -1276,17 +1276,11 @@
// example.
// CHECK: "test.op_with_attr"() {test.attr = "test.value"} : () -> ()
"test.op_with_attr"() {test.attr = "test.value"} : () -> ()
-
- // TODO: remove this after removing the special casing for std in the printer.
- // Verify that operations in the standard dialect keep the `std.` prefix.
- // CHECK: cf.assert
- cf.assert %bool, "Assertion"
"test.terminator"() : ()->()
}
- // The same operation outside of the region does not have an std. prefix.
- // CHECK-NOT: std.assert
+ // The same operation outside of the region does not have an func. prefix.
// CHECK: return
- std.return
+ func.return
}
// CHECK-LABEL: func @unreachable_dominance_violation_ok
diff --git a/mlir/test/IR/print-op-generic.mlir b/mlir/test/IR/print-op-generic.mlir
index 7e90a19..e12eda8 100644
--- a/mlir/test/IR/print-op-generic.mlir
+++ b/mlir/test/IR/print-op-generic.mlir
@@ -9,5 +9,5 @@
// GENERIC: %0 = "test.string_attr_pretty_name"()
return
// CHECK: return
- // GENERIC: "std.return"()
+ // GENERIC: "func.return"()
}
diff --git a/mlir/test/IR/visitors.mlir b/mlir/test/IR/visitors.mlir
index 23903b8..189b305 100644
--- a/mlir/test/IR/visitors.mlir
+++ b/mlir/test/IR/visitors.mlir
@@ -30,7 +30,7 @@
// CHECK: Visiting op 'use1'
// CHECK: Visiting op 'use2'
// CHECK: Visiting op 'use3'
-// CHECK: Visiting op 'std.return'
+// CHECK: Visiting op 'func.return'
// CHECK-LABEL: Block pre-order visits
// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.module'
@@ -53,7 +53,7 @@
// CHECK: Visiting op 'scf.if'
// CHECK: Visiting op 'use3'
// CHECK: Visiting op 'scf.for'
-// CHECK: Visiting op 'std.return'
+// CHECK: Visiting op 'func.return'
// CHECK: Visiting op 'builtin.func'
// CHECK: Visiting op 'builtin.module'
@@ -73,7 +73,7 @@
// CHECK-LABEL: Op pre-order erasures
// CHECK: Erasing op 'scf.for'
-// CHECK: Erasing op 'std.return'
+// CHECK: Erasing op 'func.return'
// CHECK-LABEL: Block pre-order erasures
// CHECK: Erasing block ^bb0 from region 0 from operation 'scf.for'
@@ -85,7 +85,7 @@
// CHECK: Erasing op 'scf.if'
// CHECK: Erasing op 'use3'
// CHECK: Erasing op 'scf.for'
-// CHECK: Erasing op 'std.return'
+// CHECK: Erasing op 'func.return'
// CHECK-LABEL: Block post-order erasures (skip)
// CHECK: Erasing block ^bb0 from region 0 from operation 'scf.if'
@@ -99,7 +99,7 @@
// CHECK: Erasing op 'scf.if'
// CHECK: Erasing op 'use3'
// CHECK: Erasing op 'scf.for'
-// CHECK: Erasing op 'std.return'
+// CHECK: Erasing op 'func.return'
// CHECK: Erasing op 'builtin.func'
// CHECK: Erasing op 'builtin.module'
@@ -135,7 +135,7 @@
// CHECK: Visiting op 'op1'
// CHECK: Visiting op 'cf.br'
// CHECK: Visiting op 'op2'
-// CHECK: Visiting op 'std.return'
+// CHECK: Visiting op 'func.return'
// CHECK-LABEL: Block pre-order visits
// CHECK: Visiting block ^bb0 from region 0 from operation 'builtin.module'
@@ -156,7 +156,7 @@
// CHECK: Visiting op 'cf.br'
// CHECK: Visiting op 'op2'
// CHECK: Visiting op 'regionOp0'
-// CHECK: Visiting op 'std.return'
+// CHECK: Visiting op 'func.return'
// CHECK: Visiting op 'builtin.func'
// CHECK: Visiting op 'builtin.module'
@@ -174,7 +174,7 @@
// CHECK-LABEL: Op pre-order erasures (skip)
// CHECK: Erasing op 'regionOp0'
-// CHECK: Erasing op 'std.return'
+// CHECK: Erasing op 'func.return'
// CHECK-LABEL: Block pre-order erasures (skip)
// CHECK: Erasing block ^bb0 from region 0 from operation 'regionOp0'
@@ -188,7 +188,7 @@
// CHECK: Erasing op 'cf.br'
// CHECK: Erasing op 'op2'
// CHECK: Erasing op 'regionOp0'
-// CHECK: Erasing op 'std.return'
+// CHECK: Erasing op 'func.return'
// CHECK-LABEL: Block post-order erasures (skip)
// CHECK: Erasing block ^bb0 from region 0 from operation 'regionOp0'
@@ -202,7 +202,7 @@
// CHECK: Erasing op 'cf.br'
// CHECK: Erasing op 'op2'
// CHECK: Erasing op 'regionOp0'
-// CHECK: Erasing op 'std.return'
+// CHECK: Erasing op 'func.return'
// CHECK-LABEL: Block post-order erasures (no skip)
// CHECK: Erasing block ^bb0 from region 0 from operation 'regionOp0'
diff --git a/mlir/test/Integration/Dialect/SparseTensor/python/test_stress.py b/mlir/test/Integration/Dialect/SparseTensor/python/test_stress.py
index 7958e76..2afcf55 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/python/test_stress.py
+++ b/mlir/test/Integration/Dialect/SparseTensor/python/test_stress.py
@@ -16,7 +16,7 @@
from mlir.execution_engine import ExecutionEngine
from mlir.dialects import builtin
-from mlir.dialects import std
+from mlir.dialects import func
from mlir.dialects import sparse_tensor as st
_SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
@@ -122,7 +122,7 @@
st.ReleaseOp(v.result)
v = w
self._assertEqualsRoundtripTp(v.result.type)
- std.ReturnOp(v)
+ func.ReturnOp(v)
return self
def writeTo(self, filename):
diff --git a/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py b/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
index 3a936e6..e93c934 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
+++ b/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco.py
@@ -34,8 +34,8 @@
from mlir import runtime
from mlir.dialects import arith
from mlir.dialects import builtin
+from mlir.dialects import func
from mlir.dialects import linalg
-from mlir.dialects import std
from mlir.dialects import sparse_tensor
from mlir.dialects.linalg.opdsl import lang
diff --git a/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_utils.py b/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_utils.py
index 4236d71..90a12cc 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_utils.py
+++ b/mlir/test/Integration/Dialect/SparseTensor/taco/tools/mlir_pytaco_utils.py
@@ -314,7 +314,7 @@
func @{_ENTRY_NAME}(%t: tensor<{shape}x{type}, #enc>, %filename: !Ptr)
attributes {{ llvm.emit_c_interface }} {{
sparse_tensor.out %t, %filename : tensor<{shape}x{type}, #enc>, !Ptr
- std.return
+ func.return
}}"""
diff --git a/mlir/test/Transforms/test-legalizer.mlir b/mlir/test/Transforms/test-legalizer.mlir
index 556e820..59a8929 100644
--- a/mlir/test/Transforms/test-legalizer.mlir
+++ b/mlir/test/Transforms/test-legalizer.mlir
@@ -4,7 +4,7 @@
func @verifyDirectPattern() -> i32 {
// CHECK-NEXT: "test.legal_op_a"() {status = "Success"}
%result = "test.illegal_op_a"() : () -> (i32)
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return %result : i32
}
@@ -12,7 +12,7 @@
func @verifyLargerBenefit() -> i32 {
// CHECK-NEXT: "test.legal_op_a"() {status = "Success"}
%result = "test.illegal_op_c"() : () -> (i32)
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return %result : i32
}
@@ -29,7 +29,7 @@
func @remap_call_1_to_1(%arg0: i64) {
// CHECK-NEXT: call @remap_input_1_to_1(%arg0) : (f64) -> ()
call @remap_input_1_to_1(%arg0) : (i64) -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -78,7 +78,7 @@
// CHECK-NEXT: "test.valid"{{.*}} : (i64, i64)
"test.invalid"(%i0, %i1) : (i64, i64) -> ()
}) : () -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -92,7 +92,7 @@
^bb1(%i0: i64, %unused: i16, %i1: i64, %2: f32):
"test.invalid"(%i0, %i1, %2) : (i64, i64, f32) -> ()
}) : () -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -106,7 +106,7 @@
^bb1(%i0: i64, %unused: i16, %i1: i64, %2: f32):
"test.invalid"(%i0, %i1, %2) : (i64, i64, f32) -> ()
}) {legalizer.should_clone} : () -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -118,7 +118,7 @@
^bb1(%i0: i64, %unused: i16, %i1: i64, %2: f32):
"test.invalid"(%i0, %i1, %2) : (i64, i64, f32) -> ()
}) : () -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -135,7 +135,7 @@
// CHECK-NEXT: return
%repl_1 = "test.rewrite"(%arg) : (i8) -> i8
%repl_2 = "test.rewrite"(%repl_1) : (i8) -> i8
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return %repl_2 : i8
}
@@ -146,7 +146,7 @@
%0 = "test.op_with_region_fold"(%arg0) ({
"foo.op_with_region_terminator"() : () -> ()
}) : (i32) -> (i32)
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return %0 : i32
}
@@ -157,7 +157,7 @@
// CHECK: ^{{.*}}(%{{.*}}: i32, %{{.*}}: i32):
"test.create_block"() : () -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -165,7 +165,7 @@
func @bounded_recursion() {
// CHECK: test.recursive_rewrite 0
test.recursive_rewrite 3
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -227,7 +227,7 @@
// expected-remark@+1 {{op 'test.create_illegal_block' is not legalizable}}
"test.create_illegal_block"() : () -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -243,7 +243,7 @@
"test.return"(%arg0) : (i32) -> ()
}) : () -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -279,7 +279,7 @@
func @undo_child_created_before_parent() {
// expected-remark@+1 {{is not legalizable}}
"test.illegal_op_with_region_anchor"() : () -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
@@ -291,7 +291,7 @@
func @blackhole() {
%input = "test.blackhole_producer"() : () -> (i32)
"test.blackhole"(%input) : (i32) -> ()
- // expected-remark@+1 {{op 'std.return' is not legalizable}}
+ // expected-remark@+1 {{op 'func.return' is not legalizable}}
return
}
diff --git a/mlir/test/lib/Conversion/StandardToLLVM/TestConvertCallOp.cpp b/mlir/test/lib/Conversion/StandardToLLVM/TestConvertCallOp.cpp
index dbe2a74..9969678 100644
--- a/mlir/test/lib/Conversion/StandardToLLVM/TestConvertCallOp.cpp
+++ b/mlir/test/lib/Conversion/StandardToLLVM/TestConvertCallOp.cpp
@@ -10,8 +10,8 @@
#include "TestTypes.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
using namespace mlir;
@@ -40,7 +40,7 @@
}
StringRef getArgument() const final { return "test-convert-call-op"; }
StringRef getDescription() const final {
- return "Tests conversion of `std.call` to `llvm.call` in "
+ return "Tests conversion of `func.call` to `llvm.call` in "
"presence of custom types";
}
@@ -65,7 +65,7 @@
ConversionTarget target(getContext());
target.addLegalDialect<LLVM::LLVMDialect>();
target.addIllegalDialect<test::TestDialect>();
- target.addIllegalDialect<StandardOpsDialect>();
+ target.addIllegalDialect<func::FuncDialect>();
if (failed(applyPartialConversion(m, target, std::move(patterns))))
signalPassFailure();
diff --git a/mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp b/mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp
index 592f41e..30a2e09 100644
--- a/mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp
@@ -14,7 +14,7 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/LoopFusionUtils.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Pass/Pass.h"
#define DEBUG_TYPE "test-loop-fusion"
diff --git a/mlir/test/lib/Dialect/CMakeLists.txt b/mlir/test/lib/Dialect/CMakeLists.txt
index 87078f8..4f5bbfb 100644
--- a/mlir/test/lib/Dialect/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/CMakeLists.txt
@@ -1,5 +1,6 @@
add_subdirectory(Affine)
add_subdirectory(DLTI)
+add_subdirectory(Func)
add_subdirectory(GPU)
add_subdirectory(Linalg)
add_subdirectory(Math)
@@ -7,7 +8,6 @@
add_subdirectory(SCF)
add_subdirectory(Shape)
add_subdirectory(SPIRV)
-add_subdirectory(StandardOps)
add_subdirectory(Tensor)
add_subdirectory(Test)
add_subdirectory(Tosa)
diff --git a/mlir/test/lib/Dialect/StandardOps/CMakeLists.txt b/mlir/test/lib/Dialect/Func/CMakeLists.txt
similarity index 68%
rename from mlir/test/lib/Dialect/StandardOps/CMakeLists.txt
rename to mlir/test/lib/Dialect/Func/CMakeLists.txt
index b85de09..4320ffa 100644
--- a/mlir/test/lib/Dialect/StandardOps/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/Func/CMakeLists.txt
@@ -1,5 +1,5 @@
# Exclude tests from libMLIR.so
-add_mlir_library(MLIRStandardOpsTestPasses
+add_mlir_library(MLIRFuncTestPasses
TestDecomposeCallGraphTypes.cpp
EXCLUDE_FROM_LIBMLIR
@@ -7,12 +7,12 @@
LINK_LIBS PUBLIC
MLIRAffine
MLIRPass
- MLIRStandardOpsTransforms
+ MLIRFuncTransforms
MLIRTestDialect
MLIRTransformUtils
)
-target_include_directories(MLIRStandardOpsTestPasses
+target_include_directories(MLIRFuncTestPasses
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../Test
${CMAKE_CURRENT_BINARY_DIR}/../Test
diff --git a/mlir/test/lib/Dialect/StandardOps/TestDecomposeCallGraphTypes.cpp b/mlir/test/lib/Dialect/Func/TestDecomposeCallGraphTypes.cpp
similarity index 91%
rename from mlir/test/lib/Dialect/StandardOps/TestDecomposeCallGraphTypes.cpp
rename to mlir/test/lib/Dialect/Func/TestDecomposeCallGraphTypes.cpp
index c6d61d9..9236f82 100644
--- a/mlir/test/lib/Dialect/StandardOps/TestDecomposeCallGraphTypes.cpp
+++ b/mlir/test/lib/Dialect/Func/TestDecomposeCallGraphTypes.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "TestDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h"
#include "mlir/IR/Builders.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -43,11 +43,11 @@
target.addLegalDialect<test::TestDialect>();
- target.addDynamicallyLegalOp<ReturnOp>([&](ReturnOp op) {
+ target.addDynamicallyLegalOp<func::ReturnOp>([&](func::ReturnOp op) {
return typeConverter.isLegal(op.getOperandTypes());
});
- target.addDynamicallyLegalOp<CallOp>(
- [&](CallOp op) { return typeConverter.isLegal(op); });
+ target.addDynamicallyLegalOp<func::CallOp>(
+ [&](func::CallOp op) { return typeConverter.isLegal(op); });
target.addDynamicallyLegalOp<FuncOp>([&](FuncOp op) {
return typeConverter.isSignatureLegal(op.getType());
});
diff --git a/mlir/test/lib/Dialect/GPU/CMakeLists.txt b/mlir/test/lib/Dialect/GPU/CMakeLists.txt
index a3cf36b..97fc669 100644
--- a/mlir/test/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/GPU/CMakeLists.txt
@@ -10,6 +10,7 @@
LINK_LIBS PUBLIC
MLIRAffine
+ MLIRFunc
MLIRGPUOps
MLIRGPUToGPURuntimeTransforms
MLIRLLVMToLLVMIRTranslation
@@ -19,6 +20,5 @@
MLIRROCDLIR
MLIRROCDLToLLVMIRTranslation
MLIRSCF
- MLIRStandard
MLIRTransformUtils
)
diff --git a/mlir/test/lib/Dialect/GPU/TestGpuMemoryPromotion.cpp b/mlir/test/lib/Dialect/GPU/TestGpuMemoryPromotion.cpp
index 6c3e6ff..b9c4035 100644
--- a/mlir/test/lib/Dialect/GPU/TestGpuMemoryPromotion.cpp
+++ b/mlir/test/lib/Dialect/GPU/TestGpuMemoryPromotion.cpp
@@ -12,12 +12,12 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/MemoryPromotion.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Attributes.h"
#include "mlir/Pass/Pass.h"
@@ -32,7 +32,7 @@
: public PassWrapper<TestGpuMemoryPromotionPass,
OperationPass<gpu::GPUFuncOp>> {
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<AffineDialect, memref::MemRefDialect, StandardOpsDialect,
+ registry.insert<AffineDialect, func::FuncDialect, memref::MemRefDialect,
scf::SCFDialect>();
}
StringRef getArgument() const final { return "test-gpu-memory-promotion"; }
diff --git a/mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp b/mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp
index 4d45c49..0a68509 100644
--- a/mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp
+++ b/mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp
@@ -11,9 +11,9 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
@@ -23,7 +23,7 @@
struct TestGpuRewritePass
: public PassWrapper<TestGpuRewritePass, OperationPass<ModuleOp>> {
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<arith::ArithmeticDialect, StandardOpsDialect,
+ registry.insert<arith::ArithmeticDialect, func::FuncDialect,
memref::MemRefDialect>();
}
StringRef getArgument() const final { return "test-gpu-rewrite"; }
diff --git a/mlir/test/lib/Dialect/Linalg/CMakeLists.txt b/mlir/test/lib/Dialect/Linalg/CMakeLists.txt
index 1fe3db2..56879a1 100644
--- a/mlir/test/lib/Dialect/Linalg/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/Linalg/CMakeLists.txt
@@ -16,6 +16,8 @@
MLIRArithmeticTransforms
MLIRBufferization
MLIRBufferizationTransforms
+ MLIRFunc
+ MLIRFuncTransforms
MLIRGPUTransforms
MLIRLinalg
MLIRLinalgTransforms
@@ -24,8 +26,6 @@
MLIRPass
MLIRSCF
MLIRSCFTransforms
- MLIRStandard
- MLIRStandardOpsTransforms
MLIRTensor
MLIRTensorTransforms
MLIRTransformUtils
diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp
index 3c0249e4..7e4ed8f 100644
--- a/mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp
+++ b/mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp
@@ -13,11 +13,11 @@
#include <utility>
#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/CodegenStrategy.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
@@ -41,11 +41,11 @@
void getDependentDialects(DialectRegistry ®istry) const override {
// clang-format off
registry.insert<AffineDialect,
+ func::FuncDialect,
gpu::GPUDialect,
linalg::LinalgDialect,
memref::MemRefDialect,
scf::SCFDialect,
- StandardOpsDialect,
vector::VectorDialect>();
// clang-format on
}
diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp
index f8a39b0..d2784b6 100644
--- a/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp
+++ b/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp
@@ -114,8 +114,8 @@
: public PassWrapper<TestLinalgFusionTransforms<LoopType>,
OperationPass<FuncOp>> {
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<AffineDialect, linalg::LinalgDialect, memref::MemRefDialect,
- scf::SCFDialect, StandardOpsDialect>();
+ registry.insert<AffineDialect, func::FuncDialect, linalg::LinalgDialect,
+ memref::MemRefDialect, scf::SCFDialect>();
}
TestLinalgFusionTransforms() = default;
TestLinalgFusionTransforms(const TestLinalgFusionTransforms &pass) {}
diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
index 6f3d7c9..1eb1634 100644
--- a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
+++ b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
@@ -12,6 +12,7 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Passes.h"
@@ -19,7 +20,6 @@
#include "mlir/Dialect/Linalg/Transforms/Hoisting.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
@@ -39,9 +39,9 @@
void getDependentDialects(DialectRegistry ®istry) const override {
// clang-format off
registry.insert<AffineDialect,
+ func::FuncDialect,
memref::MemRefDialect,
scf::SCFDialect,
- StandardOpsDialect,
linalg::LinalgDialect,
vector::VectorDialect,
gpu::GPUDialect>();
diff --git a/mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp b/mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp
index 120c44e..7194c36 100644
--- a/mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp
+++ b/mlir/test/lib/Dialect/SCF/TestLoopUnrolling.cpp
@@ -11,9 +11,9 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Builders.h"
#include "mlir/Pass/Pass.h"
@@ -49,7 +49,7 @@
}
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<arith::ArithmeticDialect, StandardOpsDialect>();
+ registry.insert<arith::ArithmeticDialect, func::FuncDialect>();
}
void runOnOperation() override {
diff --git a/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp b/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp
index 0feb3e0..e9d89f1 100644
--- a/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp
+++ b/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp
@@ -11,10 +11,10 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
@@ -146,7 +146,7 @@
}
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<arith::ArithmeticDialect, StandardOpsDialect>();
+ registry.insert<arith::ArithmeticDialect, func::FuncDialect>();
}
void runOnOperation() override {
diff --git a/mlir/test/lib/Dialect/Test/CMakeLists.txt b/mlir/test/lib/Dialect/Test/CMakeLists.txt
index 06fd280..de0e6d2 100644
--- a/mlir/test/lib/Dialect/Test/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/Test/CMakeLists.txt
@@ -59,6 +59,8 @@
MLIRDerivedAttributeOpInterface
MLIRDialect
MLIRDLTI
+ MLIRFunc
+ MLIRFuncTransforms
MLIRIR
MLIRInferTypeOpInterface
MLIRLinalg
@@ -66,8 +68,6 @@
MLIRLLVMIR
MLIRPass
MLIRReduce
- MLIRStandard
- MLIRStandardOpsTransforms
MLIRTensor
MLIRTransformUtils
MLIRTransforms
diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp
index f3f4d54..e0c5eea 100644
--- a/mlir/test/lib/Dialect/Test/TestDialect.cpp
+++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp
@@ -12,7 +12,7 @@
#include "TestTypes.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/DLTI/DLTI.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/DialectImplementation.h"
@@ -368,8 +368,8 @@
LogicalResult matchAndRewrite(FoldToCallOp op,
PatternRewriter &rewriter) const override {
- rewriter.replaceOpWithNewOp<CallOp>(op, TypeRange(), op.getCalleeAttr(),
- ValueRange());
+ rewriter.replaceOpWithNewOp<func::CallOp>(op, TypeRange(),
+ op.getCalleeAttr(), ValueRange());
return success();
}
};
diff --git a/mlir/test/lib/Dialect/Test/TestPatterns.cpp b/mlir/test/lib/Dialect/Test/TestPatterns.cpp
index 5e0c253..69ad6ab 100644
--- a/mlir/test/lib/Dialect/Test/TestPatterns.cpp
+++ b/mlir/test/lib/Dialect/Test/TestPatterns.cpp
@@ -9,8 +9,8 @@
#include "TestDialect.h"
#include "TestTypes.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
-#include "mlir/Dialect/StandardOps/Transforms/FuncConversions.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Pass/Pass.h"
@@ -642,7 +642,7 @@
TestLegalizePatternDriver(ConversionMode mode) : mode(mode) {}
void getDependentDialects(DialectRegistry ®istry) const override {
- registry.insert<StandardOpsDialect>();
+ registry.insert<func::FuncDialect>();
}
void runOnOperation() override {
@@ -679,8 +679,8 @@
return converter.isSignatureLegal(op.getType()) &&
converter.isLegal(&op.getBody());
});
- target.addDynamicallyLegalOp<CallOp>(
- [&](CallOp op) { return converter.isLegal(op); });
+ target.addDynamicallyLegalOp<func::CallOp>(
+ [&](func::CallOp op) { return converter.isLegal(op); });
// TestCreateUnregisteredOp creates `arith.constant` operation,
// which was not added to target intentionally to test
diff --git a/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp b/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
index ba37c0f..974c3da 100644
--- a/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
+++ b/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
diff --git a/mlir/test/lib/Dialect/Vector/CMakeLists.txt b/mlir/test/lib/Dialect/Vector/CMakeLists.txt
index 7629595..595bf54 100644
--- a/mlir/test/lib/Dialect/Vector/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/Vector/CMakeLists.txt
@@ -7,13 +7,13 @@
LINK_LIBS PUBLIC
MLIRAffine
MLIRAnalysis
+ MLIRFunc
MLIRLinalg
MLIRLinalgTransforms
MLIRLLVMIR
MLIRMemRef
MLIRPass
MLIRSCF
- MLIRStandard
MLIRTransformUtils
MLIRVector
MLIRVectorToSCF
diff --git a/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp b/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp
index 1791768..67e33d3a 100644
--- a/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp
+++ b/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp
@@ -10,13 +10,13 @@
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/SCF.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
@@ -391,7 +391,7 @@
type.getNumElements() % multiplicity != 0)
return mlir::WalkResult::advance();
auto filterAlloc = [](Operation *op) {
- return !isa<arith::ConstantOp, memref::AllocOp, CallOp>(op);
+ return !isa<arith::ConstantOp, memref::AllocOp, func::CallOp>(op);
};
auto dependentOps = getSlice(op, filterAlloc);
// Create a loop and move instructions from the Op slice into the loop.
diff --git a/mlir/test/lib/IR/TestMatchers.cpp b/mlir/test/lib/IR/TestMatchers.cpp
index f76078f..4f8d97f 100644
--- a/mlir/test/lib/IR/TestMatchers.cpp
+++ b/mlir/test/lib/IR/TestMatchers.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/test/lib/IR/TestOperationEquals.cpp b/mlir/test/lib/IR/TestOperationEquals.cpp
index dc655ab..ede4da7 100644
--- a/mlir/test/lib/IR/TestOperationEquals.cpp
+++ b/mlir/test/lib/IR/TestOperationEquals.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/test/lib/IR/TestPrintDefUse.cpp b/mlir/test/lib/IR/TestPrintDefUse.cpp
index 8a854e6..bb180e0 100644
--- a/mlir/test/lib/IR/TestPrintDefUse.cpp
+++ b/mlir/test/lib/IR/TestPrintDefUse.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/test/lib/IR/TestPrintNesting.cpp b/mlir/test/lib/IR/TestPrintNesting.cpp
index e2841fe..f50d917 100644
--- a/mlir/test/lib/IR/TestPrintNesting.cpp
+++ b/mlir/test/lib/IR/TestPrintNesting.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/test/lib/IR/TestSlicing.cpp b/mlir/test/lib/IR/TestSlicing.cpp
index a253c59..ac40c81 100644
--- a/mlir/test/lib/IR/TestSlicing.cpp
+++ b/mlir/test/lib/IR/TestSlicing.cpp
@@ -11,8 +11,8 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/SliceAnalysis.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/PatternMatch.h"
@@ -39,7 +39,7 @@
getBackwardSlice(op, &slice);
for (Operation *slicedOp : slice)
builder.clone(*slicedOp, mapper);
- builder.create<ReturnOp>(loc);
+ builder.create<func::ReturnOp>(loc);
return success();
}
diff --git a/mlir/test/lib/Transforms/TestInlining.cpp b/mlir/test/lib/Transforms/TestInlining.cpp
index 9e43e80..f4d5eed 100644
--- a/mlir/test/lib/Transforms/TestInlining.cpp
+++ b/mlir/test/lib/Transforms/TestInlining.cpp
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#include "TestDialect.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"
@@ -34,8 +34,9 @@
auto function = getOperation();
// Collect each of the direct function calls within the module.
- SmallVector<CallIndirectOp, 16> callers;
- function.walk([&](CallIndirectOp caller) { callers.push_back(caller); });
+ SmallVector<func::CallIndirectOp, 16> callers;
+ function.walk(
+ [&](func::CallIndirectOp caller) { callers.push_back(caller); });
// Build the inliner interface.
InlinerInterface interface(&getContext());
diff --git a/mlir/test/mlir-opt/commandline.mlir b/mlir/test/mlir-opt/commandline.mlir
index baee3d7..29cef56 100644
--- a/mlir/test/mlir-opt/commandline.mlir
+++ b/mlir/test/mlir-opt/commandline.mlir
@@ -13,6 +13,7 @@
// CHECK-NEXT: complex
// CHECK-NEXT: dlti
// CHECK-NEXT: emitc
+// CHECK-NEXT: func
// CHECK-NEXT: gpu
// CHECK-NEXT: linalg
// CHECK-NEXT: llvm
@@ -28,7 +29,6 @@
// CHECK-NEXT: shape
// CHECK-NEXT: sparse_tensor
// CHECK-NEXT: spv
-// CHECK-NEXT: std
// CHECK-NEXT: tensor
// CHECK-NEXT: test
// CHECK-NEXT: tosa
diff --git a/mlir/test/python/dialects/builtin.py b/mlir/test/python/dialects/builtin.py
index 7caf5b5..d07c094 100644
--- a/mlir/test/python/dialects/builtin.py
+++ b/mlir/test/python/dialects/builtin.py
@@ -2,7 +2,7 @@
from mlir.ir import *
import mlir.dialects.builtin as builtin
-import mlir.dialects.std as std
+import mlir.dialects.func as func
def run(f):
@@ -92,7 +92,7 @@
# CHECK: return %arg1 : f64
@builtin.FuncOp.from_py_func(f32, f64, results=[f64])
def explicit_results(a, b):
- std.ReturnOp([b])
+ func.ReturnOp([b])
print(m)
@@ -125,42 +125,42 @@
f32 = F32Type.get()
tensor_type = RankedTensorType.get((2, 3, 4), f32)
with InsertionPoint.at_block_begin(m.body):
- func = builtin.FuncOp(name="some_func",
+ f = builtin.FuncOp(name="some_func",
type=FunctionType.get(
inputs=[tensor_type, tensor_type],
results=[tensor_type]),
visibility="nested")
# CHECK: Name is: "some_func"
- print("Name is: ", func.name)
+ print("Name is: ", f.name)
# CHECK: Type is: (tensor<2x3x4xf32>, tensor<2x3x4xf32>) -> tensor<2x3x4xf32>
- print("Type is: ", func.type)
+ print("Type is: ", f.type)
# CHECK: Visibility is: "nested"
- print("Visibility is: ", func.visibility)
+ print("Visibility is: ", f.visibility)
try:
- entry_block = func.entry_block
+ entry_block = f.entry_block
except IndexError as e:
# CHECK: External function does not have a body
print(e)
- with InsertionPoint(func.add_entry_block()):
- std.ReturnOp([func.entry_block.arguments[0]])
+ with InsertionPoint(f.add_entry_block()):
+ func.ReturnOp([f.entry_block.arguments[0]])
pass
try:
- func.add_entry_block()
+ f.add_entry_block()
except IndexError as e:
# CHECK: The function already has an entry block!
print(e)
# Try the callback builder and passing type as tuple.
- func = builtin.FuncOp(name="some_other_func",
+ f = builtin.FuncOp(name="some_other_func",
type=([tensor_type, tensor_type], [tensor_type]),
visibility="nested",
- body_builder=lambda func: std.ReturnOp(
- [func.entry_block.arguments[0]]))
+ body_builder=lambda f: func.ReturnOp(
+ [f.entry_block.arguments[0]]))
# CHECK: module {
# CHECK: func nested @some_func(%arg0: tensor<2x3x4xf32>, %arg1: tensor<2x3x4xf32>) -> tensor<2x3x4xf32> {
@@ -181,34 +181,34 @@
f32 = F32Type.get()
f64 = F64Type.get()
with InsertionPoint(module.body):
- func = builtin.FuncOp("some_func", ([f32, f32], [f32, f32]))
- with InsertionPoint(func.add_entry_block()):
- std.ReturnOp(func.arguments)
- func.arg_attrs = ArrayAttr.get([
+ f = builtin.FuncOp("some_func", ([f32, f32], [f32, f32]))
+ with InsertionPoint(f.add_entry_block()):
+ func.ReturnOp(f.arguments)
+ f.arg_attrs = ArrayAttr.get([
DictAttr.get({
"custom_dialect.foo": StringAttr.get("bar"),
"custom_dialect.baz": UnitAttr.get()
}),
DictAttr.get({"custom_dialect.qux": ArrayAttr.get([])})
])
- func.result_attrs = ArrayAttr.get([
+ f.result_attrs = ArrayAttr.get([
DictAttr.get({"custom_dialect.res1": FloatAttr.get(f32, 42.0)}),
DictAttr.get({"custom_dialect.res2": FloatAttr.get(f64, 256.0)})
])
other = builtin.FuncOp("other_func", ([f32, f32], []))
with InsertionPoint(other.add_entry_block()):
- std.ReturnOp([])
+ func.ReturnOp([])
other.arg_attrs = [
DictAttr.get({"custom_dialect.foo": StringAttr.get("qux")}),
DictAttr.get()
]
# CHECK: [{custom_dialect.baz, custom_dialect.foo = "bar"}, {custom_dialect.qux = []}]
- print(func.arg_attrs)
+ print(f.arg_attrs)
# CHECK: [{custom_dialect.res1 = 4.200000e+01 : f32}, {custom_dialect.res2 = 2.560000e+02 : f64}]
- print(func.result_attrs)
+ print(f.result_attrs)
# CHECK: func @some_func(
# CHECK: %[[ARG0:.*]]: f32 {custom_dialect.baz, custom_dialect.foo = "bar"},
diff --git a/mlir/test/python/dialects/std.py b/mlir/test/python/dialects/func.py
similarity index 92%
rename from mlir/test/python/dialects/std.py
rename to mlir/test/python/dialects/func.py
index 2a3b2df..c4d6417f 100644
--- a/mlir/test/python/dialects/std.py
+++ b/mlir/test/python/dialects/func.py
@@ -3,7 +3,7 @@
from mlir.ir import *
from mlir.dialects import arith
from mlir.dialects import builtin
-from mlir.dialects import std
+from mlir.dialects import func
def constructAndPrintInModule(f):
@@ -85,10 +85,10 @@
qux.sym_visibility = StringAttr.get("private")
with InsertionPoint(builtin.FuncOp("caller", ([], [])).add_entry_block()):
- std.CallOp(foo, [])
- std.CallOp([IndexType.get()], "bar", [])
- std.CallOp([F32Type.get()], FlatSymbolRefAttr.get("qux"), [])
- std.ReturnOp([])
+ func.CallOp(foo, [])
+ func.CallOp([IndexType.get()], "bar", [])
+ func.CallOp([F32Type.get()], FlatSymbolRefAttr.get("qux"), [])
+ func.ReturnOp([])
# CHECK: func private @foo()
diff --git a/mlir/test/python/dialects/linalg/opdsl/emit_convolution.py b/mlir/test/python/dialects/linalg/opdsl/emit_convolution.py
index 25a3de0..6e3ba8f 100644
--- a/mlir/test/python/dialects/linalg/opdsl/emit_convolution.py
+++ b/mlir/test/python/dialects/linalg/opdsl/emit_convolution.py
@@ -2,8 +2,8 @@
from mlir.ir import *
from mlir.dialects import builtin
+from mlir.dialects import func
from mlir.dialects import linalg
-from mlir.dialects import std
from mlir.dialects.linalg.opdsl.lang import *
diff --git a/mlir/test/python/dialects/linalg/opdsl/emit_fill.py b/mlir/test/python/dialects/linalg/opdsl/emit_fill.py
index 1a0d08a..814a6d2 100644
--- a/mlir/test/python/dialects/linalg/opdsl/emit_fill.py
+++ b/mlir/test/python/dialects/linalg/opdsl/emit_fill.py
@@ -2,8 +2,8 @@
from mlir.ir import *
from mlir.dialects import builtin
+from mlir.dialects import func
from mlir.dialects import linalg
-from mlir.dialects import std
from mlir.dialects.linalg.opdsl.lang import *
diff --git a/mlir/test/python/dialects/linalg/opdsl/emit_matmul.py b/mlir/test/python/dialects/linalg/opdsl/emit_matmul.py
index 1b31ed0..b3b4537 100644
--- a/mlir/test/python/dialects/linalg/opdsl/emit_matmul.py
+++ b/mlir/test/python/dialects/linalg/opdsl/emit_matmul.py
@@ -2,8 +2,8 @@
from mlir.ir import *
from mlir.dialects import builtin
+from mlir.dialects import func
from mlir.dialects import linalg
-from mlir.dialects import std
from mlir.dialects.linalg.opdsl.lang import *
diff --git a/mlir/test/python/dialects/linalg/opdsl/emit_misc.py b/mlir/test/python/dialects/linalg/opdsl/emit_misc.py
index 8569949..81de8fc 100644
--- a/mlir/test/python/dialects/linalg/opdsl/emit_misc.py
+++ b/mlir/test/python/dialects/linalg/opdsl/emit_misc.py
@@ -2,8 +2,8 @@
from mlir.ir import *
from mlir.dialects import builtin
+from mlir.dialects import func
from mlir.dialects import linalg
-from mlir.dialects import std
from mlir.dialects.linalg.opdsl.lang import *
diff --git a/mlir/test/python/dialects/linalg/opdsl/emit_pooling.py b/mlir/test/python/dialects/linalg/opdsl/emit_pooling.py
index d68b43d..b97b018 100644
--- a/mlir/test/python/dialects/linalg/opdsl/emit_pooling.py
+++ b/mlir/test/python/dialects/linalg/opdsl/emit_pooling.py
@@ -2,8 +2,8 @@
from mlir.ir import *
from mlir.dialects import builtin
+from mlir.dialects import func
from mlir.dialects import linalg
-from mlir.dialects import std
from mlir.dialects.linalg.opdsl.lang import *
diff --git a/mlir/test/python/dialects/linalg/ops.py b/mlir/test/python/dialects/linalg/ops.py
index 08be2cc..6f912c8 100644
--- a/mlir/test/python/dialects/linalg/ops.py
+++ b/mlir/test/python/dialects/linalg/ops.py
@@ -1,10 +1,10 @@
# RUN: %PYTHON %s | FileCheck %s
from mlir.ir import *
-from mlir.dialects import builtin
-from mlir.dialects import linalg
-from mlir.dialects import std
from mlir.dialects import arith
+from mlir.dialects import builtin
+from mlir.dialects import func
+from mlir.dialects import linalg
from mlir.dialects.linalg.opdsl.lang import *
diff --git a/mlir/test/python/dialects/memref.py b/mlir/test/python/dialects/memref.py
index f2eda0a..db91767 100644
--- a/mlir/test/python/dialects/memref.py
+++ b/mlir/test/python/dialects/memref.py
@@ -1,7 +1,7 @@
# RUN: %PYTHON %s | FileCheck %s
from mlir.ir import *
-import mlir.dialects.std as std
+import mlir.dialects.func as func
import mlir.dialects.memref as memref
@@ -63,10 +63,10 @@
return
}
""")
- func = module.body.operations[0]
- func_body = func.regions[0].blocks[0]
+ f = module.body.operations[0]
+ func_body = f.regions[0].blocks[0]
with InsertionPoint.at_block_terminator(func_body):
- memref.LoadOp(func.arguments[0], func.arguments[1:])
+ memref.LoadOp(f.arguments[0], f.arguments[1:])
# CHECK: func @f1(%[[ARG0:.*]]: memref<?x?xf32>, %[[ARG1:.*]]: index, %[[ARG2:.*]]: index)
# CHECK: memref.load %[[ARG0]][%[[ARG1]], %[[ARG2]]]
diff --git a/mlir/test/python/dialects/scf.py b/mlir/test/python/dialects/scf.py
index 562356f..f434e80 100644
--- a/mlir/test/python/dialects/scf.py
+++ b/mlir/test/python/dialects/scf.py
@@ -2,8 +2,8 @@
from mlir.ir import *
from mlir.dialects import arith
+from mlir.dialects import func
from mlir.dialects import scf
-from mlir.dialects import std
from mlir.dialects import builtin
@@ -59,16 +59,16 @@
index_type = IndexType.get()
callee = builtin.FuncOp(
"callee", ([], [index_type, index_type]), visibility="private")
- func = builtin.FuncOp("ops_as_arguments", ([], []))
- with InsertionPoint(func.add_entry_block()):
+ f = builtin.FuncOp("ops_as_arguments", ([], []))
+ with InsertionPoint(f.add_entry_block()):
lb = arith.ConstantOp.create_index(0)
ub = arith.ConstantOp.create_index(42)
step = arith.ConstantOp.create_index(2)
- iter_args = std.CallOp(callee, [])
+ iter_args = func.CallOp(callee, [])
loop = scf.ForOp(lb, ub, step, iter_args)
with InsertionPoint(loop.body):
scf.YieldOp(loop.inner_iter_args)
- std.ReturnOp([])
+ func.ReturnOp([])
# CHECK-LABEL: TEST: testOpsAsArguments
diff --git a/mlir/test/python/dialects/vector.py b/mlir/test/python/dialects/vector.py
index b8db940..5c2043e 100644
--- a/mlir/test/python/dialects/vector.py
+++ b/mlir/test/python/dialects/vector.py
@@ -2,7 +2,7 @@
from mlir.ir import *
import mlir.dialects.builtin as builtin
-import mlir.dialects.std as std
+import mlir.dialects.func as func
import mlir.dialects.vector as vector
def run(f):
@@ -40,16 +40,16 @@
mask_type = VectorType.get(vector_type.shape, IntegerType.get_signless(1))
identity_map = AffineMap.get_identity(vector_type.rank)
identity_map_attr = AffineMapAttr.get(identity_map)
- func = builtin.FuncOp("transfer_read",
+ f = builtin.FuncOp("transfer_read",
([memref_type, index_type,
F32Type.get(), mask_type], []))
- with InsertionPoint(func.add_entry_block()):
- A, zero, padding, mask = func.arguments
+ with InsertionPoint(f.add_entry_block()):
+ A, zero, padding, mask = f.arguments
vector.TransferReadOp(vector_type, A, [zero, zero], identity_map_attr,
padding, mask, None)
vector.TransferReadOp(vector_type, A, [zero, zero], identity_map_attr,
padding, None, None)
- std.ReturnOp([])
+ func.ReturnOp([])
# CHECK: @transfer_read(%[[MEM:.*]]: memref<?x?xf32>, %[[IDX:.*]]: index,
# CHECK: %[[PAD:.*]]: f32, %[[MASK:.*]]: vector<2x3xi1>)
diff --git a/mlir/test/python/integration/dialects/linalg/opsrun.py b/mlir/test/python/integration/dialects/linalg/opsrun.py
index c4e580f..54e1c85 100644
--- a/mlir/test/python/integration/dialects/linalg/opsrun.py
+++ b/mlir/test/python/integration/dialects/linalg/opsrun.py
@@ -4,8 +4,8 @@
import sys
from mlir.ir import *
from mlir.dialects import builtin
+from mlir.dialects import func
from mlir.dialects import linalg
-from mlir.dialects import std
from mlir.passmanager import *
from mlir.execution_engine import *
diff --git a/mlir/test/python/ir/blocks.py b/mlir/test/python/ir/blocks.py
index 5aa1bf8..9ccffaeb 100644
--- a/mlir/test/python/ir/blocks.py
+++ b/mlir/test/python/ir/blocks.py
@@ -6,8 +6,7 @@
from mlir.ir import *
from mlir.dialects import builtin
from mlir.dialects import cf
-# Note: std dialect needed for terminators.
-from mlir.dialects import std
+from mlir.dialects import func
def run(f):
@@ -39,7 +38,7 @@
successor_block = entry_block.create_after(i32_arg.type)
with InsertionPoint(successor_block) as successor_ip:
assert successor_ip.block == successor_block
- std.ReturnOp([])
+ func.ReturnOp([])
middle_block = successor_block.create_before(i16_arg.type)
with InsertionPoint(entry_block) as entry_ip:
@@ -63,11 +62,11 @@
module = Module.create()
f32 = F32Type.get()
with InsertionPoint(module.body):
- func = builtin.FuncOp("test", ([f32], []))
- entry_block = Block.create_at_start(func.operation.regions[0], [f32])
+ f = builtin.FuncOp("test", ([f32], []))
+ entry_block = Block.create_at_start(f.operation.regions[0], [f32])
with InsertionPoint(entry_block):
- std.ReturnOp([])
+ func.ReturnOp([])
print(module)
assert module.operation.verify()
- assert func.body.blocks[0] == entry_block
+ assert f.body.blocks[0] == entry_block
diff --git a/mlir/test/python/ir/dialects.py b/mlir/test/python/ir/dialects.py
index 10e1a67..65e81e8 100644
--- a/mlir/test/python/ir/dialects.py
+++ b/mlir/test/python/ir/dialects.py
@@ -16,10 +16,10 @@
@run
def testDialectDescriptor():
ctx = Context()
- d = ctx.get_dialect_descriptor("std")
- # CHECK: <DialectDescriptor std>
+ d = ctx.get_dialect_descriptor("func")
+ # CHECK: <DialectDescriptor func>
print(d)
- # CHECK: std
+ # CHECK: func
print(d.namespace)
try:
_ = ctx.get_dialect_descriptor("not_existing")
@@ -34,8 +34,8 @@
def testUserDialectClass():
ctx = Context()
# Access using attribute.
- d = ctx.dialects.std
- # CHECK: <Dialect std (class mlir.dialects._std_ops_gen._Dialect)>
+ d = ctx.dialects.func
+ # CHECK: <Dialect func (class mlir.dialects._func_ops_gen._Dialect)>
print(d)
try:
_ = ctx.dialects.not_existing
@@ -45,8 +45,8 @@
assert False, "Expected exception"
# Access using index.
- d = ctx.dialects["std"]
- # CHECK: <Dialect std (class mlir.dialects._std_ops_gen._Dialect)>
+ d = ctx.dialects["func"]
+ # CHECK: <Dialect func (class mlir.dialects._func_ops_gen._Dialect)>
print(d)
try:
_ = ctx.dialects["not_existing"]
@@ -56,8 +56,8 @@
assert False, "Expected exception"
# Using the 'd' alias.
- d = ctx.d["std"]
- # CHECK: <Dialect std (class mlir.dialects._std_ops_gen._Dialect)>
+ d = ctx.d["func"]
+ # CHECK: <Dialect func (class mlir.dialects._func_ops_gen._Dialect)>
print(d)
@@ -102,5 +102,5 @@
# CHECK: cf.cond_br: True
print(f"cf.cond_br: {ctx.is_registered_operation('cf.cond_br')}")
- # CHECK: std.not_existing: False
- print(f"std.not_existing: {ctx.is_registered_operation('std.not_existing')}")
+ # CHECK: func.not_existing: False
+ print(f"func.not_existing: {ctx.is_registered_operation('func.not_existing')}")
diff --git a/mlir/test/python/ir/operation.py b/mlir/test/python/ir/operation.py
index 7608bc5..2b63f15 100644
--- a/mlir/test/python/ir/operation.py
+++ b/mlir/test/python/ir/operation.py
@@ -128,7 +128,7 @@
r"""
builtin.module {
builtin.func @f() {
- std.return
+ func.return
}
}
""", ctx)
@@ -564,7 +564,7 @@
# Test get_asm with options.
# CHECK: value = opaque<"elided_large_const", "0xDEADBEEF"> : tensor<4xi32>
- # CHECK: "std.return"(%arg0) : (i32) -> () -:4:7
+ # CHECK: "func.return"(%arg0) : (i32) -> () -:4:7
module.operation.print(
large_elements_limit=2,
enable_debug_info=True,
@@ -587,7 +587,7 @@
""")
print(module)
- # addf should map to a known OpView class in the std dialect.
+ # addf should map to a known OpView class in the arithmetic dialect.
# We know the OpView for it defines an 'lhs' attribute.
addf = module.body.operations[2]
# CHECK: <mlir.dialects._arith_ops_gen._AddFOp object
diff --git a/mlir/test/python/pass_manager.py b/mlir/test/python/pass_manager.py
index e5a4257..3531b05 100644
--- a/mlir/test/python/pass_manager.py
+++ b/mlir/test/python/pass_manager.py
@@ -92,5 +92,5 @@
# CHECK: Operations encountered:
# CHECK: builtin.func , 1
# CHECK: builtin.module , 1
-# CHECK: std.return , 1
+# CHECK: func.return , 1
run(testRunPipeline)
diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index b83548e..34cf3a9 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -15,6 +15,7 @@
MLIRTestStandardToLLVM
MLIRAffineTransformsTestPasses
MLIRDLTITestPasses
+ MLIRFuncTestPasses
MLIRGPUTestPasses
MLIRLinalgTestPasses
MLIRMathTestPasses
@@ -22,7 +23,6 @@
MLIRSCFTestPasses
MLIRShapeTestPasses
MLIRSPIRVTestPasses
- MLIRStandardOpsTestPasses
MLIRTensorTestPasses
MLIRTestAnalysis
MLIRTestDialect
diff --git a/mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
index 9c8ec7e..74bf6db 100644
--- a/mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
@@ -18,6 +18,7 @@
MLIRAnalysis
MLIRArithmetic
MLIRExecutionEngine
+ MLIRFunc
MLIRGPUOps
MLIRIR
MLIRJitRunner
@@ -26,7 +27,6 @@
MLIRMemRef
MLIRParser
MLIRSPIRV
- MLIRStandard
MLIRTargetLLVMIRExport
MLIRTransforms
MLIRTranslation
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
index b386e91..213e460 100644
--- a/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
+++ b/mlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
@@ -16,6 +16,7 @@
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
@@ -23,7 +24,6 @@
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/ExecutionEngine/JitRunner.h"
#include "mlir/ExecutionEngine/OptUtils.h"
#include "mlir/Pass/Pass.h"
@@ -99,7 +99,7 @@
mlir::DialectRegistry registry;
registry.insert<mlir::arith::ArithmeticDialect, mlir::LLVM::LLVMDialect,
mlir::gpu::GPUDialect, mlir::spirv::SPIRVDialect,
- mlir::StandardOpsDialect, mlir::memref::MemRefDialect>();
+ mlir::func::FuncDialect, mlir::memref::MemRefDialect>();
mlir::registerLLVMDialectTranslation(registry);
return mlir::JitRunnerMain(argc, argv, registry, jitRunnerConfig);
diff --git a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
index cde6e1a..5e0ae14 100644
--- a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
@@ -58,6 +58,7 @@
MLIRAnalysis
MLIRArithmetic
MLIRExecutionEngine
+ MLIRFunc
MLIRGPUOps
MLIRIR
MLIRJitRunner
@@ -69,7 +70,6 @@
MLIRParser
MLIRSPIRV
MLIRSPIRVTransforms
- MLIRStandard
MLIRSupport
MLIRTargetLLVMIRExport
MLIRTransforms
diff --git a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
index 1d72c3c..46b6e67 100644
--- a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
+++ b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
@@ -20,6 +20,7 @@
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h"
#include "mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
@@ -28,7 +29,6 @@
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/ExecutionEngine/JitRunner.h"
#include "mlir/ExecutionEngine/OptUtils.h"
#include "mlir/Pass/Pass.h"
@@ -75,7 +75,7 @@
mlir::DialectRegistry registry;
registry.insert<mlir::arith::ArithmeticDialect, mlir::LLVM::LLVMDialect,
mlir::gpu::GPUDialect, mlir::spirv::SPIRVDialect,
- mlir::StandardOpsDialect, mlir::memref::MemRefDialect>();
+ mlir::func::FuncDialect, mlir::memref::MemRefDialect>();
mlir::registerLLVMDialectTranslation(registry);
return mlir::JitRunnerMain(argc, argv, registry, jitRunnerConfig);
diff --git a/mlir/unittests/Conversion/PDLToPDLInterp/CMakeLists.txt b/mlir/unittests/Conversion/PDLToPDLInterp/CMakeLists.txt
index 316003c..aedd185 100644
--- a/mlir/unittests/Conversion/PDLToPDLInterp/CMakeLists.txt
+++ b/mlir/unittests/Conversion/PDLToPDLInterp/CMakeLists.txt
@@ -3,6 +3,6 @@
)
target_link_libraries(MLIRPDLToPDLInterpTests
PRIVATE
- MLIRStandard
+ MLIRFunc
MLIRPDLToPDLInterp
)
diff --git a/mlir/unittests/Interfaces/CMakeLists.txt b/mlir/unittests/Interfaces/CMakeLists.txt
index d86710c..54a6837 100644
--- a/mlir/unittests/Interfaces/CMakeLists.txt
+++ b/mlir/unittests/Interfaces/CMakeLists.txt
@@ -9,7 +9,7 @@
MLIRControlFlowInterfaces
MLIRDataLayoutInterfaces
MLIRDLTI
+ MLIRFunc
MLIRInferTypeOpInterface
MLIRParser
- MLIRStandard
)
diff --git a/mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp b/mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp
index 386253b..c74f76c 100644
--- a/mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp
+++ b/mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp
@@ -8,7 +8,7 @@
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/StandardOps/IR/Ops.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Dialect.h"
@@ -33,7 +33,7 @@
}
)MLIR";
- registry.insert<StandardOpsDialect, arith::ArithmeticDialect>();
+ registry.insert<func::FuncDialect, arith::ArithmeticDialect>();
ctx.appendDialectRegistry(registry);
module = parseSourceString(ir, &ctx);
mapFn = cast<FuncOp>(module->front());
diff --git a/mlir/utils/vim/syntax/mlir.vim b/mlir/utils/vim/syntax/mlir.vim
index 8caa06e..5246aa0 100644
--- a/mlir/utils/vim/syntax/mlir.vim
+++ b/mlir/utils/vim/syntax/mlir.vim
@@ -34,7 +34,6 @@
syn match mlirType /x\s*\zsvector/
" Operations.
-" Standard dialect ops.
" TODO: this list is not exhaustive.
syn keyword mlirOps alloc alloca addf addi and call call_indirect cmpf cmpi
syn keyword mlirOps constant dealloc divf dma_start dma_wait dim exp