public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Rong Xu <xur@google.com>
Cc: Richard Henderson <rth@redhat.com>,
	Richard Biener <richard.guenther@gmail.com>,
	Andrew Pinski <pinskia@gmail.com>,
	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: Mon, 26 May 2014 06:01:00 -0000	[thread overview]
Message-ID: <20140526060102.GA24432@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <CAF1bQ=SunHvCyYjN7k-qcqi7C65kRxp=9RE56EsjzAvJRZYe9w@mail.gmail.com>

> 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.

      parent reply	other threads:[~2014-05-26  6:01 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
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 [this message]

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=20140526060102.GA24432@atrey.karlin.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=davidxl@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=reply@codereview.appspotmail.com \
    --cc=richard.guenther@gmail.com \
    --cc=rth@redhat.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).