This patch adds support for applying a relation on domain/range of a relation.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I think we should add a compose member function, it being a natural opreation on relations. You can move applyRange's documentation to compose and just mention in applyRange that it's the same as compose, but provided for uniformity with applyDomain.
| mlir/include/mlir/Analysis/Presburger/IntegerRelation.h | ||
|---|---|---|
| 534–536 | It might be simpler to just say that this returns R2.inverse().compose(R1), and then perhaps provide a concrete example. | |
| 541–543 | You can just write that it returns R1.compose(R2) and mention that this is provided for uniformity with applyDomain. | |
| mlir/include/mlir/Analysis/Presburger/IntegerRelation.h | ||
|---|---|---|
| 534–536 | I feel the R2.invese().compose() makes it harder to understand than providing a proper mathematical description. | |
I think you can remove the backslashes on exists and in, unless doxygen can somehow render them, it seems unnecessary.
| mlir/include/mlir/Analysis/Presburger/IntegerRelation.h | ||
|---|---|---|
| 534–536 | R2.inverse().compose() is in fact a proper mathematical description. For me personally, a concrete example was more useful to understand what the point of this is, and then for a formal specification the inverse compose thing will show what the general version of that example is. | |
| mlir/include/mlir/Analysis/Presburger/IntegerRelation.h | ||
|---|---|---|
| 533 | What do you mean by R1(R2) here? If R3 is A -> C then R3(x) is R2(R1(x)). It seems the standard notation here is R1;R2 (https://en.wikipedia.org/wiki/Composition_of_relations). | |
| 535 | ||
| 536 | ||
| 537 | ||
| 542 | ||
| 543 | read the original as (i->j), k at first | |
| 545 | I would prefer this example, it has less "noise" and also shows a little bit happens when the other variables depend on the projected variable R1 : i -> j : (0 <= i < 2, j = i)
R2: i -> k : (k = i floordiv 2)
R3: k -> j : (0 <= k < 1, 2k <=  j <= 2k + 1)
R1 = {(0, 0), (1, 1)}. R2 maps both 0 and 1 to 0. So R3 = {(0, 0), (0, 1)} | |
| 550–557 | Not sure if an example is needed for composition but you can do e.g. R2 : j -> k : k = floordiv 2 and R1 from above | |
| 552 | ||
| 557 | ||
| mlir/lib/Analysis/Presburger/IntegerRelation.cpp | ||
| 2148–2156 | ||
What do you mean by R1(R2) here? If R3 is A -> C then R3(x) is R2(R1(x)). It seems the standard notation here is R1;R2 (https://en.wikipedia.org/wiki/Composition_of_relations).