[LLVMdev] MISched: Difference between Latency and ResourceCycles

Quentin Colombet qcolombet at apple.com
Wed Apr 15 10:20:52 PDT 2015


Hi Tom,

Andy could give a more educated answer. I’ve CC’ed him.

> On Apr 14, 2015, at 7:03 PM, Tom Stellard <tom at stellard.net> wrote:
> 
> Hi,
> 
> The ProcWriteResources Tablegen class has a Latency member variable and a
> ProcResources member variable.  What is the difference between these
> two?

I guess you already noticed, but the documentation for all those variables is in include/llvm//Target/TargetSchedule.td.

Here is my understanding of all of that.

The ProcResources tells how long/many resources you use.
E.g., if you say 5 A, this either means you use resource A for 5 cycles or you use 5 resource A for 1 cycle. The actual semantic then depends on how many A resources you have.

The Latency tells you how long you have to wait before the result is avialable.
E.g., if you say 5 A, latency 10. It means whatever how you consumes the 5 A resources, the results will be available in 10 cycles.

>  If I have an instruction that spends 5 cycles in resource A
> and then 5 cycles in resource B, how should I be setting these variables?

AFAICT, our model is not precise enough to describe that. I.e., you cannot model the pipeline within one resource. I guess you have to resort on the itineraries model if you want that.
The approximation I would do would look like:
// Say that we have one resource of A and one resource of B.
def ResA : ProcResource<1>;
def ResB : ProcResource<1>;

// Use 5 A then 5 B.
def : WriteRes<Write5A5B, [ResA, ResB]> {
  let Latency = 10;  // Model the A then B, by adding their cycles
  let ResourceCycles = [5, 5];
}

If you have more than one resource A or B, this is obviously not accurate.

Cheers,
-Quentin
> 
> Thanks,
> Tom
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150415/4ce1d675/attachment.html>


More information about the llvm-dev mailing list