8#ifndef MLIR_DIALECT_MPI_IR_UTILS_H_
9#define MLIR_DIALECT_MPI_IR_UTILS_H_
18template <
typename OpT>
21 auto comm = op.getComm();
22 if (!comm.template getDefiningOp<mlir::mpi::CommWorldOp>())
23 return mlir::failure();
29 return mlir::failure();
30 if (!isa<IntegerAttr>(dltiAttr.value()))
31 return op->emitError() <<
"Expected an integer attribute for " << key;
32 Value res = arith::ConstantOp::create(
33 b, op.getLoc(),
b.getI32Type(),
34 b.getI32IntegerAttr(cast<IntegerAttr>(dltiAttr.value()).getInt()));
35 if (
Value retVal = op.getRetval())
36 b.replaceOp(op, {retVal, res});
39 return mlir::success();
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
FailureOr< Attribute > query(Operation *op, ArrayRef< DataLayoutEntryKey > keys, bool emitError=false)
Perform a DLTI-query at op, recursively querying each key of keys on query interface-implementing att...
LogicalResult FoldToDLTIConst(OpT op, const char *key, mlir::PatternRewriter &b)
Include the generated interface declarations.