[PATCH] D63949: [PGO] Add profile instrumentation sampling support
Rong Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 28 11:50:27 PDT 2019
xur created this revision.
xur added a reviewer: davidxl.
Herald added subscribers: hiraditya, mehdi_amini.
Herald added a project: LLVM.
GO instrumentation can incur huge slowdown, especially for highly threaded
programs -- we have seen 100x. This patch adds profile instrumentation
sampling support.
It transforms:
Increment_Instruction;
Instructions_after;
to:
CountVar = CountVar + 1;
if (CountVar <= SampleDuration)
Increment_Instruction;
else if CountVar >= WholeDuration)
CountVar = 0;
Instructions_after;
Here CountVar is a thread-local global shared by all PGO instrumentation
variables (value-instrumentation and edge instrumentation).
Some statistics we collect using one of our large and highly threaded program:
This is using default sample-rate of 100:100019.
- sampling speeds up the instrumentation binary by 3.3x.
- overlap tool shows resulted profiles are close: Edge profile overlap: 92.771% IndirectCall profile overlap: 80.493% MemOP profile overlap: 95.114%
FDO optimize build binary is performance neutral using sampled profile in the above application.
Compile time can increase due to the added control flows.
https://reviews.llvm.org/D63949
Files:
llvm/include/llvm/ProfileData/InstrProf.h
llvm/include/llvm/ProfileData/InstrProfData.inc
llvm/include/llvm/Transforms/Instrumentation.h
llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/test/Transforms/PGOProfile/Inputs/cspgo_bar_sample.ll
llvm/test/Transforms/PGOProfile/cspgo_sample.ll
llvm/test/Transforms/PGOProfile/instrprof_sample.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63949.207117.patch
Type: text/x-patch
Size: 31179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190628/e352a7ab/attachment.bin>
More information about the llvm-commits
mailing list