[PATCH] D68205: [ModuloSchedule] Peel out prologs and epilogs, generate actual code

Thomas Raoux via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 21:18:04 PDT 2019


ThomasRaoux added inline comments.


================
Comment at: llvm/lib/CodeGen/ModuloSchedule.cpp:1612-1613
+  //  K[0, 1, 2]     // Kernel runs stages 0, 1, 2
+  //  E0[2] <- P1    // Epilog runs stage 2 only, so the state after is [0].
+  //  E1[1, 2] <- P0 // Epilog 1 moves the last item from stage 0 to stage 2.
+  //
----------------
I think one problem I was running into with this way of generating the epilogue is that instructions of phase 2 will depend of instruction from phase 1 with a distance of 1. So when we peel E0 the phase 2 is using value from phase 1 of K but then when we peel E1 instructions from phase 2 gets a wrong dependency.

Basically the kernel loop like:

K:
%a1 = phi (%ai, %a0)
InstPhase2 %a1
%a0 =  InstPhase1
br K:

when we peel
K:
%a1 = phi (%ai, %a0)
InstPhase2 %a1
%a0 =  InstPhase1;
br p K, E0:
E0:
InstPhase2 %a0
E1:
InstPhase2 ?
%a2 =  InstPhase1


How do we handle that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68205





More information about the llvm-commits mailing list