This patch refactors the current coalesce implementation. It introduces
the SetCoalescer, a class in which all coalescing functionality lives.
The main advantage over the old design is the fact that the vectors of
constraints do not have to be passed around, but are implemented as
private fields of the SetCoalescer. This will become especially
important once more inequality types are introduced.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Analysis/Presburger/PresburgerSet.h | ||
---|---|---|
114–122 ↗ | (On Diff #414362) | |
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
383 ↗ | (On Diff #414362) | Please add some documentation about what the class does and it's usage. |
383 ↗ | (On Diff #414362) | Can you have the implementations and definitions for this class separate? It makes the class more readable. |
386 ↗ | (On Diff #414362) | const PresburgerSet &s would be better. |
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
---|---|---|
389 ↗ | (On Diff #414827) | I don't think namespace matters, nobody else can access this anyway. |
396–398 ↗ | (On Diff #414827) | |
399 ↗ | (On Diff #414827) | Is this needed? Why can't we just use set.integerPolyhedrons everywhere and return set in the end? (note that it looks a little long now but it will become set.disjuncts everywhere after the other patch lands, which is ok IMO) |
415–427 ↗ | (On Diff #414827) | Please write docs for these members. |
442–457 ↗ | (On Diff #414827) | I feel this looks more like an implementation doc, move it above the impl and just write here that it tries to coalesce pairs of overlapping polys. |
443–445 ↗ | (On Diff #414827) | Don't repeat that redundantIneqsA are the redundant ineqs of a in every declaration doc. Also, some docs still seem to write as though these are given as arguments to the function. Please update all these, and also write what these arrays are just once, at their actual declaration in the class. |
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
---|---|---|
399 ↗ | (On Diff #414827) | AFAIU, this makes coalesce still return a newSet, rather than changing the given set in-place. I felt like changing to in-place is a bit of a subtle change for such a refactoring and it should probably get an own patch. |
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
---|---|---|
399 ↗ | (On Diff #414827) | What I was suggesting was a little different, to operate on the copy of s, i.e., set directly. We don't need another copy newSet of the copy set. But sure, we can do that in another patch. By the way, do we need to store set here or only the PresburgerSpace of set? AFAICT, set is only used at the end of coalesce to know the number of dims? |
Removed the explicit set form the SetCoalescer. It only stores the dimensions and a copy of the disjunct vector now. Updated the documentation to reflect the change and rebased.
Sorry I had to revert, seems like this broke some builds: https://buildkite.com/mlir/mlir-core/builds/21122#964182ab-9f3b-4c5e-a5e9-8dfcc0bf0099
Fixed the build failure. It seems that gcc really wants me to declare the SetCoalescer in the header file, whereas clang does not care.