[PATCH] D81981: [PGO] Supplement PGO profile with Sample profile

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 15:20:50 PDT 2020


On Wed, Jul 22, 2020 at 2:53 PM David Li via Phabricator <
reviews at reviews.llvm.org> wrote:

> davidxl added a comment.
>
> The PGOUse pass can choose not to annotate any branches with total weights
> == 0. Now the question becomes how do we tell PGOUse pass whether the entry
> should be set to 0 or leave it not set. There are two ways to do it (to
> signal it is not really cold, but unknown):
>
> 1. Remove the function from the indexed format profile;
> 2. set all counts to some sentinel value such as -1.
>

Yes, in this way we can move the function to .text section from
.text.unlikely, but it is still not ideal if the function is hot. If we can
set the entry count to be a hot value based on the entry count in sample
profile, we may be able to boost its inlining and unrolling inside, and
also put it in .text.hot.

How about letting llvm-profdata choose based on profile version? If the
profile version indicates it always contains entry count, llvm-profdata
will update the entry count. If the profile version indicates it may not
always contain the entry count, llvm-profdata will remove the function with
all zero values if it finds the function to be hot/warm in sample profile.
It will also boost the counters in function with non-zero value using total
or max count.  In this way, the feature can support any profile version.



>
>
> Repository:
>   rL LLVM
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D81981/new/
>
> https://reviews.llvm.org/D81981
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200722/c97460c8/attachment.html>


More information about the llvm-commits mailing list