9 #ifndef MLIR_INTERFACES_VALUEBOUNDSOPINTERFACE_H_
10 #define MLIR_INTERFACES_VALUEBOUNDSOPINTERFACE_H_
17 #include "llvm/ADT/SetVector.h"
22 class OffsetSizeAndStrideOpInterface;
96 : cstr(cstr), value(value) {}
106 std::optional<int64_t> dim;
136 std::optional<int64_t> dim,
138 bool closedUB =
false);
147 bool closedUB =
false);
160 std::optional<int64_t> dim,
ValueRange independencies,
161 bool closedUB =
false);
181 std::optional<int64_t> dim = std::nullopt,
183 bool closedUB =
false);
198 std::optional<int64_t> dim1 = std::nullopt,
199 std::optional<int64_t> dim2 = std::nullopt);
207 std::optional<int64_t> dim1 = std::nullopt,
208 std::optional<int64_t> dim2 = std::nullopt);
279 int64_t
getPos(
Value value, std::optional<int64_t> dim = std::nullopt)
const;
288 int64_t
insert(
Value value, std::optional<int64_t> dim,
bool isSymbol =
true);
297 int64_t
insert(
bool isSymbol =
true);
322 #include "mlir/Interfaces/ValueBoundsOpInterface.h.inc"
Base type for affine expression.
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued.
This class is a general helper class for creating context-global objects like types,...
This class provides support for representing a failure result, or a valid value of type T.
FlatLinearConstraints is an extension of IntegerPolyhedron.
A hyperrectangular slice, represented as a list of offsets, sizes and strides.
HyperrectangularSlice(ArrayRef< OpFoldResult > offsets, ArrayRef< OpFoldResult > sizes, ArrayRef< OpFoldResult > strides)
ArrayRef< OpFoldResult > getMixedOffsets() const
ArrayRef< OpFoldResult > getMixedSizes() const
ArrayRef< OpFoldResult > getMixedStrides() const
MLIRContext is the top-level object for a collection of MLIR operations.
This class represents a single result from folding an operation.
Helper class that builds a bound for a shaped value dimension or index-typed value.
BoundBuilder(ValueBoundsConstraintSet &cstr, Value value)
void operator>(AffineExpr expr)
BoundBuilder & operator[](int64_t dim)
Specify a dimension, assuming that the underlying value is a shaped value.
void operator<=(AffineExpr expr)
void operator==(AffineExpr expr)
void operator<(AffineExpr expr)
void operator>=(AffineExpr expr)
A helper class to be used with ValueBoundsOpInterface.
DenseMap< ValueDim, int64_t > valueDimToPosition
Reverse mapping of values/shape dimensions to columns.
static FailureOr< bool > areEqual(Value value1, Value value2, std::optional< int64_t > dim1=std::nullopt, std::optional< int64_t > dim2=std::nullopt)
Compute whether the given values/dimensions are equal.
AffineExpr getExpr(Value value, std::optional< int64_t > dim=std::nullopt)
Return an expression that represents the given index-typed value or shaped value dimension.
SmallVector< std::optional< ValueDim > > positionToValueDim
Mapping of columns to values/shape dimensions.
static LogicalResult computeBound(AffineMap &resultMap, ValueDimList &mapOperands, presburger::BoundType type, Value value, std::optional< int64_t > dim, StopConditionFn stopCondition, bool closedUB=false)
Compute a bound for the given index-typed value or shape dimension size.
int64_t insert(Value value, std::optional< int64_t > dim, bool isSymbol=true)
Insert a value/dimension into the constraint set.
void projectOut(int64_t pos)
Project out the given column in the constraint set.
static FailureOr< int64_t > computeConstantDelta(Value value1, Value value2, std::optional< int64_t > dim1=std::nullopt, std::optional< int64_t > dim2=std::nullopt)
Compute a constant delta between the given two values.
void addBound(presburger::BoundType type, int64_t pos, AffineExpr expr)
Bound the given column in the underlying constraint set by the given expression.
BoundBuilder bound(Value value)
Add a bound for the given index-typed value or shaped value.
int64_t getPos(Value value, std::optional< int64_t > dim=std::nullopt) const
Return the column position of the given value/dimension.
std::queue< int64_t > worklist
Worklist of values/shape dimensions that have not been processed yet.
ValueBoundsConstraintSet(MLIRContext *ctx)
FlatLinearConstraints cstr
Constraint system of equalities and inequalities.
void processWorklist(StopConditionFn stopCondition)
Iteratively process all elements on the worklist until an index-typed value or shaped value meets sto...
static FailureOr< bool > areEquivalentSlices(MLIRContext *ctx, HyperrectangularSlice slice1, HyperrectangularSlice slice2)
Return "true" if the given slices are guaranteed to be equivalent.
std::pair< Value, int64_t > ValueDim
An index-typed value or the dimension of a shaped-type value.
static LogicalResult computeDependentBound(AffineMap &resultMap, ValueDimList &mapOperands, presburger::BoundType type, Value value, std::optional< int64_t > dim, ValueDimList dependencies, bool closedUB=false)
Compute a bound in terms of the values/dimensions in dependencies.
static FailureOr< bool > areOverlappingSlices(MLIRContext *ctx, HyperrectangularSlice slice1, HyperrectangularSlice slice2)
Return "true" if the given slices are guaranteed to be overlapping.
Builder builder
Builder for constructing affine expressions.
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.
static FailureOr< int64_t > computeConstantBound(presburger::BoundType type, Value value, std::optional< int64_t > dim=std::nullopt, StopConditionFn stopCondition=nullptr, bool closedUB=false)
Compute a constant bound for the given affine map, where dims and symbols are bound to the given oper...
static constexpr int64_t kIndexValue
Dimension identifier to indicate a value is index-typed.
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...
BoundType
The type of bound: equal, lower bound or upper bound.
bool operator!=(const Fraction &x, const Fraction &y)
Include the generated interface declarations.
This class represents an efficient way to signal success or failure.