[PATCH] D87337: [PGO] De-Optimizing cold functions based on PGO info (PATCH 1/2)
Min-Yih Hsu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 17:07:40 PDT 2020
myhsu created this revision.
myhsu added reviewers: bogner, xur, davidxl, andrew.w.kaylor.
Herald added subscribers: llvm-commits, wenlei, dexonsmith, mgrang, hiraditya.
Herald added a project: LLVM.
myhsu requested review of this revision.
This patch disables optimizations on IR Functions that are considered “cold” by PGO
profiles. The primary goal for this work is to improve code optimization
speed (which also improves compilation and LTO speed) without making too
much impact on target code performance.
The mechanism is pretty simple: In the second phase (i.e. optimization
phase) of PGO, we would add `optnone` attributes on functions that are
considered “cold”. That is, functions with low profiling counts.
In addition to de-optimizing on functions whose profiling counts are
exactly zero (the `-profile-deopt-cold` flag). If the previous CLI flag
is enabled, another knob (`-profile-deopt-cold-percent=<X percent>`) can
be used to adjust the “cold threshold”. That is, after sorting profiling counts
of all functions, this knob provides an option to de-optimize functions
whose count values are sitting in the lower X percent.
Our evaluation results showed an average of 10% compilation speed
improvement with up to 2% performance overhead on various of thresholds using the
LLVM Test Suite as the benchmark. Using with FullLTO, it brought average
of 20% (LTO) link time improvement with up to 2% performance overhead.
authors: myhsu, probinson, and edd
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87337
Files:
llvm/include/llvm/IR/Function.h
llvm/lib/IR/Function.cpp
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/test/Transforms/PGOProfile/Inputs/deopt-cold-functions.proftext
llvm/test/Transforms/PGOProfile/deopt-cold-functions.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87337.290612.patch
Type: text/x-patch
Size: 10520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200909/e3c032df/attachment.bin>
More information about the llvm-commits
mailing list