[PATCH] D67081: [ModuloSchedule] Introduce PeelingModuloScheduleExpander

Thomas Raoux via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 21:34:40 PDT 2019


ThomasRaoux added inline comments.
Herald added a subscriber: wuzish.


================
Comment at: llvm/lib/CodeGen/ModuloSchedule.cpp:1398
+    // arithmetic. Add NumStages to ConsumerStage so that it is always >
+    // LoopProducerStage, and take the mod NumStages.
+    int NumStages = S.getNumStages();
----------------
Outdated comment?


================
Comment at: llvm/lib/CodeGen/ModuloSchedule.cpp:1400
+    int NumStages = S.getNumStages();
+    int StageDiff = std::max(ConsumerStage - LoopProducerStage, 0);
+    NumPhis = Defaults.size() + StageDiff % NumStages;
----------------
I'm trying to understand this formula. 

For instance, if the ProducerStage is 2 and consumer stage is 0. When we pipeline we would run stage 2 iteration N with stage 0 iteration N+2, in this case wouldn't that mean we want 2 phi to get the value from stage 2 from iteration N? Maybe I'm missing something though.


================
Comment at: llvm/lib/CodeGen/ModuloSchedule.cpp:1401
+    int StageDiff = std::max(ConsumerStage - LoopProducerStage, 0);
+    NumPhis = Defaults.size() + StageDiff % NumStages;
+  }
----------------
Is the modulo needed? Looks like StageDiff should always be < NumStages


================
Comment at: llvm/lib/CodeGen/ModuloSchedule.cpp:1519
+  KernelOperandInfo(MachineOperand *MO, MachineRegisterInfo &MRI,
+                    SmallPtrSetImpl<MachineInstr *> &IllegalPhis)
+      : MRI(MRI) {
----------------
nit: should it be const?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67081





More information about the llvm-commits mailing list