Commit b131b583 by Teresa Johnson Committed by Jan Hubicka

predict.c (maybe_hot_count_p): Use threshold from profiled working set instead of hard limit.


	* predict.c (maybe_hot_count_p): Use threshold from profiled working
	set instead of hard limit.
	(cgraph_maybe_hot_edge_p): Invoke maybe_hot_count_p() instead of
	directly checking limit.
	* params.def (HOT_BB_COUNT_FRACTION): Remove.
	(HOT_BB_COUNT_WS_PERMILLE): New parameter.
	* invoke.texi (hot-bb-count-fraction): Remove.
	(hot-bb-count-ws-permille): Document.

Co-Authored-By: Jan Hubicka <jh@suse.cz>

From-SVN: r193747
parent 3409d40e
2012-11-22 Teresa Johnson <tejohnson@google.com>
Jan Hubicka <jh@suse.cz>
* predict.c (maybe_hot_count_p): Use threshold from profiled working
set instead of hard limit.
(cgraph_maybe_hot_edge_p): Invoke maybe_hot_count_p() instead of
directly checking limit.
* params.def (HOT_BB_COUNT_FRACTION): Remove.
(HOT_BB_COUNT_WS_PERMILLE): New parameter.
* invoke.texi (hot-bb-count-fraction): Remove.
(hot-bb-count-ws-permille): Document.
2012-11-22 Vladimir Makarov <vmakarov@redhat.com> 2012-11-22 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/55430 PR middle-end/55430
...@@ -9224,9 +9224,9 @@ doing loop versioning for alias in the vectorizer. See option ...@@ -9224,9 +9224,9 @@ doing loop versioning for alias in the vectorizer. See option
The maximum number of iterations of a loop the brute-force algorithm The maximum number of iterations of a loop the brute-force algorithm
for analysis of the number of iterations of the loop tries to evaluate. for analysis of the number of iterations of the loop tries to evaluate.
@item hot-bb-count-fraction @item hot-bb-count-ws-permille
Select fraction of the maximal count of repetitions of basic block in program A basic block profile count is considered hot if it contributes to
given basic block needs to have to be considered hot. the given permillage (i.e. 0...1000) of the entire profiled execution.
@item hot-bb-frequency-fraction @item hot-bb-frequency-fraction
Select fraction of the entry block frequency of executions of basic block in Select fraction of the entry block frequency of executions of basic block in
......
...@@ -365,10 +365,11 @@ DEFPARAM(PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD, ...@@ -365,10 +365,11 @@ DEFPARAM(PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD,
"A threshold on the average loop count considered by the swing modulo scheduler", "A threshold on the average loop count considered by the swing modulo scheduler",
0, 0, 0) 0, 0, 0)
DEFPARAM(HOT_BB_COUNT_FRACTION, DEFPARAM(HOT_BB_COUNT_WS_PERMILLE,
"hot-bb-count-fraction", "hot-bb-count-ws-permille",
"Select fraction of the maximal count of repetitions of basic block in program given basic block needs to have to be considered hot", "A basic block profile count is considered hot if it contributes to "
10000, 0, 0) "the given permillage of the entire profiled execution",
999, 0, 1000)
DEFPARAM(HOT_BB_FREQUENCY_FRACTION, DEFPARAM(HOT_BB_FREQUENCY_FRACTION,
"hot-bb-frequency-fraction", "hot-bb-frequency-fraction",
"Select fraction of the maximal frequency of executions of basic block in function given basic block needs to have to be considered hot", "Select fraction of the maximal frequency of executions of basic block in function given basic block needs to have to be considered hot",
...@@ -392,7 +393,7 @@ DEFPARAM (PARAM_ALIGN_LOOP_ITERATIONS, ...@@ -392,7 +393,7 @@ DEFPARAM (PARAM_ALIGN_LOOP_ITERATIONS,
flatten the profile. flatten the profile.
We need to cut the maximal predicted iterations to large enough iterations We need to cut the maximal predicted iterations to large enough iterations
so the loop appears important, but safely within HOT_BB_COUNT_FRACTION so the loop appears important, but safely within maximum hotness
range. */ range. */
DEFPARAM(PARAM_MAX_PREDICTED_ITERATIONS, DEFPARAM(PARAM_MAX_PREDICTED_ITERATIONS,
......
...@@ -134,13 +134,20 @@ maybe_hot_frequency_p (struct function *fun, int freq) ...@@ -134,13 +134,20 @@ maybe_hot_frequency_p (struct function *fun, int freq)
static inline bool static inline bool
maybe_hot_count_p (struct function *fun, gcov_type count) maybe_hot_count_p (struct function *fun, gcov_type count)
{ {
if (profile_status_for_function (fun) != PROFILE_READ) gcov_working_set_t *ws;
static gcov_type min_count = -1;
if (fun && profile_status_for_function (fun) != PROFILE_READ)
return true; return true;
/* Code executed at most once is not hot. */ /* Code executed at most once is not hot. */
if (profile_info->runs >= count) if (profile_info->runs >= count)
return false; return false;
return (count if (min_count == -1)
> profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)); {
ws = find_working_set (PARAM_VALUE (HOT_BB_COUNT_WS_PERMILLE));
gcc_assert (ws);
min_count = ws->min_counter;
}
return (count >= min_count);
} }
/* Return true in case BB can be CPU intensive and should be optimized /* Return true in case BB can be CPU intensive and should be optimized
...@@ -161,8 +168,8 @@ bool ...@@ -161,8 +168,8 @@ bool
cgraph_maybe_hot_edge_p (struct cgraph_edge *edge) cgraph_maybe_hot_edge_p (struct cgraph_edge *edge)
{ {
if (profile_info && flag_branch_probabilities if (profile_info && flag_branch_probabilities
&& (edge->count && !maybe_hot_count_p (NULL,
<= profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION))) edge->count))
return false; return false;
if (edge->caller->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED if (edge->caller->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
|| (edge->callee || (edge->callee
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment