* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
@ 2012-02-10 22:43 ` steven at gcc dot gnu.org
2012-02-11 12:53 ` abel at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu.org @ 2012-02-10 22:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
Steven Bosscher <steven at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-02-10
CC| |abel at gcc dot gnu.org
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
2012-02-10 22:43 ` [Bug rtl-optimization/52203] " steven at gcc dot gnu.org
@ 2012-02-11 12:53 ` abel at gcc dot gnu.org
2012-02-13 8:49 ` abel at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: abel at gcc dot gnu.org @ 2012-02-11 12:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
Andrey Belevantsev <abel at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |abel at gcc dot gnu.org
|gnu.org |
--- Comment #1 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-02-11 12:52:38 UTC ---
Thanks, Zdenek and Steven, I'll look at this on Monday. I bet this is caused
by yet another insn without a reservation.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
2012-02-10 22:43 ` [Bug rtl-optimization/52203] " steven at gcc dot gnu.org
2012-02-11 12:53 ` abel at gcc dot gnu.org
@ 2012-02-13 8:49 ` abel at gcc dot gnu.org
2012-02-13 8:49 ` abel at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: abel at gcc dot gnu.org @ 2012-02-13 8:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
--- Comment #2 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-02-13 08:48:35 UTC ---
Well, in this case the insn is vcvtps2pd (from avx_cvtps2pd256 and
*avx_cvtps2pd256_2 patterns) but not having a reservation looks correct as the
manual says "decode type -- microcode". Uros, is that right? In this case,
the below fixes the test for me (and I was stupid enough not to do this in the
first place when this bug stream just started... However, we did fix some real
bugs.)
iff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 2af01ae..2829f60 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4265,9 +4265,10 @@ invoke_aftermath_hooks (fence_t fence, rtx best_insn,
int issue_more)
return issue_more;
}
-/* Estimate the cost of issuing INSN on DFA state STATE. */
+/* Estimate the cost of issuing INSN on DFA state STATE. Write to PEMPTY
+ true when INSN does not change the processor state. */
static int
-estimate_insn_cost (rtx insn, state_t state)
+estimate_insn_cost (rtx insn, state_t state, bool *pempty)
{
static state_t temp = NULL;
int cost;
@@ -4277,6 +4278,8 @@ estimate_insn_cost (rtx insn, state_t state)
memcpy (temp, state, dfa_state_size);
cost = state_transition (temp, insn);
+ if (pempty)
+ *pempty = (memcmp (temp, state, dfa_state_size) == 0);
if (cost < 0)
return 0;
@@ -4307,7 +4310,7 @@ get_expr_cost (expr_t expr, fence_t fence)
return 0;
}
else
- return estimate_insn_cost (insn, FENCE_STATE (fence));
+ return estimate_insn_cost (insn, FENCE_STATE (fence), NULL);
}
/* Find the best insn for scheduling, either via max_issue or just take
@@ -7020,7 +7023,7 @@ reset_sched_cycles_in_current_ebb (void)
{
int cost, haifa_cost;
int sort_p;
- bool asm_p, real_insn, after_stall, all_issued;
+ bool asm_p, real_insn, after_stall, all_issued, empty;
int clock;
if (!INSN_P (insn))
@@ -7047,7 +7050,7 @@ reset_sched_cycles_in_current_ebb (void)
haifa_cost = 0;
}
else
- haifa_cost = estimate_insn_cost (insn, curr_state);
+ haifa_cost = estimate_insn_cost (insn, curr_state, &empty);
/* Stall for whatever cycles we've stalled before. */
after_stall = 0;
@@ -7081,7 +7084,7 @@ reset_sched_cycles_in_current_ebb (void)
if (!after_stall
&& real_insn
&& haifa_cost > 0
- && estimate_insn_cost (insn, curr_state) == 0)
+ && estimate_insn_cost (insn, curr_state, NULL) == 0)
break;
/* When the data dependency stall is longer than the DFA stall,
@@ -7093,7 +7096,7 @@ reset_sched_cycles_in_current_ebb (void)
if ((after_stall || all_issued)
&& real_insn
&& haifa_cost == 0)
- haifa_cost = estimate_insn_cost (insn, curr_state);
+ haifa_cost = estimate_insn_cost (insn, curr_state, NULL);
}
haifa_clock += i;
@@ -7125,7 +7128,8 @@ reset_sched_cycles_in_current_ebb (void)
if (real_insn)
{
cost = state_transition (curr_state, insn);
- issued_insns++;
+ if (!empty)
+ issued_insns++;
if (sched_verbose >= 2)
{
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (2 preceding siblings ...)
2012-02-13 8:49 ` abel at gcc dot gnu.org
@ 2012-02-13 8:49 ` abel at gcc dot gnu.org
2012-02-13 15:54 ` ubizjak at gmail dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: abel at gcc dot gnu.org @ 2012-02-13 8:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
Andrey Belevantsev <abel at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ubizjak at gmail dot com
--- Comment #3 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-02-13 08:49:38 UTC ---
Even better with Uros in CC.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (3 preceding siblings ...)
2012-02-13 8:49 ` abel at gcc dot gnu.org
@ 2012-02-13 15:54 ` ubizjak at gmail dot com
2012-02-13 16:01 ` ubizjak at gmail dot com
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ubizjak at gmail dot com @ 2012-02-13 15:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
--- Comment #4 from Uros Bizjak <ubizjak at gmail dot com> 2012-02-13 15:54:28 UTC ---
(In reply to comment #2)
> Well, in this case the insn is vcvtps2pd (from avx_cvtps2pd256 and
> *avx_cvtps2pd256_2 patterns) but not having a reservation looks correct as the
> manual says "decode type -- microcode". Uros, is that right? In this case,
> the below fixes the test for me (and I was stupid enough not to do this in the
> first place when this bug stream just started... However, we did fix some real
> bugs.)
There is nothing wrong with insn definition, the problem is only that
attributes are missing. Attributes are considered a tool to fine-tune the
scheduler and in any case, gcc should not ICE on an insn without reservation.
The insn doesn't reserve anything in this case and scheduler should live with
this.
The bugs you are referring to were real bugs, where wrong or missing operand
was accessed from attribute calculation machinery.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (4 preceding siblings ...)
2012-02-13 15:54 ` ubizjak at gmail dot com
@ 2012-02-13 16:01 ` ubizjak at gmail dot com
2012-02-13 16:02 ` ubizjak at gmail dot com
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ubizjak at gmail dot com @ 2012-02-13 16:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
--- Comment #5 from Uros Bizjak <ubizjak at gmail dot com> 2012-02-13 16:00:27 UTC ---
(In reply to comment #4)
> The bugs you are referring to were real bugs, where wrong or missing operand
> was accessed from attribute calculation machinery.
... and PR 49014, where indeed insn without reservation crashed scheduler in
the same way. But there was a clear inconsistency in the model, so we got away
with the adjustment.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (5 preceding siblings ...)
2012-02-13 16:01 ` ubizjak at gmail dot com
@ 2012-02-13 16:02 ` ubizjak at gmail dot com
2012-02-13 21:14 ` steven at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ubizjak at gmail dot com @ 2012-02-13 16:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
--- Comment #6 from Uros Bizjak <ubizjak at gmail dot com> 2012-02-13 16:01:40 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
>
> > The bugs you are referring to were real bugs, where wrong or missing operand
> > was accessed from attribute calculation machinery.
>
> ... and PR 49014, where indeed insn without reservation crashed scheduler in
> the same way. But there was a clear inconsistency in the model, so we got away
> with the adjustment.
Maybe a warning in the logs could be emitted for insns without reservations?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (6 preceding siblings ...)
2012-02-13 16:02 ` ubizjak at gmail dot com
@ 2012-02-13 21:14 ` steven at gcc dot gnu.org
2012-02-14 6:57 ` abel at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu.org @ 2012-02-13 21:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
Steven Bosscher <steven at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu.org
--- Comment #7 from Steven Bosscher <steven at gcc dot gnu.org> 2012-02-13 21:14:35 UTC ---
A warning in the scheduler log for insns without a reservation would be nice.
Doing it from genautomata would be quite difficult, but the scheduler can
detect the situation easily and issue a diagnostic.
How does the Haifa scheduler handle such insns?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (7 preceding siblings ...)
2012-02-13 21:14 ` steven at gcc dot gnu.org
@ 2012-02-14 6:57 ` abel at gcc dot gnu.org
2012-03-07 12:01 ` abel at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: abel at gcc dot gnu.org @ 2012-02-14 6:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
--- Comment #8 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-02-14 06:56:10 UTC ---
Sorry, I didn't explain clearly from the start. Regarding the backend, I just
wanted to double check that for the given insn not having a reservation is
correct. Now that Uros confirmed this, I can proceed with the scheduler patch.
Uros and Steven, regarding the big picture, you can read the thread on PR
49014, starting from http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01801.html
(our first discussions with Bernd) and initial patch with the remainder of the
thread at http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00045.html. Basically,
we allow insns that recog as >=0 but do not change the DFA state, such insns do
not get counted against issue rate. I was wondering whether we could mark such
insns specially in the MD files and then assert that any other real insn should
affect the DFA. The reason for this was that at least three real backend bugs
(missing DFA attributes) were fixed due to the more strict checking the
selective scheduler makes wrt the Haifa scheduler.
Suprisingly, I could bootstrap x86-64 with just some hours of work with the
patch from http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00045.html (the patch
marks the offending insns with the new attribute and adds an assert; Uros, if
you can spot any insns there that indeed should have a reservation, I can make
a patch fixing those). However, at the time I gave in pursuing this work
further, as nobody was very fascinated with the idea and I didn't have much
free time.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (8 preceding siblings ...)
2012-02-14 6:57 ` abel at gcc dot gnu.org
@ 2012-03-07 12:01 ` abel at gcc dot gnu.org
2012-03-07 12:03 ` abel at gcc dot gnu.org
2012-04-13 9:37 ` abel at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: abel at gcc dot gnu.org @ 2012-03-07 12:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
--- Comment #9 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-03-07 12:00:42 UTC ---
Author: abel
Date: Wed Mar 7 12:00:37 2012
New Revision: 185036
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185036
Log:
PR rtl-optimization/52203
* sel-sched.c (estimate_insn_cost): New parameter pempty. Adjust
all callers to pass NULL except ...
(reset_sched_cycles_in_current_ebb): ... here, save the value
in new variable 'empty'. Increase issue_rate only for
non-empty insns.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/sel-sched.c
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (9 preceding siblings ...)
2012-03-07 12:01 ` abel at gcc dot gnu.org
@ 2012-03-07 12:03 ` abel at gcc dot gnu.org
2012-04-13 9:37 ` abel at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: abel at gcc dot gnu.org @ 2012-03-07 12:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
Andrey Belevantsev <abel at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.8.0
--- Comment #10 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-03-07 12:02:28 UTC ---
Fixed on trunk, will be ported for 4.7.1.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
2012-02-10 22:19 [Bug rtl-optimization/52203] New: ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags zsojka at seznam dot cz
` (10 preceding siblings ...)
2012-03-07 12:03 ` abel at gcc dot gnu.org
@ 2012-04-13 9:37 ` abel at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: abel at gcc dot gnu.org @ 2012-04-13 9:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203
--- Comment #11 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-04-13 09:36:46 UTC ---
Author: abel
Date: Fri Apr 13 09:36:42 2012
New Revision: 186410
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186410
Log:
PR rtl-optimization/52203
PR rtl-optimization/52715
Revert the 2012-03-07 fix for PR 52203.
* sel-sched.c (reset_sched_cycles_in_current_ebb): Check that
the insn does not modify DFA right before issuing, adjust
issue_rate accordingly.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/sel-sched.c
^ permalink raw reply [flat|nested] 13+ messages in thread