Skip to content

Commit dc07d2c

Browse files
committed
[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.
1 parent 3354644 commit dc07d2c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

mlir/include/mlir/Analysis/Presburger/IntegerRelation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class IntegerRelation {
336336
/// additional processing using Simplex for unbounded sets.
337337
///
338338
/// Returns an integer sample point if one exists, or an empty Optional
339-
/// otherwise.
339+
/// otherwise. The returned value also includes values of local ids.
340340
Optional<SmallVector<int64_t, 8>> findIntegerSample() const;
341341

342342
/// Compute an overapproximation of the number of integer points in the

mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void checkSample(bool hasSample, const IntegerPolyhedron &poly,
8686
EXPECT_TRUE(Simplex(poly).isUnbounded());
8787
}
8888
if (maybeLexMin.isBounded()) {
89-
EXPECT_TRUE(poly.containsPoint(*maybeLexMin));
89+
EXPECT_TRUE(poly.containsPointNoLocal(*maybeLexMin));
9090
}
9191
}
9292
break;
@@ -410,6 +410,9 @@ TEST(IntegerPolyhedronTest, FindSampleTest) {
410410
checkSample(true, parsePoly("(x, y, z) : (2 * x - 1 >= 0, x - y - 1 == 0, "
411411
"y - z == 0)"));
412412

413+
// Test with a local id.
414+
checkSample(true, parsePoly("(x) : (x == 5*(x floordiv 2))"));
415+
413416
// Regression tests for the computation of dual coefficients.
414417
checkSample(false, parsePoly("(x, y, z) : ("
415418
"6*x - 4*y + 9*z + 2 >= 0,"

0 commit comments

Comments
 (0)