[LLVMdev] multithreaded performance disaster with -fprofile-instr-generate (contention on profile counters)

Jonathan Roelofs jonathan at codesourcery.com
Thu Apr 17 10:11:24 PDT 2014



On 4/17/14, 9:48 AM, Kostya Serebryany wrote:
>
>
>
> On Thu, Apr 17, 2014 at 8:45 PM, Jonathan Roelofs <jonathan at codesourcery.com
> <mailto:jonathan at codesourcery.com>> wrote:
>
>     if (counter_is_local)
>        counter++
>        if (counter > threshold)
>          counter_is_local=false
>     else
>        increment_thread_local___counter()
>
>
> This might be another choice, but unless you implement
> increment_thread_local___counter() in some clever way
> it will still require the same RAM overhead as just keeping the counters in TLS
Right, so you wouldn't want to have every thread have its own copy of the whole 
list of counters, but I think you may be able to get away with keeping smaller 
per-thread pools, and bump-ptr allocating within those pools.
>
>
>


-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the llvm-dev mailing list