[PATCH] D17108: [PGO] Add another interface for annotateValueSite

Rong Xu via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 22:52:46 PST 2016


On Thu, Feb 11, 2016 at 10:37 PM, Xinliang David Li <davidxl at google.com> wrote:
> On Thu, Feb 11, 2016 at 10:20 PM, Rong Xu <xur at google.com> wrote:
>> That's exactly what I'm doing. I will stop at the first indirect-call
>> target that not promotable. In that case, if the hottest one is the
>> external and second hottest one is intra-module. I will not promote
>> either one.
>>
>> The problem the patch to solve is: the first one (hottest) is
>> promoted, while the second one is external. I want to write the
>> vauledata (minus the first one) back to the metadata.
>
> Splitting the transformations in multiple phases may not be the right
> thing to do.  The reason is that the cost/benefit analysis needs to be
> done in one place.  If the second target is analysed later, it may not
> see what has already happened earlier. One way to solve this is that
> the first phase transformation decides how many targets to promote. If
> the second one is picked but definition is not yet available, the
> compiler needs to mark it and defer the transformation. In other
> words, no profile meta data is needed for further analysis.  Instead
> of doing this, I think it is better to delay IC promotion after
> importing in cross module mode.
>

my current heuristic is based on the counts and the target function taken ratio.
as far as we update the valuecount and total count correctly, it will
have the same result doing in one place or multiple places.


> David
>>
>> -Rong
>>
>> On Thu, Feb 11, 2016 at 9:46 PM, Xinliang David Li <davidxl at google.com> wrote:
>>> On Thu, Feb 11, 2016 at 9:05 AM, Rong Xu <xur at google.com> wrote:
>>>> xur added a comment.
>>>>
>>>> my indirect-call promotion implementation supports multiple targets (specified the by an option)  for a single callsite and the transformation pass can be called multiple times. The promotion stops at the first non-promoted direct target (as it's sorted on the count).
>>>>
>>>> For example, for a callsite with the the following valuedata {<func1, 100> <func2, 80> <func3,10>}, after we promote func1 and cannot promote func2, I will attach {<func2, 80> <func3, 10>} to the indirect-call instruction.
>>>>
>>>
>>> What if the hottest callee is external, but the second hottest can be
>>> resolved intra-module?  Promoting such site can lead to sub-optimal
>>> transformation overall.  I think it is better to delay promotion
>>> transformation (in thinLTO mode) until after importing occurs.
>>>
>>> David
>>>
>>>
>>>>
>>>> http://reviews.llvm.org/D17108
>>>>
>>>>
>>>>


More information about the llvm-commits mailing list