<div dir="ltr"><div><div>I have not been able to figure out what exactly ProcResGroup (which is defined in include/llvm/Target/TargetSchedule.td) does. Let me explain with an example. I appreciate any help.<br><br>I have the following in the .td file (among other things):<br><br>  def ALU : ProcResource<4>;<br>  def DP : ProcResource<4>;<br><br>  def TestGroup : ProcResGroup<[ALU, DP]>;<br>  <br>def P9_Test_76C : SchedWriteRes<[TestGroup]> {<br>    let Latency = 76;<br>    let ResourceCycles = [62];<br>  }<br><br>  def : ItinRW<[P9_Test_76C, IP_EXEC_1C, DISP_1C, DISP_1C], [IIC_IntSimple,<br>                                         IIC_IntGeneral]>;<br><br><br>Then when I look at the output of llvm-tblgen -gen-subtarget<br><br>I see the following:<br><br><span style="color:rgb(255,0,0)">// {Name, NumUnits, SuperIdx, IsBuffered}<br>static const llvm::MCProcResourceDesc P9ModelProcResources[] = {<br>..........<br>  {DBGFIELD("TestGroup")       8, 0, -1}  // #16<br>};</span><br><br>I believe we have 8 units of TestGroup because using TestGroup means using ALU or DP and we have four of each. <br><br>I also see<br><br>// {Name, NumMicroOps, BeginGroup, EndGroup, WriteProcResIdx,#, WriteLatencyIdx,#, ReadAdvanceIdx,#}<br>static const llvm::MCSchedClassDesc P9ModelSchedClasses[] = {<br>.................<br>  {DBGFIELD("IIC_IntSimple")      1, false, false,  1, 3,  1, 4,  0, 0}, // #1<br>};<br><br>and<br><br><span style="color:rgb(0,0,255)">// {ProcResourceIdx, Cycles}<br>extern const llvm::MCWriteProcResEntry PPCWriteProcResTable[] = {<br>......<br>  {16, 62}, // #3<br>......<br>}<br></span><br>All of this makes sense, except that I do not see anything in the output of tablegen that creates a relationship between TestGroup, ALU and DP. Even if there is such a mapping somewhere else that I have missed, I cannot see how it is exploited in MachineScheduler.cpp. Because what we do there, is the following:<br><br>-- for a scheduled insn loop over all its WriteProcRes (highlighted in blue). Then from that extract ProcResourceIdx (highlighted in red). From there we update the usage of this ProcResource. I expected to see some connection to ALU and DP when we update resource usage.<br><br>I have looked at the commits that added this construct as well, but couldn't figure out the answer to my question.<br><br></div>Thanks<br></div>Ehsan<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 24, 2016 at 2:45 PM, Ehsan Amiri <span dir="ltr"><<a href="mailto:ehsanamiri@gmail.com" target="_blank">ehsanamiri@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi<br><br>I am working on modeling a processor with resource descriptors, to be used by Machine Scheduler.<br><br>IIUC, Currently we can model the following aspects of a processor <br><br>1- If we have a # of processors resources of the same kind, we can say that an insn will use one of the units of that resource kind.<br>2- We can say that an insn will use multiple units of resources of the same or different kinds in parallel or sequentially.<br><br>What I need though is to say that an insn can use one unit of two resources of different kinds (but not both). Is there any way to express this? I thought ProcResGroup is introduced for this purpose, but looking at how it is used, and also looking at the output of tablegen -gen-subtarget I am not able to use it to achieve this goal.<br><br>Thanks<span class="HOEnZb"><font color="#888888"><br>Ehsan<br></font></span></div>
</blockquote></div><br></div>