1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/tools/llvm-profgen
Hongtao Yu 45a66978f9 [CSSPGO] Report zero-count probe in profile instead of dangling probes.
Previously dangling samples were represented by INT64_MAX in sample profile while probes never executed were not reported. This was based on an observation that dangling probes were only at a smaller portion than zero-count probes. However, with compiler optimizations, dangling probes end up becoming at large portion of all probes in general and reporting them does not make sense from profile size point of view. This change flips sample reporting by reporting zero-count probes instead. This enabled dangling probe to be represented by none (missing entry in profile). This has a couple benefits:

1. Reducing sample profile size in optimize mode, even when the number of non-executed probes outperform the number of dangling probes, since INT64_MAX takes more space over 0 to encode.

2. Binary size savings. No need to encode dangling probe anymore, since missing probes are treated as dangling in the profile reader.

3. Reducing compiler work to track dangling probes. However, for probes that are real dead and removed, we still need the compiler to identify them so that they can be reported as zero-count, instead of mistreated as dangling probes.

4. Improving counts quality by respecting the counts already collected on the non-dangling copy of a probe. A probe, when duplicated, gets two copies at runtime. If one of them is dangling while the other is not, merging the two probes at profile generation time will cause the real samples collected on the non-dangling one to be discarded. Not reporting the dangling counterpart will keep the real samples.

5. Better readability.

6. Be consistent with non-CS dwarf line number based profile. Zero counts are trusted by the compiler counts inferencer while missing counts will be inferred by the compiler.

Note that the current patch does include any work for #3. There will be follow-up changes.

For #1, I've seen for a large Facebook service, the text profile is reduced by 7%. For extbinary profile, the size of  LBRProfileSection is reduced by 35%.

For #4, I have seen general counts quality for SPEC2017 is improved by 10%.

Reviewed By: wenlei, wlei, wmi

Differential Revision: https://reviews.llvm.org/D104129
2021-06-16 11:45:29 -07:00
..
CallContext.h [CSSPGO][llvm-profgen] Instruction symbolization 2020-11-20 14:26:27 -08:00
CMakeLists.txt [CSSPGO][llvm-profgen] Context-sensitive global pre-inliner 2021-03-29 09:46:14 -07:00
CSPreInliner.cpp [CSSPGO] Fix dangling context strings and improve profile order consistency and error handling 2021-04-10 12:39:10 -07:00
CSPreInliner.h [CSSPGO][llvm-profgen] Context-sensitive global pre-inliner 2021-03-29 09:46:14 -07:00
ErrorHandling.h
llvm-profgen.cpp [CSSPGO][llvm-profgen] Renovate perfscript check and command line input validation 2021-02-12 15:18:50 -08:00
PerfReader.cpp [CSSPGO][llvm-profgen] Report samples for untrackable frames. 2021-05-24 12:39:12 -07:00
PerfReader.h [NFC][CSSPGO]llvm-profge] Fix Build warning dueo to an attrbute usage. 2021-05-24 12:59:02 -07:00
ProfiledBinary.cpp [MC] Refactor MCObjectFileInfo initialization and allow targets to create MCObjectFileInfo 2021-05-23 14:15:23 -07:00
ProfiledBinary.h [CSSPGO] Add attribute metadata for context profile 2021-03-18 22:00:56 -07:00
ProfileGenerator.cpp [CSSPGO] Report zero-count probe in profile instead of dangling probes. 2021-06-16 11:45:29 -07:00
ProfileGenerator.h [CSSPGO][llvm-profdata] Support trimming cold context when merging profiles 2021-04-22 00:42:37 -07:00
PseudoProbe.cpp [CSSPGO][llvm-profgen] Always report dangling probes for frames with real samples. 2021-04-21 18:07:58 -07:00
PseudoProbe.h [CSSPGO][llvm-profgen] Always report dangling probes for frames with real samples. 2021-04-21 18:07:58 -07:00