Commit Graph

13 Commits

Author SHA1 Message Date
Kunwar Shaanjeet Singh Grover dea76ccaf4 [MLIR] FlatAffineConstraints: Refactored computation of explicit representation for identifiers
This patch refactors the existing implementation of computing an explicit
representation of an identifier as a floordiv in terms of other identifiers and
exposes this computation as a public function.

The computation of this representation is required to support local identifiers
in PresburgerSet subtract, complement and isEqual.

Reviewed By: bondhugula, arjunp

Differential Revision: https://reviews.llvm.org/D106662
2021-09-08 20:24:46 +05:30
Matthias Springer c777e51468 [mlir][Analysis][NFC] FlatAffineConstraints: Use BoundType enum in functions
Differential Revision: https://reviews.llvm.org/D108185
2021-08-19 10:33:42 +09:00
Matthias Springer ab03a84e2c [mlir][Analysis][NFC] Disambiguate FlatAffineConstraints constructor
The following constructor call (and others) used to be ambiguous:

```
FlatAffineConstraints constraints(0, 0, 0);
```

Differential Revision: https://reviews.llvm.org/D107726
2021-08-10 10:34:30 +09:00
Kunwar Shaanjeet Singh Grover 7eeaa782c4 [MLIR] FlatAffineConstraints: Fixed bug where some divisions were not being detected
This patch fixes a bug in the existing implementation of detectAsFloorDiv,
where floordivs with numerator with non-zero constant term and floordivs with
numerator only consisting of a constant term were not being detected.

Reviewed By: vinayaka-polymage

Differential Revision: https://reviews.llvm.org/D107214
2021-08-02 17:51:48 +05:30
Arjun P c605dfcfc0 [MLIR] FlatAffineConstraints: Use Matrix objects to store the constraints
This results in significant deduplication of code. This patch is not expected to change any functionality, it's just some simplification in preparation for future work. Also slightly simplified some code that was being touched anyway and added some unit tests for some functions that were touched.

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D105152
2021-07-01 22:05:31 +05:30
Arjun P 2690d4d45a [MLIR] Support symbols in emptiness checks for FlatAffineConstraints
Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D100114
2021-04-08 21:38:47 +05:30
Arjun P 14056dfb4d [MLIR] Add support for extracting an integer sample point (if one exists) from an unbounded FlatAffineConstraints.
With this, we have complete support for finding integer sample points in FlatAffineConstraints.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D95047
2021-01-22 22:28:38 +05:30
Arjun P 9f32f1d6fb [MLIR] Support checking if two FlatAffineConstraints are equal
This patch adds support for checking if two PresburgerSets are equal. In particular, one can check if two FlatAffineConstraints are equal by constructing PrebsurgerSets from them and comparing these.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D94915
2021-01-18 21:46:01 +05:30
Arjun P 6ebeba88f5 Support emptiness checks for unbounded FlatAffineConstraints.
With this, we have complete support for emptiness checks. This also paves the way for future support to check if two FlatAffineConstraints are equal.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D94272
2021-01-14 19:33:37 +01:00
Arjun P 63dead2096 Introduce subtraction for FlatAffineConstraints
Subtraction is a foundational arithmetic operation that is often used when computing, for example, data transfer sets or cache hits. Since the result of subtraction need not be a convex polytope, a new class `PresburgerSet` is introduced to represent unions of convex polytopes.

Reviewed By: ftynse, bondhugula

Differential Revision: https://reviews.llvm.org/D87068
2020-10-07 17:31:06 +02:00
Kazuaki Ishizaki a23d055912 [mlir] NFC: fix trivial typo under test and tools
Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D86648
2020-08-27 15:37:42 +09:00
Arjun P 33f574672f [MLIR] Redundancy detection for FlatAffineConstraints using Simplex
This patch adds the capability to perform constraint redundancy checks for `FlatAffineConstraints` using `Simplex`, via a new member function `FlatAffineConstraints::removeRedundantConstraints`. The pre-existing redundancy detection algorithm runs a full rational emptiness check for each inequality separately for checking redundancy. Leveraging the existing `Simplex` infrastructure, in this patch we have an algorithm for redundancy checks that can check each constraint by performing pivots on the tableau, which provides an alternative to running Fourier-Motzkin elimination for each constraint separately.

Differential Revision: https://reviews.llvm.org/D84935
2020-08-20 13:38:51 +05:30
Arjun P 10a898b3ec [MLIR] Exact integer emptiness checks for FlatAffineConstraints
This patch adds the capability to perform exact integer emptiness checks for FlatAffineConstraints using the General Basis Reduction algorithm (GBR). Previously, only a heuristic was available for emptiness checks, which was not guaranteed to always give a conclusive result.

This patch adds a `Simplex` class, which can be constructed using a `FlatAffineConstraints`, and can find an integer sample point (if one exists) using the GBR algorithm. Additionally, it adds two classes `Matrix` and `Fraction`, which are used by `Simplex`.

The integer emptiness check functionality can be accessed through the new `FlatAffineConstraints::isIntegerEmpty()` function, which runs the existing heuristic first and, if that proves to be inconclusive, runs the GBR algorithm to produce a conclusive result.

Differential Revision: https://reviews.llvm.org/D80860
2020-07-02 19:53:27 +05:30