public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Teresa Johnson <tejohnson@google.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: reply@codereview.appspotmail.com,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Stream profile summary histogram through LTO files (issue6782131)
Date: Thu, 29 Nov 2012 16:46:00 -0000	[thread overview]
Message-ID: <CAAe5K+Xx=0E9biqpYcC-Ep7uaNKZFXJNzeUMHfDbaEJPKG+MrQ@mail.gmail.com> (raw)
In-Reply-To: <20121129161744.GA26688@atrey.karlin.mff.cuni.cz>

On Thu, Nov 29, 2012 at 8:17 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> This patch ensures that the histograms from the profile summary are streamed
>> through the LTO files so that the working set can be computed for use in
>> downstream optimizations.
>>
>> Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for trunk?
>>
>> Thanks,
>> Teresa
>>
>> 2012-11-28  Teresa Johnson  <tejohnson@google.com>
>>
>>       * lto-cgraph.c (output_profile_summary): Stream out sum_all
>>         and histogram.
>>       (input_profile_summary): Stream in sum_all and histogram.
>>       (merge_profile_summaries): Merge sum_all and histogram.
>>       (input_symtab): Call compute_working_sets after merging
>>         summaries.
>>       * gcov-io.c (gcov_histo_index): Make extern for compiler.
>>       * gcov-io.h (gcov_histo_index): Ditto.
>>       * profile.c (compute_working_sets): Remove static keyword.
>>       * profile.h (compute_working_sets): Ditto.
>
> OK.
>>
>> Index: lto-cgraph.c
>> ===================================================================
>> --- lto-cgraph.c      (revision 193909)
>> +++ lto-cgraph.c      (working copy)
>> @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3.  If not see
>>  #include "tree-streamer.h"
>>  #include "gcov-io.h"
>>  #include "tree-pass.h"
>> +#include "profile.h"
>
> Please update dependencies in Makefile.in

ok.

>> +      /* Count number of non-zero histogram entries, and fill in a bit vector
>> +         of non-zero indices.  */
>> +         counters.  */
>> +      for (bv_ix = 0; bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE; bv_ix++)
>> +        histo_bitvector[bv_ix] = 0;
>> +      for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++)
>> +        {
>> +          if (profile_info->histogram[h_ix].num_counters > 0)
>> +            {
>> +              histo_bitvector[h_ix / 32] |= 1 << (h_ix % 32);
>> +              h_cnt++;
>> +            }
>
> I think this would be more readable if you just produced a bitpack instead of doing it
> by hand, like into gcov-io.

I assume you mean use the bitpack streaming functionality used other
places in lto-cgraph.c, and not change the way it is done in gcov-io.c
where this was cloned from? I will change the lto-cgraph.c code to use
the bitpacking.

>> +     lto_gcov_summary.sum_all = MAX (lto_gcov_summary.sum_all,
>> +                                     (file_data->profile_info.sum_all
>> +                                      * scale
>> +                                      + REG_BR_PROB_BASE / 2)
>> +                                     / REG_BR_PROB_BASE);
>
> Use RDIV for the scaling.

ok. This was cloned from the way we do other scalings in the same
function, I will change them all to use RDIV.

>> -#if IN_LIBGCOV || !IN_GCOV
>> +#if !IN_GCOV
>>  /* Determine the index into histogram for VALUE. */
>>
>> -static unsigned
>> +GCOV_LINKAGE unsigned
> I would probably go around the trouble of declaring this static in GCOV,
> so it is inlined at we do not bload libgcov more than needed.

Do you mean leave it static when IN_LIBGCOV? It isn't included when
IN_GCOV. I just need it extern when in the compiler. So do you mean
make it static when IN_LIBGCOV and GCOV_LINKAGE (i.e. extern) when
!IN_LIBGCOV?

Thanks,
Teresa

>
> Thanks,
> Honza



--
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413

  reply	other threads:[~2012-11-29 16:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29  4:11 Teresa Johnson
2012-11-29 16:17 ` Jan Hubicka
2012-11-29 16:46   ` Teresa Johnson [this message]
2012-11-29 16:55     ` Jan Hubicka
2012-11-30 15:11 Teresa Johnson
2012-11-30 16:17 ` 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='CAAe5K+Xx=0E9biqpYcC-Ep7uaNKZFXJNzeUMHfDbaEJPKG+MrQ@mail.gmail.com' \
    --to=tejohnson@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=reply@codereview.appspotmail.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).