[PATCH] D127026: [CSSPGO][llvm-profgen] Reimplement computeSummaryAndThreshold using context trie
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 16:15:12 PDT 2022
wenlei added inline comments.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:131-138
-ProfileGeneratorBase::create(ProfiledBinary *Binary,
- const SampleProfileMap &&Profiles,
+ProfileGeneratorBase::create(ProfiledBinary *Binary, SampleProfileMap &Profiles,
bool ProfileIsCS) {
std::unique_ptr<ProfileGeneratorBase> Generator;
if (ProfileIsCS) {
if (Binary->useFSDiscriminator())
exitWithError("FS discriminator is not supported in CS profile.");
----------------
The move is for `llvm-sample-profile` path. Do we fall back from move to copy for that path now?
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:1009
+ SampleProfileMap ContextLessProfiles;
+ ContextTracker.createContextLessProfileMap(ContextLessProfiles);
+ ProfileGeneratorBase::computeSummaryAndThreshold(ContextLessProfiles, false);
----------------
Not critical, but in the past we have the ability to use context profile as well when `profile-summary-contextless=0` is used. It seems like we now lost that ability?
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:1010
+ ContextTracker.createContextLessProfileMap(ContextLessProfiles);
+ ProfileGeneratorBase::computeSummaryAndThreshold(ContextLessProfiles, false);
+}
----------------
hoy wrote:
> hoy wrote:
> > wlei wrote:
> > > hoy wrote:
> > > > Is `false` needed here? We are passing in contextless profiles so merging them again inside `computeSummaryAndThreshold` should be fine?
> > > Yeah, we can merge the contextless profiles twice, but is there any concern to save one?
> > I guess my questions should be why this the extra parameter needed. Is the original implementation that checks `FunctionSamples::ProfileIsCS` inside `SampleProfileSummaryBuilder::computeSummaryForProfiles` not working?
> OK, I see your point, to save the unnecessary merge. I'd say if this is not at a visible cost, let's avoid changing the interface. Otherwise maybe we can reset `UseContextLessSummary` here? A comment would be helpful.
save/restore UseContextLessSummary sounds like a good idea.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127026/new/
https://reviews.llvm.org/D127026
More information about the llvm-commits
mailing list