Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3826)

Issue 7000044: atomic update of profile counters

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 4 months ago by xur
Modified:
9 years, 11 months ago
Reviewers:
pinskia, richard.guenther, rth, davidxl, hubicka, joseph
CC:
gcc-patches_gcc.gnu.org
Base URL:
svn+ssh://gcc.gnu.org/svn/gcc/trunk/
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+91 lines, -5 lines) Patch
M gcc/common.opt View 1 chunk +9 lines, -0 lines 0 comments Download
M gcc/gcov-io.h View 2 chunks +20 lines, -0 lines 0 comments Download
M gcc/tree-profile.c View 3 chunks +28 lines, -5 lines 0 comments Download
M libgcc/libgcov.c View 2 chunks +34 lines, -0 lines 0 comments Download

Messages

Total messages: 23
xur
Hi, This patch adds support of atomic update of profiles counters. The goal is to ...
11 years, 4 months ago (2012-12-21 06:45:41 UTC) #1
hubicka_ucw.cz
> Hi, > > This patch adds support of atomic update of profiles counters. The ...
11 years, 4 months ago (2012-12-21 09:25:32 UTC) #2
xur
On Fri, Dec 21, 2012 at 1:25 AM, Jan Hubicka <hubicka@ucw.cz> wrote: >> Hi, >> ...
11 years, 4 months ago (2012-12-21 18:37:46 UTC) #3
xur
Hi Honza, In the other thread of discussion (similar patch in google-4_7 branch), you said ...
11 years, 4 months ago (2012-12-28 19:32:49 UTC) #4
davidxl
It would be great if this can make into gcc4.8. The patch has close to ...
11 years, 4 months ago (2012-12-28 19:35:13 UTC) #5
xur
Hi, Here is a new patch. The only difference is to declare __atomic_fetch_add as weak. ...
11 years, 4 months ago (2013-01-03 01:15:53 UTC) #6
pinskia_gmail.com
On Wed, Jan 2, 2013 at 5:15 PM, Rong Xu <xur@google.com> wrote: > Hi, > ...
11 years, 4 months ago (2013-01-03 01:25:24 UTC) #7
xur
Does libatomic support all targets? I think it's a good idea to change the driver ...
11 years, 4 months ago (2013-01-03 01:29:44 UTC) #8
pinskia_gmail.com
On Wed, Jan 2, 2013 at 5:29 PM, Rong Xu <xur@google.com> wrote: > Does libatomic ...
11 years, 4 months ago (2013-01-03 01:31:42 UTC) #9
richard.guenther_gmail.com
On Thu, Jan 3, 2013 at 2:25 AM, Andrew Pinski <pinskia@gmail.com> wrote: > On Wed, ...
11 years, 4 months ago (2013-01-03 09:05:22 UTC) #10
xur
Here is the new patch. It links libatomic when -fprofile-gen-atomic is specified for FDO instrumentation ...
11 years, 4 months ago (2013-01-04 00:42:18 UTC) #11
rth_redhat.com
On 01/03/2013 04:42 PM, Rong Xu wrote: > It links libatomic when -fprofile-gen-atomic is specified ...
11 years, 3 months ago (2013-01-07 20:36:10 UTC) #12
xur
Function __gcov_indirect_call_profiler_atomic (which contains call to the atomic function) is always emitted in libgcov. Since ...
11 years, 3 months ago (2013-01-07 20:55:56 UTC) #13
xur
Hi all, I merged this old patch with current trunk. I also make the following ...
10 years, 5 months ago (2013-11-20 01:02:41 UTC) #14
pinskia_gmail.com
On Tue, Nov 19, 2013 at 5:02 PM, Rong Xu <xur@google.com> wrote: > Hi all, ...
10 years, 5 months ago (2013-11-20 01:11:50 UTC) #15
xur
On Tue, Nov 19, 2013 at 5:11 PM, Andrew Pinski <pinskia@gmail.com> wrote: > On Tue, ...
10 years, 5 months ago (2013-11-20 18:44:07 UTC) #16
pinskia_gmail.com
On Wed, Nov 20, 2013 at 10:44 AM, Rong Xu <xur@google.com> wrote: > On Tue, ...
10 years, 5 months ago (2013-11-20 18:48:29 UTC) #17
pinskia_gmail.com
On Wed, Nov 20, 2013 at 10:48 AM, Andrew Pinski <pinskia@gmail.com> wrote: > On Wed, ...
10 years, 5 months ago (2013-11-20 18:59:22 UTC) #18
joseph_codesourcery.com
On Wed, 20 Nov 2013, Rong Xu wrote: > I could do this in the ...
10 years, 5 months ago (2013-11-20 21:04:38 UTC) #19
xur
Joseph and Andrew, thanks for the suggestion. That's really helpful. Here is the new patch ...
10 years, 5 months ago (2013-11-20 22:07:22 UTC) #20
pinskia_gmail.com
On Wed, Nov 20, 2013 at 2:07 PM, Rong Xu <xur@google.com> wrote: > Joseph and ...
10 years, 5 months ago (2013-11-20 22:19:25 UTC) #21
xur
OK. Sorry for miss-reading the message. In that case, linking in libatomic becomes a separate ...
10 years, 5 months ago (2013-11-20 22:28:26 UTC) #22
hubicka_ucw.cz
9 years, 11 months ago (2014-05-26 06:01:11 UTC) #23
> 2013-11-19  Rong Xu  <xur@google.com>
> 
> 	* 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): Ditto.
> 	* libgcc/libgcov-profiler.c 
> 	(__gcov_interval_profiler_atomic): Ditto.
> 	(__gcov_pow2_profiler_atomic): Ditto.
> 	(__gcov_one_value_profiler_body_atomic): Ditto.
> 	(__gcov_one_value_profiler_atomic): Ditto.
> 	(__gcov_indirect_call_profiler_atomic): Ditto.
> 	(__gcov_indirect_call_profiler_v2_atomic): Ditto.
> 	(__gcov_time_profiler_atomic): Ditto.
> 	(__gcov_average_profiler_atomic): Ditto.
> 	* gcc/gcc.c: Link libatomic when -fprofile-generate-atomic used.
> 	* libgcc/Makefile.in: Add atomic objects.
> 
> Index: gcc/common.opt
> ===================================================================
> --- gcc/common.opt	(revision 205053)
> +++ gcc/common.opt	(working copy)
> @@ -1684,6 +1684,15 @@ fprofile-correction
>  Common Report Var(flag_profile_correction)
>  Enable correction of flow inconsistent profile data input
>  
> +; fprofile-generate-atomic=0: default and disable atomical update.
> +; fprofile-generate-atomic=1: atomically update edge profile counters.
> +; fprofile-generate-atomic=2: atomically update value profile counters.
> +; fprofile-generate-atomic=3: atomically update edge and value profile
counters.
> +; other values will be ignored (fall back to the default of 0).
> +fprofile-generate-atomic=
> +Common Joined UInteger Report Var(flag_profile_generate_atomic) Init(3)
Optimization
> +fprofile-generate-atomic=[0..3] Atomical increments of profile counters.

Instead magic numbers I would preffer flags, like "edge" and "value"
and permiting combinations like -ffprofile-generate-atomic=edge,value

I wonder about the option name, I suppose this option also combine with
-ftest-coverage
(and no longer too useful -fprofile-arcs), so the profile-generate prefix may be
bit
misleading here (giving an impression that it is not useful in this case).
But I can't think of something really better.

Other thing I wonder about is that we may want to implement alternative solution
with
TLS or smaller per-thread buffers and locked updates.  It would be bit difficult
to 
extend -fprofile-generate-atomic to this...

> @@ -155,6 +155,9 @@ gimple_init_edge_profiler (void)
>    tree ic_profiler_fn_type;
>    tree average_profiler_fn_type;
>    tree time_profiler_fn_type;
> +  const char *fn_name;
> +  bool profile_gen_value_atomic = (flag_profile_generate_atomic == 2 ||
> +                                   flag_profile_generate_atomic == 3);
>  
>    if (!gcov_type_node)
>      {

Will this work with optimization attributes?

The rest of patch looks OK, lets settle option name and get it in.
Sorry for dropping the ball for 4.8.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b