diff mbox series

[4/4] sched1: model: ICE on infinite loops in predecessor promotion (Not for Merge)

Message ID 20241020194018.3051160-5-vineetg@rivosinc.com
State New
Headers show
Series sched1 improvements | expand

Commit Message

Vineet Gupta Oct. 20, 2024, 7:40 p.m. UTC
This is just a testing hack in case someone runs into infinite loops
with model schedule change. I did run into quite a few during the course
of development and instead of sched trace files eating up the disk,
better to ICE and abort.

gcc/ChangeLog:

	* haifa-sched.cc (model_promote_predecessors): Add infinite
	looping checks.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
---
 gcc/haifa-sched.cc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Jeff Law Oct. 30, 2024, 8:37 p.m. UTC | #1
On 10/20/24 1:40 PM, Vineet Gupta wrote:
> This is just a testing hack in case someone runs into infinite loops
> with model schedule change. I did run into quite a few during the course
> of development and instead of sched trace files eating up the disk,
> better to ICE and abort.
> 
> gcc/ChangeLog:
> 
> 	* haifa-sched.cc (model_promote_predecessors): Add infinite
> 	looping checks.
Of course this could fail on really big single block functions.  IIRC 
fppp from older versions of spec was on the order of 10k fp loads/stores 
on targets with 32 double precision registers.  Plus whether arithmetic 
instructions were needed.

jeff
diff mbox series

Patch

diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc
index 67f99ce00339..471f7c686e9d 100644
--- a/gcc/haifa-sched.cc
+++ b/gcc/haifa-sched.cc
@@ -3714,6 +3714,18 @@  model_promote_predecessors (struct model_insn_info *insn)
   struct model_insn_info *pro, *first, *leaf_true_dep = NULL;
   sd_iterator_def sd_it;
   dep_t dep;
+  int lockup_local_count = 0;
+  static int lockup_inter_insn, lockup_inter_count;
+
+  if (lockup_inter_insn == insn->insn->u2.insn_uid)
+    {
+      gcc_assert (lockup_inter_count++ < 1000);
+    }
+  else
+    {
+       lockup_inter_insn = insn->insn->u2.insn_uid;
+       lockup_inter_count = 0;
+    }
 
   if (sched_verbose >= 7)
     fprintf (sched_dump, ";;\t+--- priority of %d = %d, priority of",
@@ -3765,6 +3777,7 @@  model_promote_predecessors (struct model_insn_info *insn)
 		}
 	    }
 	}
+      gcc_assert (++lockup_local_count < 10000);
       if (!first)
 	break;
       insn = first;