[PATCH] D16829: An implementation of Swing Modulo Scheduling

Brendon Cahoon via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 15:53:37 PST 2016


bcahoon added inline comments.

================
Comment at: lib/CodeGen/MachinePipeliner.cpp:1382
@@ +1381,3 @@
+
+/// Calculate the resource constrained minimum initiation interval for the
+/// specified loop. We use the DFA to model the resources needed for
----------------
marksl wrote:
> If you have a functional unit that issues in stages such that another instruction of needing the same FU can ussue the very next cycle, then isn't the sum of the cycles too great?  Example:
> 
> InstrItinData<IIC_MUL_rr,    [InstrStage<1, [MUL_DSP_STAGE1]>,InstrStage<1, [MUL_DSP_STAGE2]>,InstrStage<1, [MUL_DSP_STAGE3]>]>,
> 
> In this case multiplies will issue back-to-back and require 3 cycles to complete. If we have 2 multiplies then is ResMII = (2 * 3) / 1 = 6 when in reality  it will be 4 cycles since it's broken into stages.
> 
In the case with the two multiplies, I think the resource MII should be 2.  The resource MII is just the cycle count of the most heavily used resource. Since each of the resources, MUL_DSP_STAGE1, MUL_DSP_STAGE2, and MUL_DSP_STAGE3 are used for 2 cycles for the 2 instructions.

But, I agree that the code here is not going to return 2.  With your type of itinerary, I believe the code computes that there are 6 functional units used.  Then, when iterating over the functional units, the code calls canReserveResources() for each instruction 3 times.  Each time, the query returns false, and a new DFA is created for a total of 6 cycles.  It seems to me that the DFA requires an additional parameter to determine the cycle, or stage, but I don't believe that is possible currently.  I'll need to think about how to get this to work correctly for this type of itinerary. Unfortunately, it hard for me to test a solution to this since Hexagon doesn't have a similar itinerary. 


http://reviews.llvm.org/D16829





More information about the llvm-commits mailing list