It would be great if this can make into gcc4.8. The patch has close to
0 impact on code stability.

David

On Fri, Dec 28, 2012 at 11:32 AM, Rong Xu <x...@google.com> wrote:
> Hi Honza,
>
> In the other thread of discussion (similar patch in google-4_7
> branch), you said you were thinking if to let this patch into trunk in
> stage 3. Can you give some update?
>
> Thanks,
>
> -Rong
>
> On Fri, Dec 21, 2012 at 10:37 AM, Rong Xu <x...@google.com> wrote:
>> On Fri, Dec 21, 2012 at 1:25 AM, Jan Hubicka <hubi...@ucw.cz> wrote:
>>>> Hi,
>>>>
>>>> This patch adds support of atomic update of profiles counters. The goal is 
>>>> to improve
>>>> the poor counter values for highly thread programs.
>>>>
>>>> The atomic update is under a new option -fprofile-gen-atomic=<N>
>>>> N=0: default, no atomic update
>>>> N=1: atomic update edge counters.
>>>> N=2: atomic update some of value profile counters (currently indirect-call 
>>>> and one value profile).
>>>> N=3: both edge counter and the above value profile counters.
>>>> Other value: fall back to the default.
>>>>
>>>> This patch is a simple porting of the version in google-4_7 branch. It 
>>>> uses __atomic_fetch_add
>>>> based on Andrew Pinski's suggestion. Note I did not apply to all the value 
>>>> profiles as
>>>> the indirect-call profile is the most relevant one here.
>>>>
>>>> Test with bootstrap.
>>>>
>>>> Comments and suggestions are welcomed.
>>>>
>>>> Thanks,
>>>>
>>>> -Rong
>>>>
>>>>
>>>> 2012-12-20  Rong Xu  <x...@google.com>
>>>>
>>>>       * libgcc/libgcov.c (__gcov_one_value_profiler_body_atomic): New
>>>>         function. Atomic update profile counters.
>>>>       (__gcov_one_value_profiler_atomic): Ditto.
>>>>       (__gcov_indirect_call_profiler_atomic): Ditto.
>>>>       * gcc/gcov-io.h: Macros for atomic update.
>>>>       * gcc/common.opt: New option.
>>>>       * gcc/tree-profile.c (gimple_init_edge_profiler): Atomic
>>>>         update profile counters.
>>>>       (gimple_gen_edge_profiler): Ditto.
>>>
>>> The patch looks resonable.  Eventually we probably should provide rest of 
>>> the value counters
>>> in thread safe manner.  What happens on targets not having atomic 
>>> operations?
>>
>> From 
>> http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#_005f_005fsync-Builtins,
>> it says:
>>       "If a particular operation cannot be implemented on the target
>> processor, a warning is generated and a call an external function is
>> generated. "
>>
>> So I think there will be a warning and eventually a link error of unsat.
>>
>> Thanks,
>>
>> -Rong
>>
>>
>>>
>>> Honza

Reply via email to