#include "mlir/Interfaces/ValueBoundsOpInterface.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Interfaces/DestinationStyleOpInterface.h"
#include "mlir/Interfaces/ViewLikeInterface.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE …
usingnamespacemlir;
BoundType;
VarKind;
namespace mlir {
#include "mlir/Interfaces/ValueBoundsOpInterface.cpp.inc"
}
static Operation *getOwnerOfValue(Value value) { … }
HyperrectangularSlice::HyperrectangularSlice(ArrayRef<OpFoldResult> offsets,
ArrayRef<OpFoldResult> sizes,
ArrayRef<OpFoldResult> strides)
: … { … }
HyperrectangularSlice::HyperrectangularSlice(ArrayRef<OpFoldResult> offsets,
ArrayRef<OpFoldResult> sizes)
: … { … }
HyperrectangularSlice::HyperrectangularSlice(OffsetSizeAndStrideOpInterface op)
: … { … }
static std::optional<int64_t> getConstantIntValue(OpFoldResult ofr) { … }
ValueBoundsConstraintSet::Variable::Variable(OpFoldResult ofr)
: … { … }
ValueBoundsConstraintSet::Variable::Variable(Value indexValue)
: … { … }
ValueBoundsConstraintSet::Variable::Variable(Value shapedValue, int64_t dim)
: … { … }
ValueBoundsConstraintSet::Variable::Variable(OpFoldResult ofr,
std::optional<int64_t> dim) { … }
ValueBoundsConstraintSet::Variable::Variable(AffineMap map,
ArrayRef<Variable> mapOperands) { … }
ValueBoundsConstraintSet::Variable::Variable(AffineMap map,
ArrayRef<Value> mapOperands)
: … { … }
ValueBoundsConstraintSet::ValueBoundsConstraintSet(
MLIRContext *ctx, StopConditionFn stopCondition,
bool addConservativeSemiAffineBounds)
: … { … }
char ValueBoundsConstraintSet::ID = …;
#ifndef NDEBUG
static void assertValidValueDim(Value value, std::optional<int64_t> dim) {
if (value.getType().isIndex()) {
assert(!dim.has_value() && "invalid dim value");
} else if (auto shapedType = dyn_cast<ShapedType>(value.getType())) {
assert(*dim >= 0 && "invalid dim value");
if (shapedType.hasRank())
assert(*dim < shapedType.getRank() && "invalid dim value");
} else {
llvm_unreachable("unsupported type");
}
}
#endif
void ValueBoundsConstraintSet::addBound(BoundType type, int64_t pos,
AffineExpr expr) { … }
AffineExpr ValueBoundsConstraintSet::getExpr(Value value,
std::optional<int64_t> dim) { … }
AffineExpr ValueBoundsConstraintSet::getExpr(OpFoldResult ofr) { … }
AffineExpr ValueBoundsConstraintSet::getExpr(int64_t constant) { … }
int64_t ValueBoundsConstraintSet::insert(Value value,
std::optional<int64_t> dim,
bool isSymbol, bool addToWorklist) { … }
int64_t ValueBoundsConstraintSet::insert(bool isSymbol) { … }
int64_t ValueBoundsConstraintSet::insert(AffineMap map, ValueDimList operands,
bool isSymbol) { … }
int64_t ValueBoundsConstraintSet::insert(const Variable &var, bool isSymbol) { … }
int64_t ValueBoundsConstraintSet::getPos(Value value,
std::optional<int64_t> dim) const { … }
AffineExpr ValueBoundsConstraintSet::getPosExpr(int64_t pos) { … }
bool ValueBoundsConstraintSet::isMapped(Value value,
std::optional<int64_t> dim) const { … }
void ValueBoundsConstraintSet::processWorklist() { … }
void ValueBoundsConstraintSet::projectOut(int64_t pos) { … }
void ValueBoundsConstraintSet::projectOut(
function_ref<bool(ValueDim)> condition) { … }
void ValueBoundsConstraintSet::projectOutAnonymous(
std::optional<int64_t> except) { … }
LogicalResult ValueBoundsConstraintSet::computeBound(
AffineMap &resultMap, ValueDimList &mapOperands, presburger::BoundType type,
const Variable &var, StopConditionFn stopCondition, bool closedUB) { … }
LogicalResult ValueBoundsConstraintSet::computeDependentBound(
AffineMap &resultMap, ValueDimList &mapOperands, presburger::BoundType type,
const Variable &var, ValueDimList dependencies, bool closedUB) { … }
LogicalResult ValueBoundsConstraintSet::computeIndependentBound(
AffineMap &resultMap, ValueDimList &mapOperands, presburger::BoundType type,
const Variable &var, ValueRange independencies, bool closedUB) { … }
FailureOr<int64_t> ValueBoundsConstraintSet::computeConstantBound(
presburger::BoundType type, const Variable &var,
StopConditionFn stopCondition, bool closedUB) { … }
void ValueBoundsConstraintSet::populateConstraints(Value value,
std::optional<int64_t> dim) { … }
int64_t ValueBoundsConstraintSet::populateConstraints(AffineMap map,
ValueDimList operands) { … }
FailureOr<int64_t>
ValueBoundsConstraintSet::computeConstantDelta(Value value1, Value value2,
std::optional<int64_t> dim1,
std::optional<int64_t> dim2) { … }
bool ValueBoundsConstraintSet::comparePos(int64_t lhsPos,
ComparisonOperator cmp,
int64_t rhsPos) { … }
bool ValueBoundsConstraintSet::populateAndCompare(const Variable &lhs,
ComparisonOperator cmp,
const Variable &rhs) { … }
bool ValueBoundsConstraintSet::compare(const Variable &lhs,
ComparisonOperator cmp,
const Variable &rhs) { … }
FailureOr<bool> ValueBoundsConstraintSet::areEqual(const Variable &var1,
const Variable &var2) { … }
FailureOr<bool>
ValueBoundsConstraintSet::areOverlappingSlices(MLIRContext *ctx,
HyperrectangularSlice slice1,
HyperrectangularSlice slice2) { … }
FailureOr<bool>
ValueBoundsConstraintSet::areEquivalentSlices(MLIRContext *ctx,
HyperrectangularSlice slice1,
HyperrectangularSlice slice2) { … }
void ValueBoundsConstraintSet::dump() const { … }
ValueBoundsConstraintSet::BoundBuilder &
ValueBoundsConstraintSet::BoundBuilder::operator[](int64_t dim) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator<(AffineExpr expr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator<=(AffineExpr expr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator>(AffineExpr expr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator>=(AffineExpr expr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator==(AffineExpr expr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator<(OpFoldResult ofr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator<=(OpFoldResult ofr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator>(OpFoldResult ofr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator>=(OpFoldResult ofr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator==(OpFoldResult ofr) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator<(int64_t i) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator<=(int64_t i) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator>(int64_t i) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator>=(int64_t i) { … }
void ValueBoundsConstraintSet::BoundBuilder::operator==(int64_t i) { … }