-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RISC-V Machine Outliner should reach parity with other platforms #89822
Comments
@llvm/issue-subscribers-backend-risc-v Author: Paul Kirth (ilovepi)
Machine Outliner can lead to significant size savings, even for 32-bit embedded targets, see https://www.linaro.org/blog/reducing-code-size-with-llvm-machine-outliner-on-32-bit-arm-targets/
Both Arm and AArch64 backends support variety of outlining strategies: llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp Lines 8099 to 8178 in 89c95ef
While the RISC-V backend has some outlining support, it's fairly limited compared to Arm and AArch64 backends, see llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp Lines 2533 to 2570 in 89c95ef
We should improve the RISC-V Machine Outliner to be on par with Arm and AArch64. Off the top of my head we should take the following steps:
CC: @petrhosek |
As a first pass at a gap analysis, @hiraditya @petrhosek and I looked at the Aarch64 and ARM32 Machine outliner bits. We noticed several things are handled in a more sophisticated manner than in RISC-V.
A related observation is that I think RISC-V is different form other platforms in that most of its relocation sequences allow for interleaving instructions between operations in a fixed sequence. TLSDESC access is a good example of this. We wonder if there should be some cannonicalization of particular instruction sequences to maximize outlining opportunities. I think this is worth considering, but shouldn't be prioritized over basic improvements to identifying instruction sequences, cost modeling, and stack frame handling. Lastly, we know that RISC-V heavily uses TableGen, and wonder if we can similarly generate some of these rules, or augment the information available to the outliner from the existing instruction information. |
I watched the 2023 LLVM Dev Mtg - Profiling Based Global Machine Outlining presentation, and I'm wondering if we can leverage that to do some further analysis and find code sequences that the existing heuristics miss, or identify cases where one backend can do significantly better in a systematic way. |
That's a good idea for sure! In the short team i believe focusing on items 1,2, and 4 (from our analysis) will give maximum ROI. |
I think the next steps are to take those items and file issues w/ enough context that anyone will have sufficient information to make progress. Likely we'll be the ones to do the work, but if we can make it easier for other contributors to grab work items, we should. I'll try to have that done by May 10, and then we can start improving things w/o stepping all over one another. |
Looking at the RISC-V side, why do we only support outlining when we can make a call w/ |
So I think what we're missing is code to save |
That's what I was getting at. It seems like we could be doing more. |
Machine Outliner can lead to significant size savings, even for 32-bit embedded targets, see https://www.linaro.org/blog/reducing-code-size-with-llvm-machine-outliner-on-32-bit-arm-targets/
Both Arm and AArch64 backends support variety of outlining strategies:
https://github.com/llvm/llvm-project/blob/89c95effe82c09b9a42408f4823409331f8fa266/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp#L5678-5778
llvm-project/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
Lines 8099 to 8178 in 89c95ef
While the RISC-V backend has some outlining support, it's fairly limited compared to Arm and AArch64 backends, see
llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Lines 2533 to 2570 in 89c95ef
We should improve the RISC-V Machine Outliner to be on par with Arm and AArch64.
Off the top of my head we should take the following steps:
CC: @petrhosek
The text was updated successfully, but these errors were encountered: