[llvm] [llvm-profgen] Improve sample profile density (PR #92144)

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 22:36:11 PDT 2024


wlei-llvm wrote:

> > The density is now calculated based on context-sensitive profiles instead of merged profiles. Profiles merged from different contexts could hide low sample issues. For implementation, it leverages the sample context tracker which can fetch the CS profile before the pre-inliner.
> 
> As we discussed, since optimization is based on pre-inlined profile, what matters should be the profile density after preinline? If pre-inlined profile has good density, that means optimizations should be able to make reasonably good and stable decisions based on merged profile, even though original full context profile could be of low density. From POV, it makes sense to use pre-inlined profile to compute density?

Good point, after thinking it over more, I agreed with you, if the profile is merged after inlining, the compiler optimization use the merged profile and doesn't use the context-sensitive profile. I will change to base on pre-inlined profile.    

Though I still want to emphasize one thing that the existing one is using the completely context-less profile for this, which is also not what we want, IIUC,  what we want is just the final profile. 

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


More information about the llvm-commits mailing list