22LogicalResult mlir::mpi::ReduceScatterBlockOp::verify() {
25 return emitOpError(
"sendbuf and recvbuf must have the same element type");
37template <
typename OpT>
39 using mlir::OpRewritePattern<OpT>::OpRewritePattern;
41 LogicalResult matchAndRewrite(OpT op,
42 mlir::PatternRewriter &
b)
const override {
43 auto mRef = op.getRef();
44 if (mRef.getType().hasStaticShape()) {
45 return mlir::failure();
47 auto defOp = mRef.getDefiningOp();
48 if (!defOp || !mlir::isa<mlir::memref::CastOp>(defOp)) {
49 return mlir::failure();
51 auto src = mlir::cast<mlir::memref::CastOp>(defOp).getSource();
52 if (!src.getType().hasStaticShape()) {
53 return mlir::failure();
55 op.getRefMutable().assign(src);
56 return mlir::success();
61 using mlir::OpRewritePattern<mlir::mpi::CommRankOp>::OpRewritePattern;
62 LogicalResult matchAndRewrite(mlir::mpi::CommRankOp op,
63 mlir::PatternRewriter &
b)
const override {
69 using mlir::OpRewritePattern<mlir::mpi::CommSizeOp>::OpRewritePattern;
71 LogicalResult matchAndRewrite(mlir::mpi::CommSizeOp op,
72 mlir::PatternRewriter &
b)
const override {
78void mlir::mpi::SendOp::getCanonicalizationPatterns(
80 results.
add<FoldCast<mlir::mpi::SendOp>>(context);
83void mlir::mpi::RecvOp::getCanonicalizationPatterns(
85 results.
add<FoldCast<mlir::mpi::RecvOp>>(context);
88void mlir::mpi::ISendOp::getCanonicalizationPatterns(
90 results.
add<FoldCast<mlir::mpi::ISendOp>>(context);
93void mlir::mpi::IRecvOp::getCanonicalizationPatterns(
95 results.
add<FoldCast<mlir::mpi::IRecvOp>>(context);
98void mlir::mpi::CommRankOp::getCanonicalizationPatterns(
100 results.
add<FoldRank>(context);
103void mlir::mpi::CommSizeOp::getCanonicalizationPatterns(
105 results.
add<FoldSize>(context);
112#define GET_OP_CLASSES
113#include "mlir/Dialect/MPI/IR/MPIOps.cpp.inc"
p<< " : "<< getMemRefType()<< ", "<< getType();}static LogicalResult verifyVectorMemoryOp(Operation *op, MemRefType memrefType, VectorType vectorType) { if(memrefType.getElementType() !=vectorType.getElementType()) return op-> emitOpError("requires memref and vector types of the same elemental type")
Given a list of lists of parsed operands, populates uniqueOperands with unique operands.
static Type getElementType(Type type)
Determine the element type of type.
MLIRContext is the top-level object for a collection of MLIR operations.
RewritePatternSet & add(ConstructorArg &&arg, ConstructorArgs &&...args)
Add an instance of each of the pattern types 'Ts' to the pattern list with the given arguments.
LogicalResult FoldToDLTIConst(OpT op, const char *key, mlir::PatternRewriter &b)
Include the generated interface declarations.
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an...