Skip to content

Commit fa056a8

Browse files
committed
Clarify naming
1 parent c723bd4 commit fa056a8

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

mlir/include/mlir/IR/AffineExpr.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ class AffineExpr {
110110
/// floordiv, ceildiv, and mod is only allowed w.r.t constants.
111111
bool isPureAffine() const;
112112

113-
/// Returns true if this expression is monotonic with respect to the
114-
/// AffineDimExpr, i.e. increasing the value of any AffineDimExpr will never
115-
/// decrease the value of the result.
116-
bool isMonotonic() const;
113+
/// Returns true if this expression is monotonicically increasing with respect
114+
/// to the AffineDimExprs, i.e. increasing the value of any AffineDimExpr will
115+
/// never decrease the value of the result.
116+
bool isMonotonicallyIncreasing() const;
117117

118118
/// Returns the greatest known integral divisor of this affine expression. The
119119
/// result is always positive.

mlir/include/mlir/IR/AffineMap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,9 @@ class AffineMap {
364364
/// Returns true if the AffineMap represents a symbol-less permutation map.
365365
bool isPermutation() const;
366366

367-
// Returns true if every result is monotonic.
368-
bool isMonotonic() const;
367+
// Returns true if every result is monotonically increasing.
368+
// See AffineExpr::isMonotonicallyIncreasing().
369+
bool isComponentWiseMonotonicallyIncreasing() const;
369370

370371
/// Returns the map consisting of the `resultPos` subset.
371372
AffineMap getSubMap(ArrayRef<unsigned> resultPos) const;

mlir/lib/Dialect/Linalg/Utils/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ computeSliceParameters(OpBuilder &builder, Location loc, Value valueToTile,
620620
// The offset & size computation below only handles the case when
621621
// the map is monotonic, i.e. the min and max values are attained at the
622622
// lower and upper bounds of the iteration domain.
623-
if (!isTiled(m, tileSizes) || !m.isMonotonic()) {
623+
if (!isTiled(m, tileSizes) || !m.isComponentWiseMonotonicallyIncreasing()) {
624624
sliceParams.offsets.push_back(builder.getIndexAttr(0));
625625
OpFoldResult dim = createFoldedDimOp(builder, loc, valueToTile, r);
626626
sliceParams.sizes.push_back(dim);

mlir/lib/IR/AffineExpr.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,27 +244,30 @@ static bool isNonNegativeConstant(AffineExpr expr) {
244244
return constant && constant.getValue() >= 0;
245245
}
246246

247-
bool AffineExpr::isMonotonic() const {
247+
bool AffineExpr::isMonotonicallyIncreasing() const {
248248
switch (getKind()) {
249249
case AffineExprKind::SymbolId:
250250
case AffineExprKind::DimId:
251251
case AffineExprKind::Constant:
252252
return true;
253253
case AffineExprKind::Add: {
254254
auto op = llvm::cast<AffineBinaryOpExpr>(*this);
255-
return op.getLHS().isMonotonic() && op.getRHS().isMonotonic();
255+
return op.getLHS().isMonotonicallyIncreasing() &&
256+
op.getRHS().isMonotonicallyIncreasing();
256257
}
257258
case AffineExprKind::Mul: {
258259
// One operand must be a non-negative constant.
259260
auto op = llvm::cast<AffineBinaryOpExpr>(*this);
260-
return op.getLHS().isMonotonic() && op.getRHS().isMonotonic() &&
261+
return op.getLHS().isMonotonicallyIncreasing() &&
262+
op.getRHS().isMonotonicallyIncreasing() &&
261263
(isNonNegativeConstant(op.getLHS()) ||
262264
isNonNegativeConstant(op.getRHS()));
263265
}
264266
case AffineExprKind::FloorDiv:
265267
case AffineExprKind::CeilDiv: {
266268
auto op = llvm::cast<AffineBinaryOpExpr>(*this);
267-
return op.getLHS().isMonotonic() && isNonNegativeConstant(op.getRHS());
269+
return op.getLHS().isMonotonicallyIncreasing() &&
270+
isNonNegativeConstant(op.getRHS());
268271
}
269272
case AffineExprKind::Mod:
270273
return false;

mlir/lib/IR/AffineMap.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,9 @@ bool AffineMap::isPermutation() const {
628628
return isProjectedPermutation();
629629
}
630630

631-
bool AffineMap::isMonotonic() const {
632-
return all_of(getResults(), [](auto expr) { return expr.isMonotonic(); });
631+
bool AffineMap::isComponentWiseMonotonicallyIncreasing() const {
632+
return all_of(getResults(),
633+
[](auto expr) { return expr.isMonotonicallyIncreasing(); });
633634
}
634635

635636
AffineMap AffineMap::getSubMap(ArrayRef<unsigned> resultPos) const {

0 commit comments

Comments
 (0)