This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [sel-sched] Shrink memory consumption on extra large basic blocks


Andrey Belevantsev wrote:
Hi,

Steve kindly pointed out to me that on ia64 gcc needs a lot of memory when compiling limits-fnargs.c with -O3. The reason for this is that we have a basic block with ~150K instructions, and in selective scheduler one of the ideas for speeding it up was to cache the effects of an insn inside the dependence context created solely for this insn. A dependence context has the reg_last array that holds information for each register. It is not a problem with usual regions (at most several hundred insns), but for a region with ~130K insns and on ia64 with >300 hard registers we need something like 12Kb per insn, which totals around 1.5Gb.

Fortunately, there is an easy way out -- when not pipelining (and we never pipeline such supersize regions), we only need this information for insns that are in our lookahead window, as we'd never move anything through scheduled insns. Thus, lazy allocating reg_last array and freeing it after just scheduling an insn does the trick.

The patch (also with extending per-insn data vector by smaller chunks) lets me compile the test under 600Mb. I haven't found other easy candidates for optimizing memory footprints. Bundling allocates quite a lot for storing bundle states for each insn, but no obvious way to shrink them.

Bootstrapped and tested on ia64 with selective scheduling enabled at -O2, regular bootstrap is in progress. Ok for trunk if it succeeds?

Ok. Thanks, Andrey.

2009-11-12 Andrey Belevantsev <abel@ispras.ru>


    * sched-deps.c (init_deps): New parameter lazy_reg_last.  Don't
    allocate reg_last when in case lazy_reg_last is true.
    (init_deps_reg_last): New.
    (free_deps): When max_reg is 0, this context is already freed.
    * sched-int.h (init_deps_reg_last): Export.
    (init_deps): Update prototype.
    * sched-ebb.c (schedule_ebb): Update the call to init_deps.
    * sched-rgn.c (sched_rgn_compute_dependencies): Likewise.
    * ddg.c (build_intra_loop_deps): Likewise.
    * sel-sched-ir.c (copy_deps_context, create_deps_context,
    reset_deps_context, deps_init_id): Likewise.
    (init_first_time_insn_data): Lazy allocate INSN_DEPS_CONTEXT.
    (free_data_for_scheduled_insn): New, break down from ...
    (free_first_time_insn_data): ... here.
    (has_dependence_p): Allocate reg_last now, when it is needed.
    * sel-sched-ir.h (free_data_for_scheduled_insn): Export.
    * sel-sched.c (update_seqnos_and_stage): Free INSN_DEPS_CONTEXT
    in scheduled insn.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]