[PATCH] D94110: [CSSPGO][llvm-profgen] Aggregate samples on call frame trie to speed up profile generation

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 11:04:17 PST 2021


wlei added a comment.

> Thanks for the experiment. 
> LBR-Trie is faster than Global-Trie. Does it mean there is not enough callstack overlap between different LBR samples?

Thanks for your reminder. I just tried the experiment on aggregation on callstack only, see the chart below. The column means the size of the sample map aggregated by Callstack+LBR  or Callstack only.

|       | Callstack+LBR | Callstack | Ratio |
| ----- | ------------- | --------- | ----- |
| gobmk | 1387155             | 993516    | 1.40  |
| sjeng | 158270        | 133629    | 1.18  |
| gcc   | 9281          | 7610      | 1.22  |
|

you see there is only 20%~40% more save if we use only callstack for aggregation.

> And could you elaborate what is the hash overhead?

I meant we use a global trie instead of the intra LBR trie, in that case all the frame in the call stack and branch in LBR is a node in the trie. 
Then the trie is probably very huge and each node might have a lot of children. We use the `unordered_map` to create or get children, if the num of children is big, the `unordered_map` lookup might not be O(1). This is what I mean the hash overhead. For intra LBR trie, we only have 16 entries so the num of children is small, should be fine with `unordered_map` look-up.

>> Thanks for the quick experiment! Given that we don't see immediate speed up from global trie, I'm inclined to just use what you have in this patch, and defer further improvement for the future. What do you think?
>
> I assume the time in the table is in seconds -- 19.15 seconds for sjeng using LBR-Trie, and that is not very long. I agree with Wenlei you can leave the improvement for the future.

Yeah, it's in second, for my experiments all the benchmarks in SPEC(train data) could be finished in one minute.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94110



More information about the llvm-commits mailing list