[PATCH] D92998: [CSSPGO][llvm-profgen] Pseudo probe based CS profile generation
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 21 16:08:57 PST 2020
wlei added inline comments.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:42
if (SampleType == PERF_LBR_STACK) {
+ // Enable context-sensitive functionalities in SampleProf
+ FunctionSamples::ProfileIsCS = true;
----------------
hoy wrote:
> wlei wrote:
> > hoy wrote:
> > > The setting of the two flags should not be necessary on the profile generation side. They are used on the loader side. Do you see any issue without setting them?
> > Yeah, if not explicitly setting here, the value will be false.
> >
> > you see in llvm/lib/Transforms/IPO/SampleProfile.cpp:
> >
> > ```
> > // Apply tweaks if context-sensitive profile is available.
> > if (Reader->profileIsCS()) {
> > ProfileIsCS = true;
> > FunctionSamples::ProfileIsCS = true;
> >
> > // Tracker for profiles under different context
> > ContextTracker =
> > std::make_unique<SampleContextTracker>(Reader->getProfiles());
> > }
> > ```
> > It's set when the reader know it's a CS profile. But for llvm-profgen side, it doesn't set this.
> >
> I see. So `ContextTracker` used in profile generation?
Not `ContextTracker`, it's the SampleProfileWriter to write the text format of profile, like:
```
if (FunctionSamples::ProfileIsCS)
OS << "[" << S.getNameWithContext() << "]:" << S.getTotalSamples();
else
OS << S.getName() << ":" << S.getTotalSamples();
```
```
if (FunctionSamples::ProfileIsProbeBased) {
OS.indent(Indent + 1);
OS << "!CFGChecksum: " << S.getFunctionHash() << "\n";
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92998/new/
https://reviews.llvm.org/D92998
More information about the llvm-commits
mailing list