Allow merging of units with profile feedback run different amount of times
H.J. Lu
hjl.tools@gmail.com
Sat Dec 4 21:35:00 GMT 2010
On Sat, Dec 4, 2010 at 11:33 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this patch adds support for merging compilation units with profile feedbacks where
> each unit was run different times. This is neccesary for LTO profiledbootstrap
> since we do have single libbackend linked into multiple binaries. As a result
> libbackend summaries are trained more times than each of individual binaries.
> It would make more sense to instrument at link time and have profile feedback for
> each binary separately but this will require more changes and thus can't be done
> in stage3.
>
> This patch simply makes the profiles to be scaled up to the largest number of runs
> in the whole program. This allows profiledbootstrap to pass on x86-64 for C only
> compiler. Resulting compiler seems smaller and faster than one built with LTO
> only, so it seems to work as expected.
>
> Merging is done by reading in profile summaries per file basis and storing them in
> lto_file_decl_data. At the end the maximal number of runs is found and
> profiles are re-scaled to work out global sum_max, in merge_profile_summaries.
> We also need to update callgraph counts that is done in merge_profile_summaries
> and BB/edge counts that is done in lto-streamer based on
> count_materialization_scale stored in cgraph nodes.
>
> I will look into failures appearing in C++ and Ada build (profile mismatches).
>
> Bootstrapped/regtested x86_64-linux, will commit it shortly.
>
> PR tree-optimization/46760
> * cgraph.c (cgraph_create_node): Initialize count_materialization_scale.
> * cgraph.h (struct cgraph_node): Add count_materialization_scale.
> * lto-cgraph.c (lto_output_edge): Fix assert.
> (lto_output_node): Output count_materialization_scale.
> (output_profile_summary): Output only runs and sum_max.
> (input_node): Input count_materialization_scale.
> (input_profile_summary): Read data into file specific gcov summary.
> (merge_profile_summaries): New function.
> (input_cgraph): Update call of input_profile_summary;
> call merge_profile_summaries.
> * lto-streamer-in.c (input_cfg): Add count_materialization_scale arg;
> rescale counts at read in.
> (intput_bb): Likewise.
> (input_function): Update call of input_bb.
> (lto_read_body): Update call of input_cfg.
> * lto-streamer.h: Inlclude gcov-io.h
> (lto_file_decl_data): Add gcov_ctr_summary.
It failed to bootstrap:
http://gcc.gnu.org/ml/gcc-regression/2010-12/msg00056.html
H.J.
---
More information about the Gcc-patches
mailing list