From: Andrew Pinski <pinskia@gmail.com>
To: Rong Xu <xur@google.com>
Cc: Xinliang David Li <davidxl@google.com>,
Jan Hubicka <hubicka@ucw.cz>,
GCC Patches <gcc-patches@gcc.gnu.org>,
reply@codereview.appspotmail.com
Subject: Re: atomic update of profile counters (issue7000044)
Date: Thu, 03 Jan 2013 01:31:00 -0000 [thread overview]
Message-ID: <CA+=Sn1mP8491oPpu6_uQSvrhgGhtNBkyPzOf=tfpoyZeZajiew@mail.gmail.com> (raw)
In-Reply-To: <CAF1bQ=SUAqo4OCQrQ7UcSMfvRMoYuvR6g_u4-dTkK2HhTRmQDw@mail.gmail.com>
On Wed, Jan 2, 2013 at 5:29 PM, Rong Xu <xur@google.com> wrote:
> Does libatomic support all targets?
It supports all targets that support pthreads.
Thanks,
Andrew
> I think it's a good idea to change the driver to link in this library
> if the option is specified.
> But still, we need to make the builtin weak.
>
> Thanks,
>
> -Rong
>
> On Wed, Jan 2, 2013 at 5:25 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>> On Wed, Jan 2, 2013 at 5:15 PM, Rong Xu <xur@google.com> wrote:
>>> Hi,
>>>
>>> Here is a new patch. The only difference is to declare
>>> __atomic_fetch_add as weak. This is
>>> needed for targets without sync/atomic builtin support. The patch
>>> contains a call to the builtin regardless of the new options
>>> -fprofile-gen-atomic. This results in a unsat in these targets even
>>> for regular profile-gen built.
>>>
>>> With this new patch, if the user uses -fprofile-gen-atomic in these
>>> target, the generated code will seg fault.
>>>
>>> We think a better solution is to emit the builtin call only in these
>>> targets with the support, and give warning for non-supported target.
>>> But I did not find any target hook for this. Does anyone know how to
>>> do this?
>>
>> Why not use libatomic for those targets?
>>
>> Thanks,
>> Andrew Pinski
>>
>>
>>
>>>
>>> Thanks,
>>>
>>> -Rong
>>>
>>>
>>> On Fri, Dec 28, 2012 at 11:35 AM, Xinliang David Li <davidxl@google.com> wrote:
>>>> 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 <xur@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 <xur@google.com> wrote:
>>>>>> On Fri, Dec 21, 2012 at 1:25 AM, Jan Hubicka <hubicka@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 <xur@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
next prev parent reply other threads:[~2013-01-03 1:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-21 6:45 Rong Xu
2012-12-21 9:25 ` Jan Hubicka
2012-12-21 18:38 ` Rong Xu
2012-12-28 19:33 ` Rong Xu
2012-12-28 19:35 ` Xinliang David Li
2013-01-03 1:16 ` Rong Xu
2013-01-03 1:25 ` Andrew Pinski
2013-01-03 1:29 ` Rong Xu
2013-01-03 1:31 ` Andrew Pinski [this message]
2013-01-03 9:05 ` Richard Biener
2013-01-04 0:42 ` Rong Xu
2013-01-07 20:36 ` Richard Henderson
2013-01-07 20:56 ` Rong Xu
2013-11-20 7:03 ` Rong Xu
2013-11-20 7:20 ` Andrew Pinski
2013-11-20 19:59 ` Rong Xu
2013-11-20 20:08 ` Andrew Pinski
2013-11-20 20:31 ` Andrew Pinski
2013-11-20 23:18 ` Joseph S. Myers
2013-11-21 0:07 ` Rong Xu
2013-11-21 0:14 ` Andrew Pinski
2013-11-21 1:24 ` Rong Xu
2014-05-26 6:01 ` Jan Hubicka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+=Sn1mP8491oPpu6_uQSvrhgGhtNBkyPzOf=tfpoyZeZajiew@mail.gmail.com' \
--to=pinskia@gmail.com \
--cc=davidxl@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=reply@codereview.appspotmail.com \
--cc=xur@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).