Skip to content

Commit

Permalink
Review fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
MacDue committed Jul 23, 2024
1 parent 028a4fa commit eff3f64
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions mlir/lib/Dialect/Vector/Transforms/VectorMaskElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,28 @@ LogicalResult resolveAllTrueCreateMaskOp(IRRewriter &rewriter,
for (auto [i, dimSize] : unknownDims) {
// Compute the lower bound for the unknown dimension (i.e. the smallest
// value it could be).
auto lowerBound =
FailureOr<ConstantOrScalableBound> dimLowerBound =
vector::ScalableValueBoundsConstraintSet::computeScalableBound(
dimSize, {}, vscaleRange.vscaleMin, vscaleRange.vscaleMax,
presburger::BoundType::LB);
if (failed(lowerBound))
if (failed(dimLowerBound))
return failure();
auto boundSize = lowerBound->getSize();
if (failed(boundSize))
auto dimLowerBoundSize = dimLowerBound->getSize();
if (failed(dimLowerBoundSize))
return failure();
if (boundSize->scalable) {
// If the lower bound is scalable and >= to the mask dim size then this
// dim is all-true.
if (boundSize->baseSize < maskTypeDimSizes[i])
if (dimLowerBoundSize->scalable) {
// If the lower bound is scalable and < the mask dim size then this dim is
// not all-true.
if (dimLowerBoundSize->baseSize < maskTypeDimSizes[i])
return failure();
} else {
// If the lower bound is a constant and >= to the _fixed-size_ mask dim
// size then this dim is all-true.
// If the lower bound is a constant:
// - If the mask dim size is scalable then this dim is not all-true.
if (maskTypeDimScalableFlags[i])
return failure();
if (boundSize->baseSize < maskTypeDimSizes[i])
// - If the lower bound is < the _fixed-size_ mask dim size then this dim
// is not all-true.
if (dimLowerBoundSize->baseSize < maskTypeDimSizes[i])
return failure();
}
}
Expand Down

0 comments on commit eff3f64

Please sign in to comment.