[llvm] [RISCV] Add SpacemiT X100 base scheduling model (PR #178189)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 29 09:27:20 PST 2026


mshockwave wrote:

> LGTM.
> 
> > On the X100, I tried SpacemitX100Model, NoSchedModel, and GenericOOOModel, spec2k17rate train did not show significant performance differences. If there are better methods for modeling and testing the scheduling of OOO processors.
> 
> For OoO cores, it is expected that instruction scheduling has no significant performance gain. My experience is that `NoSchedModel` should have the worst performance because adding scheduling model is beneficial to enable register pressure/resources balancing.

Exactly, for most of the cases register pressure reduction is probably the only thing OoO cores benefit from instruction scheduling.

Speaking of something counter-intuitive:
```
  // Each Queue can accepts 2 ops and issue 1 op per cycle
  def SMTX100_IQ0 : ProcResource<1>; //Integer Queue 0
  def SMTX100_IQ1 : ProcResource<1>; //Integer Queue 1
  def SMTX100_BQ  : ProcResource<1>; //Branch Queue
```
If you want to model ingesting 2 ops while producing 1 op per-cycle, I _think_ you should do something like `ProcResource<2>` given your issue width being 4. I wrote a looong article on this topc: https://myhsu.xyz/llvm-machine-scheduler-2/#resource-pressure

But here is the short version: MachineScheduler only cares about the input vs. output ratio of a pipe (ProcResource) -- you might be surprised, but MachineScheduler actually doesn't even use `BufferSize` at all! It does use `MicroOpBufferSize` but only in a really limited way. Back to the input vs. output ratio, the input ratio is solely determined by the issue width, and the output ratio solely determined by the number of unit of a pipe, hence my previous suggestion. That being said, this input vs. output ratio is only used in reducing resource pressure...and to be honest it usually has little performance impact on OoO cores, as I also mentioned earlier. So it's actually fine if you don't get this ratio 100% correct, unless you observed some serious resource-pressure-inducing structural hazards in real world cases.

LLVM MCA, on the other hand, uses all the properties like number of units in a pipe, and `BufferSize`. So I guess there is still _some_ benefit of getting values like `BufferSize` right.

https://github.com/llvm/llvm-project/pull/178189


More information about the llvm-commits mailing list