[llvm] [MCSched] Allow tuning LoadLatency/MispredictPenalty (PR #203139)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 20:49:07 PDT 2026
lenary wrote:
I cannot tell if #195638 is intending to be a user-facing change or just for testing.
Our intention with this is eventually to get some kind of connection so that users can modify existing scheduling models, and for that to happen we cannot use a `-mllvm -sched-foo-bar=X` command-line flag (firstly as we don't want to make users look at what internal `-mllvm` flags there are and start relying on them, and secondly because this does not work with LTO correctly). So the way to do this is to get info from the Subtarget into the scheduling model.
I've contemplated a few different approaches:
- Flags in `MCSchedModel` and changes to make fields private and accessed only through getters, which also consult the `cl::opt` - this doesn't work for the above problems with `-mllvm` flags.
- Try to copy the `MCSchedModel` and modify the fields in-place as you ask for it - the issue here is there isn't really anywhere with the right lifetime to store this dynamically created/allocated `MCSchedModel`.
- This approach, where we query some info from the subtarget, which seems promising from a data flow perspective but enforcing correct usage is difficult.
I'm happy to hear RISC-V isn't the only target that wants this, but I don't think that means I have a solution yet.
https://github.com/llvm/llvm-project/pull/203139
More information about the llvm-commits
mailing list