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

Issue 7059044: [google 4-7] adjust single target i-call heursitic

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by xur
Modified:
11 years, 2 months ago
Reviewers:
davidxl
CC:
gcc-patches_gcc.gnu.org
Base URL:
svn+ssh://gcc.gnu.org/svn/gcc/branches/google/gcc-4_7/
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+21 lines, -2 lines) Patch
M gcc/params.def View 2 chunks +14 lines, -0 lines 0 comments Download
M gcc/value-prof.c View 2 chunks +7 lines, -2 lines 0 comments Download

Messages

Total messages: 2
xur
Hi, This patch adjusts the single target indirect call promotion heuristics. (1) it uses bb ...
11 years, 2 months ago (2013-01-05 01:28:54 UTC) #1
davidxl
11 years, 2 months ago (2013-01-05 03:42:04 UTC) #2
Need to document the parameter in doc/invoke.texi.

Ok with that change.

David

On Fri, Jan 4, 2013 at 5:28 PM, Rong Xu <xur@google.com> wrote:
> Hi,
>
> This patch adjusts the single target indirect call promotion heuristics.
> (1) it uses bb counts (bb_all), instead of count "all" which only counts
> the targets with the same modules as the caller.
> (becaue __gcov_indirect_call_callee is file scope statics).
> Using overall bb counts makes more sense here.
> (2) use a prameter option to control the threshold.
> (3) change the default threshold from 75% to 67%.
>
> Tested with google internal benchmarks and gcc regression test.
>
> Thanks,
>
> -Rong
>
> 2013-01-04  Rong Xu  <xur@google.com>
>
>         * gcc/value-prof.c (gimple_ic_transform_single_targ):
>         adjust the single_target i_call promotion heuristics.
>         * gcc/params.def.h: Add new parameter options.
> Index: gcc/value-prof.c
> ===================================================================
> --- gcc/value-prof.c    (revision 194916)
> +++ gcc/value-prof.c    (working copy)
> @@ -1491,16 +1491,20 @@ gimple_ic_transform_single_targ (gimple stmt, hist
>    gcov_type prob;
>    gimple modify;
>    struct cgraph_node *direct_call;
> +  int perc_threshold, count_threshold;
>
>    val = histogram->hvalue.counters [0];
>    count = histogram->hvalue.counters [1];
>    all = histogram->hvalue.counters [2];
>    gimple_remove_histogram_value (cfun, stmt, histogram);
> +  bb_all = gimple_bb (stmt)->count;
>
> -  if (4 * count <= 3 * all)
> +  perc_threshold = PARAM_VALUE
(PARAM_SINGLE_ICALL_PROMOTE_PERCENT_THRESHOLD);
> +  count_threshold = PARAM_VALUE
(PARAM_SINGLE_ICALL_PROMOTE_COUNT_THRESHOLD);
> +
> +  if (100 * count < bb_all * perc_threshold || count < count_threshold)
>      return false;
>
> -  bb_all = gimple_bb (stmt)->count;
>    /* The order of CHECK_COUNTER calls is important -
>       since check_counter can correct the third parameter
>       and we want to make count <= all <= bb_all. */
> @@ -1508,6 +1512,7 @@ gimple_ic_transform_single_targ (gimple stmt, hist
>        || check_counter (stmt, "ic", &count, &all, all))
>      return false;
>
> +  all = bb_all;
>    if (all > 0)
>      prob = (count * REG_BR_PROB_BASE + all / 2) / all;
>    else
> Index: gcc/params.def
> ===================================================================
> --- gcc/params.def      (revision 194916)
> +++ gcc/params.def      (working copy)
> @@ -907,6 +907,7 @@ DEFPARAM (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP,
>  /* Promote indirect call to conditional direct call only
>     when the percentage of the target count over the total
>     indirect call count is no smaller than the threshold.  */
> +/* For multi-targ indirect_call.  */
>  DEFPARAM (PARAM_ICALL_PROMOTE_PERCENT_THRESHOLD,
>           "icall-promote-target-percent-threshold",
>           "percentage threshold for direct call promotion"
> @@ -919,6 +920,19 @@ DEFPARAM (PARAM_ICALL_PROMOTE_COUNT_THRESHOLD,
>            " of a callee target",
>           1, 0, 0)
>
> +/* For single-targ indirect_call.  */
> +DEFPARAM (PARAM_SINGLE_ICALL_PROMOTE_PERCENT_THRESHOLD,
> +         "single_icall-promote-target-percent-threshold",
> +         "percentage threshold for direct call promotion"
> +          " of a callee target",
> +         67, 0, 100)
> +
> +DEFPARAM (PARAM_SINGLE_ICALL_PROMOTE_COUNT_THRESHOLD,
> +         "single_icall-promote-target_count-threshold",
> +         "call count threshold for direct call promotion"
> +          " of a callee target",
> +         1, 0, 0)
> +
>  /* 0: do not always inline icall target:
>     other value: always inline icall target when call count
>     exceeds this value.
>
> --
> This patch is available for review at http://codereview.appspot.com/7059044
Sign in to reply to this message.

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