[PATCH] D73801: [LoopFission]: Loop Fission Interference Graph (FIG)

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 14:56:37 PST 2020


bmahjour added a comment.

In D73801#1894384 <https://reviews.llvm.org/D73801#1894384>, @Meinersbur wrote:

> Question regarding input dependencies inherited from the DDG:
>
>   for (int i = 0; i < b; ++i) {
>     B[i] = f(A[i-1] + A[i]);
>     C[i] = g(A[i]);
>   }
>
>
> IIUC, the DDG will contain the input dependencies B->C and C->B (loop-carried). Since this results in a cycle, those will be combined in a Pi-node. The FIG treats Pi-nodes atomically, hence will not be able to fission/distribute the loop. Is this correct? Having read-read dependencies in the DDG still feels strange to me.


The dependence graph builder only does edge reversal on ordered dependencies, and since input dependencies are not ordered the above example will not cause a cycle since all input dependence edges flow from the first statement to the second (there will be no back edge). 
While I think input dependencies can cause cycles in theory, I don't think they'll be common in our LLVM implementation because the dependencies are modeled at a higher granularity than statement level. I tried to engineer an example that would introduce a cycle with input dependency being a critical edge, but I failed. If you have such an example it would be interesting to look at.
Input dependencies may be uninteresting to loop fission (at least for enforcing legality constraints) but would be useful in other cases such as modeling data reuse. In fact loop fission could also use those edges to establish weights on the affinity edges. For that reason I'd argue there is value in keeping them in the DDG, even if it means giving up on some rare opportunities. 
Another possibility might be to have two flavors of the DDG; one that models the input dependencies and one that doesn't, assuming that a motivating case for loop fission can be found.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73801/new/

https://reviews.llvm.org/D73801





More information about the llvm-commits mailing list