Re: atomic update of profile counters (issue7000044)

2014-05-25 Thread Jan Hubicka
> 2013-11-19 Rong Xu > > * gcc/gcov-io.h: Add atomic function macros for compiler use. > * gcc/common.opt (fprofile-generate-atomic): New option. > * gcc/tree-profile.c (gimple_init_edge_profiler): Support for > atomic counter update. > (gimple_gen_edge_profiler)

Re: atomic update of profile counters (issue7000044)

2013-11-20 Thread Rong Xu
OK. Sorry for miss-reading the message. In that case, linking in libatomic becomes a separate issue. We don't need to touch gcc.c in this patch. Thanks, -Rong On Wed, Nov 20, 2013 at 2:19 PM, Andrew Pinski wrote: > On Wed, Nov 20, 2013 at 2:07 PM, Rong Xu wrote: >> Joseph and Andrew, thanks fo

Re: atomic update of profile counters (issue7000044)

2013-11-20 Thread Andrew Pinski
On Wed, Nov 20, 2013 at 2:07 PM, Rong Xu wrote: > Joseph and Andrew, thanks for the suggestion. That's really helpful. > > Here is the new patch for gcc.c. > Basically, it's just what you have suggested: enclosing -latomic with > --as-needed, and using macros. > For the case of no --as-needed supp

Re: atomic update of profile counters (issue7000044)

2013-11-20 Thread Rong Xu
Joseph and Andrew, thanks for the suggestion. That's really helpful. Here is the new patch for gcc.c. Basically, it's just what you have suggested: enclosing -latomic with --as-needed, and using macros. For the case of no --as-needed support, I use static link. (just found that some code already u

Re: atomic update of profile counters (issue7000044)

2013-11-20 Thread Joseph S. Myers
On Wed, 20 Nov 2013, Rong Xu wrote: > I could do this in the SPEC > -Wl,-Bstatic -latomic -Wl,-Bdynamic > which would link libatomic statically. > I works for me. But it looks a little weird in gcc driver. I think we should generally link libatomic with --as-needed by default on platforms supp

Re: atomic update of profile counters (issue7000044)

2013-11-20 Thread Andrew Pinski
On Wed, Nov 20, 2013 at 10:48 AM, Andrew Pinski wrote: > On Wed, Nov 20, 2013 at 10:44 AM, Rong Xu wrote: >> On Tue, Nov 19, 2013 at 5:11 PM, Andrew Pinski wrote: >>> On Tue, Nov 19, 2013 at 5:02 PM, Rong Xu wrote: Hi all, I merged this old patch with current trunk. I also make t

Re: atomic update of profile counters (issue7000044)

2013-11-20 Thread Andrew Pinski
On Wed, Nov 20, 2013 at 10:44 AM, Rong Xu wrote: > On Tue, Nov 19, 2013 at 5:11 PM, Andrew Pinski wrote: >> On Tue, Nov 19, 2013 at 5:02 PM, Rong Xu wrote: >>> Hi all, >>> >>> I merged this old patch with current trunk. I also make the following >>> changes >>> (1) not using weak references. No

Re: atomic update of profile counters (issue7000044)

2013-11-20 Thread Rong Xu
On Tue, Nov 19, 2013 at 5:11 PM, Andrew Pinski wrote: > On Tue, Nov 19, 2013 at 5:02 PM, Rong Xu wrote: >> Hi all, >> >> I merged this old patch with current trunk. I also make the following changes >> (1) not using weak references. Now every *profile_atomic() has it's >> own .o so that none of t

Re: atomic update of profile counters (issue7000044)

2013-11-19 Thread Andrew Pinski
On Tue, Nov 19, 2013 at 5:02 PM, Rong Xu wrote: > Hi all, > > I merged this old patch with current trunk. I also make the following changes > (1) not using weak references. Now every *profile_atomic() has it's > own .o so that none of them will be in the final binary if > -fprofile-generate-atomic

Re: atomic update of profile counters (issue7000044)

2013-11-19 Thread Rong Xu
Hi all, I merged this old patch with current trunk. I also make the following changes (1) not using weak references. Now every *profile_atomic() has it's own .o so that none of them will be in the final binary if -fprofile-generate-atomic is not specified. (2) more value profilers have the atomic

Re: atomic update of profile counters (issue7000044)

2013-01-07 Thread Rong Xu
Function __gcov_indirect_call_profiler_atomic (which contains call to the atomic function) is always emitted in libgcov. Since we only link libatomic when -fprofile-gen-atomic is specified, we have to make the atomic function weak -- otherwise, there is a unsat for regular FDO gen build (of course,

Re: atomic update of profile counters (issue7000044)

2013-01-07 Thread Richard Henderson
On 01/03/2013 04:42 PM, Rong Xu wrote: > It links libatomic when -fprofile-gen-atomic is specified for FDO > instrumentation build. Here I assume libatomic is always installed. > Andrew: do you think if this is reasonable? > > It also disables the functionality if target does not support weak > (i

Re: atomic update of profile counters (issue7000044)

2013-01-03 Thread Rong Xu
Here is the new patch. It links libatomic when -fprofile-gen-atomic is specified for FDO instrumentation build. Here I assume libatomic is always installed. Andrew: do you think if this is reasonable? It also disables the functionality if target does not support weak (ie. TARGET_SUPPORTS_WEAK ==

Re: atomic update of profile counters (issue7000044)

2013-01-03 Thread Richard Biener
On Thu, Jan 3, 2013 at 2:25 AM, Andrew Pinski wrote: > On Wed, Jan 2, 2013 at 5:15 PM, Rong Xu 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

Re: atomic update of profile counters (issue7000044)

2013-01-02 Thread Andrew Pinski
On Wed, Jan 2, 2013 at 5:29 PM, Rong Xu 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

Re: atomic update of profile counters (issue7000044)

2013-01-02 Thread Rong Xu
Does libatomic support all targets? 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 wrote: > On Wed, Jan 2, 2013 at 5:15 PM, Rong Xu wrote:

Re: atomic update of profile counters (issue7000044)

2013-01-02 Thread Andrew Pinski
On Wed, Jan 2, 2013 at 5:15 PM, Rong Xu 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-a

Re: atomic update of profile counters (issue7000044)

2013-01-02 Thread Rong Xu
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 regu

Re: atomic update of profile counters (issue7000044)

2012-12-28 Thread Xinliang David Li
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 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

Re: atomic update of profile counters (issue7000044)

2012-12-28 Thread Rong Xu
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 wrote: > On Fri, Dec 21, 2012 at 1:25 AM, Jan Hubicka wrot

Re: atomic update of profile counters (issue7000044)

2012-12-21 Thread Rong Xu
On Fri, Dec 21, 2012 at 1:25 AM, Jan Hubicka 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=0: default, no

Re: atomic update of profile counters (issue7000044)

2012-12-21 Thread Jan Hubicka
> 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=0: default, no atomic update > N=1: atomic update edge counters. > N=2: a