[PATCH] D146198: [RISCV] Make ResourceCycles relevant to LMUL

Wang Pengcheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 02:02:50 PDT 2023


pcwang-thead added a comment.

In D146198#4232662 <https://reviews.llvm.org/D146198#4232662>, @craig.topper wrote:

> In D146198#4232590 <https://reviews.llvm.org/D146198#4232590>, @pcwang-thead wrote:
>
>> In D146198#4231514 <https://reviews.llvm.org/D146198#4231514>, @craig.topper wrote:
>>
>>> Why can't ResourceCycles be the base class that just contains a list of integers. Other classes inherit that and construct the list however they want. A fixed class could take a cycle count and put that value in every entry in the list. The lmul scaled class could take an cycle and mutliply.
>>
>> I think the reason is that we need LMUL info to generate the list but we can't get it in SchedXXX.td.
>> We had a complex implementation which seems to be likely what you described(if I understand correctly), I will upload it later. :-)
>
> Why do we need LMUL info?
>
> We can have a class that contains an 8 entry list of resource cycles for each LMUL plus upper bound. We can have derived classes that construct this list based on common cases.
>
> LMULWriteResImpl can index into the list to the entry corresponding to the LMUL. Nothing in RISCVScedule.td needs to know how the list was constructed.

Oh I get it. The key point is that we can't index list by dynamic index(?), the index can only be constant:

  [build] llvm/lib/Target/RISCV/RISCVScheduleV.td:63:82: error: Variable not defined: 'i'
  [build]   defvar i = IndexOfLMUL<mx>.value;
  [build]   list<int> value = !foreach(resourceCycle, resourceCycles, resourceCycle.Cycles[i]);
                                                                                           ^


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146198



More information about the llvm-commits mailing list