[PATCH] Add a lock() function in PassRegistry to speed up multi-thread synchronization.

Mehdi Amini mehdi.amini at apple.com
Tue Mar 3 09:47:19 PST 2015


Sorry I misread your first email about performance number, I thought you were seeing 5% improvement in a single threaded case.

This LGTM, and the performance improvement worth the little API complication IMO.

— 
Mehdi


> On Mar 2, 2015, at 1:35 AM, Erik Eckstein <eeckstein at apple.com> wrote:
> 
> yes. When omitting the call to PassRegistry::lock() I experience the 5% increased compile time.
> 
>> On 02 Mar 2015, at 10:33, Mehdi Amini <mehdi.amini at apple.com> wrote:
>> 
>> 
>>> On Mar 2, 2015, at 1:32 AM, Erik Eckstein <eeckstein at apple.com> wrote:
>>> 
>>>> You are mentioning 5% perf improvement in single-threaded release build, can you tell how to reproduce?
>>> 
>>> 
>>> It is reproducible in following scenario:
>>> 
>>> 4 threads on a 3,2 GHz Intel Core i5
>>> 
>>> A shared working queue contains ~100 independent llvm modules  (each llvm module has its own LLVMContext).
>>> Each thread runs following loop:
>>> 
>>> while queue is not empty {
>>> 
>>> fetch an llvm module from the working queue
>>> create llvm passes
>>> call PassRegistry::lock()
>>> run the llvm passes
>>> 
>>> }
>> 
>> This is the multi-threaded scenario isn’t it?
>> 
>> Thanks,
>> 
>>>> Mehdi
>> 
> 





More information about the llvm-commits mailing list