[llvm] [llvm-profgen] Improve sample profile density (PR #92144)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 09:57:15 PDT 2024
================
@@ -768,9 +748,89 @@ void ProfileGenerator::populateBoundarySamplesForAllFunctions(
}
}
+// Note taht ideally the size should be the number of function's instruction.
+// However, for probe-based profile, we don't have the accurate instruction
+// count for each probe, Instead, the probe sample is the samples count for the
+// block, which is equivelant to total_instruction_samples/num_instruction in
+// one block. Hence, we use the number of probe as a proxy for the function's
+// size.
+void ProfileGeneratorBase::calculateBodySamplesAndSize(
+ const FunctionSamples &FSamples, uint64_t &TotalBodySamples,
----------------
WenleiHe wrote:
Ok, can you add a comment explaining why we need to accumulate the samples manually instead of using `getTotalSamples`? including the fact that `--update-total-samples` is off and the reasoning, difference between AutoFDO and CSSPGO. A comment would be very useful because after a while someone may look at this code be very tempted to refactor / simplify it with `getTotalSamples`.
https://github.com/llvm/llvm-project/pull/92144
More information about the llvm-commits
mailing list