[PATCH] D120335: [llvm-profgen] Generating probe-based non-CS profile.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 1 09:20:40 PST 2022
hoy added inline comments.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:444
+ ProbeCounterMap ProbeCounter;
+ extractProbesFromRange(preprocessRangeCounter(RangeCounter), ProbeCounter);
+
----------------
wenlei wrote:
> hoy wrote:
> > wlei wrote:
> > > So here we don't use the way like CS-profile to generate the zero-count(in ProfileGenerator.cpp: 981), instead we reuse the `preprocessRangeCounter` to initialize all function range with zero, the probe inside the function will naturally be added with zero count. I guess this is the same to the way of CS-profile, right?
> > Yes, we are using the non-CS way of reporting zero counted probes. There is a difference between CS and non-CS in that for CS, the non-executed probes are reported for its owner frame only, while for non-CS, such probes are reported for the whole inline nest.
> Both preprocessRangeCounter and extractProbesFromRange calls findDisjointRanges, which is duplicated.
>
> > for CS, the non-executed probes are reported for its owner frame only, while for non-CS, such probes are reported for the whole inline nest.
>
> what does the term "owner frame" refer to? can you elaborate the above?
By owner frame I mean the inlinee frame that originally directly contains the probe. Eg., given function A, A inlines B and one original probe of B is sampled, for CS, all of other original probes of B will be reported. None of the original probes of A will be reported if none of A's probe is sampled. But for non-CS, all of A's and B's probes will be reported even if only one B's probe is sampled.
A real example is in the attached inline-pseudoprobe.test where we have
; CHECK: main:88:0
; CHECK-NEXT: 1: 0
; CHECK-NEXT: 2: foo:88
; CHECK-NEXT: 1: 0
; CHECK-NEXT: 2: 15
the corresponding CS profile is in inline-cs-pseudoprobe.test where there is no profile generated for the main function.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:497
FunctionProfile->addTotalSamples(Count);
+ if (WithProbe) {
+ const auto *FuncDesc = Binary->getFuncDescForGUID(Function::getGUID(FunctionProfile->getName()));
----------------
wenlei wrote:
> Perhaps we don't need a parameter for this, just use `Binary->usePseudoProbes()` instead.
Sounds good.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:901
-void CSProfileGenerator::extractProbesFromRange(const RangeSample &RangeCounter,
+void ProfileGeneratorBase::extractProbesFromRange(const RangeSample &RangeCounter,
ProbeCounterMap &ProbeCounter) {
----------------
wenlei wrote:
> nit: move this closer to the functions definitions for ProfileGeneratorBase.
done.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120335/new/
https://reviews.llvm.org/D120335
More information about the llvm-commits
mailing list