[Mlir-commits] [mlir] dc07d2c - [MLIR][Presburger] make sample test with integer lexmin use containsPointNoLocal
Arjun P
llvmlistbot at llvm.org
Mon Aug 8 06:46:10 PDT 2022
Author: Arjun P
Date: 2022-08-08T14:46:02+01:00
New Revision: dc07d2c91dfd7f14991d07ef1df5f1f0b19b306d
URL: https://github.com/llvm/llvm-project/commit/dc07d2c91dfd7f14991d07ef1df5f1f0b19b306d
DIFF: https://github.com/llvm/llvm-project/commit/dc07d2c91dfd7f14991d07ef1df5f1f0b19b306d.diff
LOG: [MLIR][Presburger] make sample test with integer lexmin use containsPointNoLocal
IntegerPolyhedron::findIntegerLexmin currently does not return values of
the local ids, so when a test for sampling includes a set with locals, the
result of findIntegerLexmin should be checked using containsPointNoLocal,
not containsPoint.
Added:
Modified:
mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h b/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
index 333669f69c2e1..b6922d9795f4c 100644
--- a/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
+++ b/mlir/include/mlir/Analysis/Presburger/IntegerRelation.h
@@ -336,7 +336,7 @@ class IntegerRelation {
/// additional processing using Simplex for unbounded sets.
///
/// Returns an integer sample point if one exists, or an empty Optional
- /// otherwise.
+ /// otherwise. The returned value also includes values of local ids.
Optional<SmallVector<int64_t, 8>> findIntegerSample() const;
/// Compute an overapproximation of the number of integer points in the
diff --git a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
index d0231a9b5af6c..2ed4cd62b4a09 100644
--- a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
@@ -86,7 +86,7 @@ static void checkSample(bool hasSample, const IntegerPolyhedron &poly,
EXPECT_TRUE(Simplex(poly).isUnbounded());
}
if (maybeLexMin.isBounded()) {
- EXPECT_TRUE(poly.containsPoint(*maybeLexMin));
+ EXPECT_TRUE(poly.containsPointNoLocal(*maybeLexMin));
}
}
break;
@@ -410,6 +410,9 @@ TEST(IntegerPolyhedronTest, FindSampleTest) {
checkSample(true, parsePoly("(x, y, z) : (2 * x - 1 >= 0, x - y - 1 == 0, "
"y - z == 0)"));
+ // Test with a local id.
+ checkSample(true, parsePoly("(x) : (x == 5*(x floordiv 2))"));
+
// Regression tests for the computation of dual coefficients.
checkSample(false, parsePoly("(x, y, z) : ("
"6*x - 4*y + 9*z + 2 >= 0,"
More information about the Mlir-commits
mailing list