[llvm] [llvm-profgen] Add --sample-period to estimate absolute counts (PR #99826)

Tim Creech via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 09:09:24 PDT 2024


tcreech-intel wrote:

I'm interested in handling the combination of 1) and 2), where we're sampling the IP-only profile at a different period from the LBR-based profile and want to compare the two, e.g., for computing branch miss ratios. 

However, let's say we're only concerned with 1), i.e., dividing LBR hit counts by the LBR depth, because we can account for sampling periods with `llvm-profdata` post-processing.  If we apply the sampling period then we can do this division while processing each sample's contribution. This is useful because the effective LBR depth can vary by platform and even across samples in the same profile. Without applying the sampling period first, `Count` will typically be smaller than `Sample->LBRStack.size() - 1` and the result won't be useful.

In short, --sample-period lets us avoid dividing integers which are smaller than LBR depths without assuming anything about LBR depths. (It also produces profile counts which approximate absolute event counts, but we don't depend on that property.)

Thoughts here are appreciated, but I will move to revert these two llvm-profgen changes.


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


More information about the llvm-commits mailing list