We have seen that the prioirty inliner delivered on-par performance with the old inliner for probe-only CSSPGO profile, as long as without a size budget. I'm turning on the priority inliner for probe-only profile by default.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/IPO/SampleProfile.cpp | ||
---|---|---|
2035–2038 | Do we also need to clear ProfileInlineGrowthLimit here? |
llvm/lib/Transforms/IPO/SampleProfile.cpp | ||
---|---|---|
2035–2038 | That one is used as a multiplier. Giving it a large value may cause overflow, so not sure what is a good value to give. unsigned SizeLimit = F.getInstructionCount() * ProfileInlineGrowthLimit; SizeLimit = std::min(SizeLimit, (unsigned)ProfileInlineLimitMax); SizeLimit = std::max(SizeLimit, (unsigned)ProfileInlineLimitMin); |
llvm/lib/Transforms/IPO/SampleProfile.cpp | ||
---|---|---|
2030 | Actually when we use preinline decision should we also ignore size limits? We don't have to do it here, but perhaps something worth trying. When preinliner is well tuned, I think size limit only makes sense if we have flat cs profile without preinline. | |
2035–2038 | Ok, with that SizeLimit calculation, as long as we have ProfileInlineLimitMin as int max, the SizeLimit will be int max. We should be good then. | |
2043 | Is it actually possible that FunctionSamples::ProfileIsCS is true but Reader->profileIsCS() is false? |
llvm/lib/Transforms/IPO/SampleProfile.cpp | ||
---|---|---|
2030 | I think with preinline decision, the size limits are actually ignored: | |
2043 | I don't think so. They are defined by same value in the reader: Actually I think the ProfileIsCS field should be removed, and instead using FunctionSamples::ProfileIsCS everywhere. I can make a separate diff to clean this up. |
llvm/lib/Transforms/IPO/SampleProfile.cpp | ||
---|---|---|
2030 | The code you linked (shouldInlineCandidate) is about how we evaluate a candidate, but when size limit is hit, we stop evaluating new candidate: https://github.com/llvm/llvm-project/blob/fc7573f29c79a4bbcfc0d6d001b7c7ae9f1344c7/llvm/lib/Transforms/IPO/SampleProfile.cpp#L1451 | |
2043 | If it's not possible, we can do ProfileIsCS = true; instead of ProfileIsCS = Reader->profileIsCS(); |
Actually when we use preinline decision should we also ignore size limits? We don't have to do it here, but perhaps something worth trying.
When preinliner is well tuned, I think size limit only makes sense if we have flat cs profile without preinline.