[PATCH] D120335: [llvm-profgen] Generating probe-based non-CS profile.

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 10:38:58 PST 2022


wenlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:444
+  ProbeCounterMap ProbeCounter;
+  extractProbesFromRange(preprocessRangeCounter(RangeCounter), ProbeCounter);
+
----------------
hoy wrote:
> 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.
> 
> 
Ok, thanks for clarification - that makes sense. Suggestion: use canonical terms like "inlinee frame" or "leaf inlinee frame" instead of nebulous terms like "owner frame" to avoid confusion. 

> Both preprocessRangeCounter and extractProbesFromRange calls findDisjointRanges, which is duplicated. 

Something we can do to avoid redundant findDisjointRanges? 


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