23 if (isa<Attribute>(ofr))
25 Value value = cast<Value>(ofr);
43 Value constantPadding = padOp.getConstantPaddingValue();
52 newMixedLow.push_back(*ub);
58 newMixedHigh.push_back(*ub);
62 if (llvm::equal(padOp.getMixedLowPad(), newMixedLow) &&
63 llvm::equal(padOp.getMixedHighPad(), newMixedHigh))
64 return padOp.getResult();
68 PadOp::create(b, loc, padOp.getResultType(), padOp.getSource(),
69 newMixedLow, newMixedHigh, constantPadding,
75 ReifyRankedShapedTypeOpInterface reifyShapedTypeInterface =
76 dyn_cast<ReifyRankedShapedTypeOpInterface>(padOp.getOperation());
77 if (failed(reifyShapedTypeInterface.reifyResultShapes(b, reifiedSizes)))
80 for (int64_t i = 0, e = padOp.getResultType().getRank(); i < e; ++i) {
83 if (isa<Attribute>(prevLow)) {
87 affine::AffineApplyOp::create(
89 std::initializer_list<Value>{cast<Value>(newMixedLow[i]),
90 cast<Value>(prevLow)})
94 if (!padOp.getResultType().isDynamicDim(i)) {
95 sizes.push_back(b.
getIndexAttr(padOp.getResultType().getDimSize(i)));
97 sizes.push_back(reifiedSizes[0][i]);
103 return ExtractSliceOp::create(b, loc, newPadOp, offsets, sizes, strides)
108 tensor::EmptyOp emptyOp,
119 newSizes.push_back(*ub);
123 if (llvm::equal(emptyOp.getMixedSizes(), newSizes))
124 return emptyOp.getResult();
128 EmptyOp::create(b, loc, newSizes, emptyOp.getType().getElementType());
133 return ExtractSliceOp::create(b, loc, newEmptyOp, offsets,
134 emptyOp.getMixedSizes(), strides)
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued.
IntegerAttr getIndexAttr(int64_t value)
AffineExpr getAffineDimExpr(unsigned position)
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
RAII guard to reset the insertion point of the builder when destroyed.
This class helps build Operations.
void setInsertionPoint(Block *block, Block::iterator insertPoint)
Set the insertion point to the specified location.
This class represents a single result from folding an operation.
static LogicalResult computeIndependentBound(AffineMap &resultMap, ValueDimList &mapOperands, presburger::BoundType type, const Variable &var, ValueRange independencies, bool closedUB=false)
Compute a bound in that is independent of all values in independencies.
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
OpFoldResult materializeComputedBound(OpBuilder &b, Location loc, AffineMap boundMap, ArrayRef< std::pair< Value, std::optional< int64_t >>> mapOperands)
Materialize an already computed bound with Affine dialect ops.
FailureOr< Value > buildIndependentOp(OpBuilder &b, tensor::PadOp padOp, ValueRange independencies)
Build a new tensor::PadOp with low/high padding that is independent of all given independencies.
Include the generated interface declarations.
SmallVector< std::pair< Value, std::optional< int64_t > >> ValueDimList