[PATCH] D153486: [llvm-profdata] GUIDToFuncNameMap can be static

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 21:34:23 PDT 2023


davidxl added a comment.

In D153486#4445656 <https://reviews.llvm.org/D153486#4445656>, @wenlei wrote:

> In D153486#4445610 <https://reviews.llvm.org/D153486#4445610>, @davidxl wrote:
>
>> We should consider having singleton instance and use LLVM's synchronization support to guard updating. Assuming updating the map is rare so the contention should have low runtime impact.
>
> Essentially this is per-module map that needs to be accessed from FunctionSamples. For local (non-distributed) ThinLTO, each thin-backend thread will build part of the map (for symbols in that module) and access that part of the map, so write is not uncommon and contention could be common. I think TLS is the best option if it's available to use.

Is this map initialized once and used mostly readonly? if that is the case, serializing initialization from all threads (in the order of tens, not hundreds) is no different from one static initialization done globally.  Anyway, the effect needs to be measured to verify.

> OTOH, what's the total size of FunctionSamples, and how significant is saving 8 byte in it?




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153486



More information about the llvm-commits mailing list