[llvm] [PGO] Sampled instrumentation in PGO to speed up instrumentation binary (PR #69535)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 09:36:04 PDT 2023


================
@@ -148,6 +150,16 @@ cl::opt<bool> SkipRetExitBlock(
     "skip-ret-exit-block", cl::init(true),
     cl::desc("Suppress counter promotion if exit blocks contain ret."));
 
+static cl::opt<bool>
+    SampledInstrument("sampled-instr", cl::ZeroOrMore, cl::init(false),
+                      cl::desc("Do PGO instrumentation sampling"));
+
+static cl::opt<unsigned> SampledInstrumentDuration(
+    "sampled-instr-duration",
----------------
WenleiHe wrote:

If you end up with bursty sampling, maybe `sampled-instr-burst-duration` to be clear. There also needs to be a explanation in comment somewhere to call out burst mode is chosen and explain why.

It can be useful to have a separate `sampled-instr-period`, which defaults to 64K, so that part is also tunable when needed. With that flag, people can set `sampled-instr-burst-duration` to 1, and tune `sampled-instr-period` instead to achieve non-burst sampling. We may give it a try.

https://github.com/llvm/llvm-project/pull/69535


More information about the llvm-commits mailing list