31 std::nullopt, independencies,
true)))
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();
67 auto newPadOp = b.
create<PadOp>(
68 loc, padOp.getResultType(), padOp.getSource(), newMixedLow, newMixedHigh,
74 ReifyRankedShapedTypeOpInterface reifyShapedTypeInterface =
75 dyn_cast<ReifyRankedShapedTypeOpInterface>(padOp.getOperation());
76 if (
failed(reifyShapedTypeInterface.reifyResultShapes(b, reifiedSizes)))
79 for (int64_t i = 0, e = padOp.getResultType().getRank(); i < e; ++i) {
86 b.
create<affine::AffineApplyOp>(
88 std::initializer_list<Value>{newMixedLow[i].get<Value>(),
89 prevLow.get<Value>()})
93 if (!padOp.getResultType().isDynamicDim(i)) {
94 sizes.push_back(b.
getIndexAttr(padOp.getResultType().getDimSize(i)));
96 sizes.push_back(reifiedSizes[0][i]);
102 return b.
create<ExtractSliceOp>(loc, newPadOp, offsets, sizes, strides)
107 tensor::EmptyOp emptyOp,
118 newSizes.push_back(*ub);
122 if (llvm::equal(emptyOp.getMixedSizes(), newSizes))
123 return emptyOp.getResult();
127 b.
create<EmptyOp>(loc, newSizes, emptyOp.getType().getElementType());
133 .
create<ExtractSliceOp>(loc, newEmptyOp, offsets, emptyOp.getMixedSizes(),
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued.
Attributes are known-constant values of operations.
IntegerAttr getIndexAttr(int64_t value)
AffineExpr getAffineDimExpr(unsigned position)
This class provides support for representing a failure result, or a valid value of type T.
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.
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
This class represents a single result from folding an operation.
OpResult getResult(unsigned idx)
Get the 'idx'th result of this operation.
static LogicalResult computeIndependentBound(AffineMap &resultMap, ValueDimList &mapOperands, presburger::BoundType type, Value value, std::optional< int64_t > dim, 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.
LogicalResult failure(bool isFailure=true)
Utility function to generate a LogicalResult.
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.