[PATCH] D158889: [AsmPrinter][PGO] Adds optional dumping of branch probabilities for PGO metrics.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 10:54:42 PDT 2023


hoy added a comment.

In D158889#4621393 <https://reviews.llvm.org/D158889#4621393>, @red1bluelost wrote:

> In D158889#4619737 <https://reviews.llvm.org/D158889#4619737>, @hoy wrote:
>
>> In D158889#4618519 <https://reviews.llvm.org/D158889#4618519>, @wenlei wrote:
>>
>>> We have something similar internally, but didn't upstream because we are not sure if the use case is too narrow to justify burdening the code base with all the related complexity.  cc @hoy
>>
>> Yeah, we internally serialize machine block execution counts to the binary.  Would it be helpful to write those counts into some bb section similar to the `llvm_bb_addr_map` section?
>
> This is interesting and similar but our metrics are only focusing on branch weights at the moment. We've focused on branch weights so far since they are a direct result of Profile Loading.
>
> At least for the current state of the metrics here and consumed in D158890 <https://reviews.llvm.org/D158890>, there is not a use for block counts but it could be a future extension of the metrics.

Thanks for the information. Maybe we can look into encoding block counts metrics somewhere.

A bit more context about our use case: we use block counts to check if the compiler does a good job maintaining the input profile quality throughout its pipeline. Using branch weights would require an offline BFI computation to recover the block counts based on the branch weights, which may not give as accurate information as the profiler (such as the LBR profiler) gives.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158889/new/

https://reviews.llvm.org/D158889



More information about the llvm-commits mailing list