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

via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 16:42:09 PDT 2024


WenleiHe wrote:

> > > However, there is a problem that a high total sample profile can have a very low density, which makes the density number not as representative.
> > 
> > 
> > How big is the problem? Like do you see this old heuristic preventing us from getting a consistent density threshold as proxy for performance, because density is less stable?
> 
> I didn't dive very deep to the old heuristic, I just guess from the result, I saw many cases show super big number, for example and this come from normal profile.
> 
> ```
> Sample PGO is estimated to optimize better with 3633.9x more samples.
> ```
> 
> That said, as I mentioned in the above comments, there seems a few bugs in the previous work, (another "bug" is it use the total_samples to decide the hot functions(the cutoff num is a block level count)), maybe it's caused by other issue. Anyway, it seems it needs a big overhaul.

If it's sorted by density now as opposed to function hotness, the density cut off value can be more stable -- that can avoid suggestions with huge numbers. But I don't see bug in old density, it's just heuristic with different philosophy. 

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


More information about the llvm-commits mailing list