Hi,
At EuroLLVM, we had some discussions about GlobalISel/(g)MIR being a bit too slow overall, especially MachineInstr::addOperand
being unnecessarily slow. I’m interested in improving GlobalISel performance overall, but for that I want to make sure I measure the improvements properly, and that I’m looking at the right things.
Micro-Benchmarks
I started adding some benchmarks for MachineInstr APIs in this branch: GitHub - Pierre-vh/llvm-project at mir-benchmarks
Right now they’re limited to MachineInstr
constructor and MachineInstr::addOperand
. New benchmark ideas are welcome.
I think adding some mini benchmarks to test individual MIR APIs is a good thing as it allows contributors and maintainers to quickly check the performance of common APIs, and track them over time.
Would this be a welcome addition upstream ? The llvm/benchmarks
folder is under-used anyway (it only has one YAML benchmark), so even if this ends up not being of much use, it doesn’t add much bloat and is easy to remove.
If yes, should I wait until I have a solid number of benchmarks to upstream, or is it worth upstreaming ASAP to try and give this some momentum?
Real-world Benchmarks
This is likely the type of benchmark that matters the most for end users, but as we have no default-enabled GlobalISel backend upstream, I’m unsure how to test this accurately.
I think the AArch64 backend is the best benchmark candidate as it’s the most complete one.
However, I’m stuck on figuring out what inputs to use to test it.
I personally use a Linux x64 machine so I don’t have an AArch64 toolchain available. I’d like to find some code that:
- Does not need a complete toolchain (minimal to no dependencies - only needs a LLVM build)
- Does not fall back to DAGISel at all
- Is large enough that it stress tests GlobalISel in a meaningful way
- e.g. very large functions with many instructions and basic blocks
Does anyone have a suggestion?