[PATCH] D70688: [PGO] Add Value Profiling for Loop Trip Count (WIP)

wael yehia via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 08:47:27 PDT 2022


w2yehia added a comment.

In D70688#3395357 <https://reviews.llvm.org/D70688#3395357>, @hoy wrote:

> The work is interesting. I'm wondering if it is still ongoing. I haven't looked into the implementation details here yet, but here are a couple basic questions:
>
> 1. Does the generated loop MD reflect the average loop trip count per loop run or the accumulated total trip count for all runs of the loop?
> 2. How does the generated loop MD differ from the synthesized loop tripe count based on the branch_weight metadata?
> 3. Have you seen a particular loop optimization pass benefits from this work?
>
> Thanks.

Hi, we currently have this implementation downstream more or less. Feel free to contribute or even take over. I just haven't found the time to push this through further.

1. No, not the average. The loop MD will contain a set of the most frequent trip counts observed, with the frequency of each trip count.
2. implied from (1): the branch_weight MD will give the average trip count, while the loop MD will give exact numbers
3. you first version the code and then knowing the trip count at compile time you can vectorize and any loop optimization that benefits from having a constant trip count.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D70688



More information about the llvm-commits mailing list