This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: scheduling patch
- To: amacleod at cygnus dot com, bernds at redhat dot com
- Subject: Re: scheduling patch
- From: amacleod at cygnus dot com
- Date: Tue, 24 Jul 2001 13:07:14 -0700 (PDT)
- Cc: gcc-patches at gcc dot gnu dot org
>> > + DEFPARAM(PARAM_MAX_PENDING_MEMORY_FLUSH,
>> > + "max-pending-memory-flush",
>> > + "The number of branches to track anti-dependancies through",
>> > + 12)
>> > +
>>
>> I'd use 32, which is the number we use for the other pending lists.
>>
>> I'd also rename this parameter to "PARAM_MAX_PENDING_LIST_LENGTH", and use
>> it for the other pending lists as well.
Changed to 32, and renamed. The difference between 12 and 32 on my machine
was 2 seconds (1m10s v 1m12s). Without this patch, it segfaults after
39m27s.
>> I don't know about the rest of the patch (although it seems good!, I just
>> would rather someone else review it), but you've botched the params.def
>> thing. :-) You need to modify params.h too, and then use the
>> macro you define there in your test; right now you're testing an
>> enumeration constant. When you look at params.h this will make sense.
Ah yes, it makes a great deal of sense :-) Thanks.
>> > * params.def (PARAM_MAX_PENDING_MEMORY_FLUSH): Add parameter to
>> > limit length of pending memory flush list.
>>
>> Parameters should be documented in invoke.texi.
>>
done.
>> This cleans up the timeout in testcase gcc.c-torture/compile/20001226-1.c
>> on ia64, and bootstraps.
>>
>> OK to check in?, and should it also go to the 3.0 branch?
Here is the patch with the suggested changes:
Does this look more sensible? :-)
Andrew
* params.def (PARAM_MAX_PENDING_LIST_LENGTH): Add parameter to
limit length of dependancy flush list.
* params.h (MAX_PENDING_LIST_LENGTH): Define.
* sched-int.h (struct deps): Add pending_flush_length field.
* sched-deps.c (flush_pending_lists): Last_pending_memory_flush now
has 1 element in it.
(sched_analyze): After a jump, if the pending memory flush list is too
large, flush the pending lists.
(init_deps): Initialize pending_flush_length to 0.
* doc/invoke.texi (max_pending_list_length): Document parameter.
Index: params.def
===================================================================
RCS file: /cvs/gcc/egcs/gcc/params.def,v
retrieving revision 1.3.2.3
diff -c -p -r1.3.2.3 params.def
*** params.def 2001/05/01 18:56:22 1.3.2.3
--- params.def 2001/07/24 18:45:46
*************** DEFPARAM(PARAM_MAX_GCSE_MEMORY,
*** 75,80 ****
--- 75,90 ----
"The maximum amount of memory to be allocated by GCSE",
50 * 1024 * 1024)
+ /* This parameter limits the number of branch elements that the
+ scheduler will track anti-dependancies through without resetting
+ the tracking mechanism. Large functions with few calls or barriers
+ can generate lists containing many 1000's of dependancies. Generally
+ the compiler either uses all available memory, or runs for far too long. */
+ DEFPARAM(PARAM_MAX_PENDING_LIST_LENGTH,
+ "max-pending-list-length",
+ "The maximum length of scheduling's pending operations list",
+ 32)
+
/*
Local variables:
mode:c
Index: params.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/params.h,v
retrieving revision 1.3.2.3
diff -c -p -r1.3.2.3 params.h
*** params.h 2001/05/01 18:56:22 1.3.2.3
--- params.h 2001/07/24 18:45:46
*************** typedef enum compiler_param
*** 92,96 ****
--- 92,99 ----
PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH)
#define MAX_GCSE_MEMORY \
((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY))
+ #define MAX_PENDING_LIST_LENGTH \
+ PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH)
+
#endif /* PARAMS_H */
Index: sched-int.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sched-int.h,v
retrieving revision 1.7.4.1
diff -c -p -r1.7.4.1 sched-int.h
*** sched-int.h 2001/03/01 13:16:03 1.7.4.1
--- sched-int.h 2001/07/24 18:45:46
*************** struct deps
*** 53,58 ****
--- 53,62 ----
a function of the length of these pending lists. */
int pending_lists_length;
+ /* Length of the pending memory flush list. Large functions with no
+ calls may build up extremely large lists. */
+ int pending_flush_length;
+
/* The last insn upon which all memory references must depend.
This is an insn which flushed the pending lists, creating a dependency
between it and all previously pending memory references. This creates
Index: sched-deps.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sched-deps.c,v
retrieving revision 1.9.4.2
diff -c -p -r1.9.4.2 sched-deps.c
*** sched-deps.c 2001/05/20 20:05:25 1.9.4.2
--- sched-deps.c 2001/07/24 18:45:49
*************** the Free Software Foundation, 59 Temple
*** 38,43 ****
--- 38,44 ----
#include "toplev.h"
#include "recog.h"
#include "sched-int.h"
+ #include "params.h"
extern char *reg_known_equiv_p;
extern rtx *reg_known_value;
*************** flush_pending_lists (deps, insn, only_wr
*** 532,537 ****
--- 533,539 ----
free_INSN_LIST_list (&deps->last_pending_memory_flush);
deps->last_pending_memory_flush = alloc_INSN_LIST (insn, NULL_RTX);
+ deps->pending_flush_length = 1;
}
/* Analyze a single SET, CLOBBER, PRE_DEC, POST_DEC, PRE_INC or POST_INC
*************** sched_analyze (deps, head, tail)
*** 1242,1249 ****
/* Make each JUMP_INSN a scheduling barrier for memory
references. */
if (GET_CODE (insn) == JUMP_INSN)
! deps->last_pending_memory_flush
! = alloc_INSN_LIST (insn, deps->last_pending_memory_flush);
sched_analyze_insn (deps, PATTERN (insn), insn, loop_notes);
loop_notes = 0;
}
--- 1245,1258 ----
/* Make each JUMP_INSN a scheduling barrier for memory
references. */
if (GET_CODE (insn) == JUMP_INSN)
! {
! /* Keep the list a reasonable size. */
! if (deps->pending_flush_length++ > MAX_PENDING_LIST_LENGTH)
! flush_pending_lists (deps, insn, 0);
! else
! deps->last_pending_memory_flush
! = alloc_INSN_LIST (insn, deps->last_pending_memory_flush);
! }
sched_analyze_insn (deps, PATTERN (insn), insn, loop_notes);
loop_notes = 0;
}
*************** init_deps (deps)
*** 1469,1474 ****
--- 1482,1488 ----
deps->pending_write_insns = 0;
deps->pending_write_mems = 0;
deps->pending_lists_length = 0;
+ deps->pending_flush_length = 0;
deps->last_pending_memory_flush = 0;
deps->last_function_call = 0;
deps->in_post_call_group_p = 0;
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/doc/invoke.texi,v
retrieving revision 1.3.2.20
diff -c -p -r1.3.2.20 invoke.texi
*** invoke.texi 2001/07/05 19:36:14 1.3.2.20
--- invoke.texi 2001/07/24 18:46:09
*************** order to perform the global common subex
*** 3725,3730 ****
--- 3725,3736 ----
optimization. If more memory than specified is required, the
optimization will not be done.
+ @item max-pending-list-length
+ The maximum number of pending dependancies scheduling will allow
+ before flushing the current state and starting over. Large functions
+ with few branches or calls can create excessively large lists which
+ needlessly consume memory and resources.
+
@item max-inline-insns
If an function contains more than this many instructions, it
will not be inlined. This option is precisely equivalent to