This change allows to trim the profile if it's considered to be cold for baseline AutoFDO. We reuse the cold threshold from ProfileSummaryBuilder::getColdCountThreshold(..) which can be set by percent(--profile-summary-cutoff-cold) or by value(--profile-summary-cold-count).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
63–64 | How about merge the new switch with this one? |
llvm/tools/llvm-profgen/ProfileGenerator.cpp | ||
---|---|---|
63–64 | Yeah, let's merge them. And this may also mean we need to put it on afdo-specific path, instead having it in ProfileGenerator::postProcessProfiles. |
lgtm, thanks.
llvm/test/tools/llvm-profgen/merge-cold-profile.test | ||
---|---|---|
9 | nit: this should not change? |
None of the tests cover trim vs no-trim difference, it'd be good to have one, so we check trimming is actually making a difference.
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
111 ↗ | (On Diff #387379) |
@wenlei We do have a test case for the trimming here which checked the function won't appear if its total sample is smaller than --profile-summary-cold-count=100 |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
111 ↗ | (On Diff #387379) | But we don't have a check to make sure main/quick_sort actually appears without trimming, right? If for whatever reason these two never appears even without trimming (--trim-cold-profile=0), this test could be doing nothing. |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
89 ↗ | (On Diff #387379) | Here |
111 ↗ | (On Diff #387379) | Oh, I got your meaning. In the test above, there is a CHECK for main/quick_sort, but I realize it's mixed with other test and not visible. I will add a separate test case for cold trimming.Thanks for the clarification. |
llvm/test/tools/llvm-profgen/inline-noprobe2.test | ||
---|---|---|
111 ↗ | (On Diff #387379) | Thanks, looks good now. |
nit: this should not change?