From: Jan Hubicka <hubicka@ucw.cz>
To: Teresa Johnson <tejohnson@google.com>
Cc: reply@codereview.appspotmail.com, hubicka@ucw.cz,
gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Stream profile summary histogram through LTO files (issue6782131)
Date: Thu, 29 Nov 2012 16:17:00 -0000 [thread overview]
Message-ID: <20121129161744.GA26688@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <20121129041116.DB81E61422@tjsboxrox.mtv.corp.google.com>
> 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
> + /* 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.
> + 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.
> -#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.
Thanks,
Honza
next prev parent reply other threads:[~2012-11-29 16:17 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 [this message]
2012-11-29 16:46 ` Teresa Johnson
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=20121129161744.GA26688@atrey.karlin.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=reply@codereview.appspotmail.com \
--cc=tejohnson@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).