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

Michael Maitland via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 09:49:09 PDT 2023


michaelmaitland accepted this revision.
michaelmaitland added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/lib/Target/RISCV/RISCVScheduleV.td:69
+    def : WriteRes<!cast<SchedWrite>(name # "_WorstCase"), resources> {
+      let Latency = latency("WorstCase");
+      let ResourceCycles = !foreach(resourceCycle, resourceCycles, resourceCycle("WorstCase"));
----------------
When we call `latency("WorstCase")` and `resourceCycle("WorstCase")`, we're treating `WorstCase` as an LMUL value since we're passing it as the parameter that is used to pass LMUL. The last few changes to this file have aimed to move away from this by trying to have `WorstCase` mean worst case `SchedWrite`, not mean worst case LMUL. 

We still need to get the `Latency` and `ResourceCycles` for the worst case `WriteRes` though, and it would make sense to get it from this list. I thought about a solution where we pass a boolean parameter which signifies to return the WorstCase value:

```
function MyCyclesFunc() : function<bit, int, string, int> {
  return function(bit isWorstCase, string lmul = M1, int sew = 0,): int {
    return !if(isWorstCase : 10, !cond( /* return the lmul&sew cycles */);
  };
}
```

However, calling `latency(true)` feels worst than calling `latency("WorstCase"). It also makes the body of the lambda messier. As a result, I am willing to concede to passing `WorstCase` to these functions as the LMUL parameter. Curious if anyone has any input here.


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