https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119010

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |target

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So possibly an issue with issue_rate, dfa_lookahead and max_lookahead_tries.
On x86 for sched2 we have dfa_lookahead == issue_rate == 4 for znver4 and below
but 6 for znver5 (and spr).  This results in increasing of max_lookahead
by a factor of 182 (4*4*4*4 vs. 6*6*6*6*6*6) or a complexity increase from
4**4 to 6**6.

The comment mentions

"We would not need this constraint if all real insns (with non-negative codes)
   had reservations because in this case the algorithm complexity is
   O(DFA_LOOKAHEAD**ISSUE_RATE).  Unfortunately, the dfa descriptions
   might be incomplete and such insn might occur."

so maybe this is the case here.  The following ICEs quite quickly after
4665600 tries.  So what does this do?  Does it really try to brute force
finding #issue-width ready insns that can be issued in parallel?  Does the
automaton have 6 ports to issue to?

diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc
index 63eb06b2d82..cd1f3a6db0a 100644
--- a/gcc/haifa-sched.cc
+++ b/gcc/haifa-sched.cc
@@ -6049,7 +6049,7 @@ max_issue (struct ready_list *ready, int privileged_n,
state_t state,
        {
          tries_num++;
          if (tries_num > max_lookahead_tries)
-           break;
+           gcc_unreachable ();//break;
          insn = ready_element (ready, i);
          delay = state_transition (state, insn);
          if (delay < 0)

for the first ICE we have

;;              max_issue among 18 insns:  1682:221:prio=1  1681:220:prio=1 
1680:219:prio=1  1321:213:prio=1  1320:212:prio=1  46:205:prio=1  45:204:prio=1
 44:203:prio=1  43:202:prio=1  1510:179:prio=1  1674:216:prio=1  367:200:prio=1
 47:206:prio=1  2303:180:prio=4  356:183:prio=7  359:187:prio=42 
2415:188:prio=46  1957:185:prio=49

and some of those are

;;      |   47 |    1 | xmm11=0.0                      nothing
;;      | 1320 |    1 | xmm22=[`*.LC2']                nothing
;;      | 1321 |    1 | xmm21=[`*.LC3']                nothing
;;      | 1680 |    1 | [sp+0xf0]=r8                   nothing
;;      | 1681 |    1 | [sp+0xf8]=r12                  nothing
;;      | 1682 |    1 | [sp+0x100]=r9                  nothing
;;      | 1683 |    1 | [sp+0xc0]=ax                   nothing

Reply via email to