[PATCH] D107173: [CSSPGO] Introduce MD5-based context-sensitive profile

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 2 11:03:12 PDT 2021


wmi added a comment.

In D107173#2917462 <https://reviews.llvm.org/D107173#2917462>, @hoy wrote:

> In D107173#2917382 <https://reviews.llvm.org/D107173#2917382>, @wmi wrote:
>
>> Thanks for the work to reduce the CS profile size! It is something we really need.
>>
>> I am also trying it in a slightly different way. 
>> For "[main:3.1 @ _Z5funcBi]:120:19" in your example, I split the context string into multiple tuples of {string, line, discriminator}: 
>> {main, 3, 1} {_Z5funcBi, 0, 0}, and for each name in the tuple, we will only save the index to the name table. So we will not have new entry in the name table for different contexts.
>>
>> In this way, we won't have any increase in the name table section compared with non-CS profile even when we uses string based name. We do need to have a new section called CSNameTable to store the tuples. When we read the section, we will recontruct the context string from the tuple and the rest of the profile handling will have no change.
>>
>> In this way, on top of it we can also apply md5 to the nametable using existing md5 mechanism, to further compress the name table section.
>>
>> I havn't finished the implemention, but I am close to it. It will be good to discuss how we converge the effort here.
>
> @wmi  good to know you are also working on improving the efficiency. Thanks!
> The string split design sounds interesting. I'm curious to know more about it, like how context strings are split in the profile, and how they are constructed and represented in the compiler.

Hi hongtao, this is the implementation: https://reviews.llvm.org/D107299. It splits the context to deduplicate the function names during profile writing, and reconstructs the context string during profile reading.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107173



More information about the llvm-commits mailing list