1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00
llvm-mirror/lib/ProfileData
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
..
Coverage [CoverageMapping] Handle gaps in counter IDs for source-based coverage 2021-05-19 10:46:38 -07:00
CMakeLists.txt Revert "[SampleFDO][NFC] Refactor SampleProfile.cpp" 2021-02-16 22:11:42 +00:00
GCOV.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
InstrProf.cpp [IndirectCallPromotion] Recommit "Don't strip ".__uniq." suffix when it strips 2021-03-12 13:48:14 -08:00
InstrProfReader.cpp [SystemZ][z/OS] Add IsText Argument to GetFile and GetFileOrSTDIN 2021-04-16 10:08:36 -04:00
InstrProfWriter.cpp [llvm-profdata] Emit Error when Invalid MemOpSize Section is Created by llvm-profdata 2021-02-23 12:51:54 -08:00
ProfileSummaryBuilder.cpp [CSSPGO] Report zero-count probe in profile instead of dangling probes. 2021-06-16 11:45:29 -07:00
SampleProf.cpp [CSSPGO] Report zero-count probe in profile instead of dangling probes. 2021-06-16 11:45:29 -07:00
SampleProfReader.cpp [SampleFDO] New hierarchical discriminator for FS SampleFDO (llvm-profdata part) 2021-06-04 11:22:06 -07:00
SampleProfWriter.cpp [SampleFDO] New hierarchical discriminator for FS SampleFDO (ProfileData part) 2021-06-02 10:32:52 -07:00