<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Tom,<div class=""><br class=""></div><div class="">Andy could give a more educated answer. I’ve CC’ed him.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 14, 2015, at 7:03 PM, Tom Stellard <<a href="mailto:tom@stellard.net" class="">tom@stellard.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Hi,<br class=""><br class="">The ProcWriteResources Tablegen class has a Latency member variable and a<br class="">ProcResources member variable.  What is the difference between these<br class="">two?</div></blockquote><div><br class=""></div><div>I guess you already noticed, but the documentation for all those variables is in <span style="font-family: Menlo; font-size: 11px;" class="">include/llvm//Target/TargetSchedule.td.</span></div><div><br class=""></div><div>Here is my understanding of all of that.</div><div><br class=""></div><div>The ProcResources tells how long/many resources you use.</div><div>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.</div><div><br class=""></div><div>The Latency tells you how long you have to wait before the result is avialable.</div><div>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.</div><br class=""><blockquote type="cite" class=""><div class="">  If I have an instruction that spends 5 cycles in resource A<br class="">and then 5 cycles in resource B, how should I be setting these variables?<br class=""></div></blockquote><div><br class=""></div><div>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.</div><div>The approximation I would do would look like:</div><div>// Say that we have one resource of A and one resource of B.</div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">def ResA : ProcResource<1>;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">def ResB : ProcResource<1>;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">// Use 5 A then 5 B.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><div style="margin: 0px;" class="">def : WriteRes<Write5A5B, [ResA, ResB]> {</div><div style="margin: 0px;" class="">  let Latency = 10;  // Model the A then B, by adding their cycles</div><div style="margin: 0px;" class="">  let ResourceCycles = [5, 5];</div><div style="margin: 0px;" class="">}</div></div><div class=""><br class=""></div></div>If you have more than one resource A or B, this is obviously not accurate.</div><div><br class=""></div><div>Cheers,</div><div>-Quentin<br class=""><blockquote type="cite" class=""><div class=""><br class="">Thanks,<br class="">Tom<br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class=""></div></blockquote></div><br class=""></div></body></html>