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: Patch for AMD Dispatch Scheduler


On 08/24/2010 06:02 PM, reza yazdani wrote:
Dispatch scheduling is a new BD feature. It is composed of two parts: the scheduling part and the alignment part.

The scheduling part (this patch) arranges instructions to maximize the throughput of the hardware dispatcher. It makes sure dispatch widow boundaries are roughly observed. It is roughly, because the lengths of instructions, in number of bytes, are not known at the scheduling time. In x86 some instruction lengths may not be known until assembly time where information such as branch offsets are computed. Scheduling part is called once before register allocation and once after register allocation.

The alignment part (not in this patch) makes sure dispatch widows align at the correct boundaries.

Dispatch Scheduling is implemented as an extension to Haifa Scheduler pass. Scheduler is programed to follow x86-BD dispatching rules during the scheduling.

2 GCC hook functions are used to communicate from the machine independent part to the machine dependent parts of the scheduler.

A new command line flag âmdispatch-scheduler is defined. This option sets flag_dispatch_scheduling. To perform dispatch scheduling â-march=bdver1â and Haifa Scheduling flags must all be selected on the command line.

Testing
-------

Self compile ran with ââmdispatch-scheduling -fschedule-insns -fsched-pressure âO2". Dispatch scheduling flag was manually set on in the self compile to exercise the new code. No new test added for this implementation. Make check of i386 tests passes. No difference in the number of failures with and without the dispatch flag.

ChangeLog
---------

2010-08-12 Reza Yazdani<reza.yazdani@amd.com>

     * tm.texi.in (TARGET_SCHED_DISPATCH): New.
     (TARGET_SCHED_DISPATCH_DO): New.
     * tm.texi: Regererated.
     * hooks.c (hook_bool_rtx_int_false): New.
     (hook_void_rtx_int): New.
     * hooks.h (hook_bool_rtx_int_false): New.
     (hook_void_rtx_int): New.
     * target.def (dispatch): Defined.
     (dispatch_do): Defined.
     * haifa-sched.c (ready_remove_first_dispatch): New.
     (number_in_ready): New.
     (get_ready_element): New.
     * sched-init.h (get_ready_element): Declared.
     (number_in_ready): Declared.
     (debug_ready_dispatch): Declared.
     (debug_dispatch_window): Declared.
     * i386.opt (-mdispatch-scheduler): Declared.
     (flag_dispatch_scheduling): Declared.
     * i386.c (has_dispatch): New.
     (get_mem_group): New.
     (is_cmp): New.
     (dispatch_violation): New.
     (is_branch): New.
     (is_prefetch): New.
     (init_window): New.
     (allocate_window): New.
     (init_dispatch_sched): New.
     (is_end_basic_block): New.
     (process_end_window): New.
     (allocate_next_window): New.
     (find_constant_1): New.
     (find_constant): New.
     (get_num_immediate): New.
     (has_immediate): New.
     (get_insn_path): New.
     (dispatch_group): New.
     (count_num_restricted): New.
     (fits_dispatch_window): New.
     (add_insn_window): New.
     (add_to_dispatch_window): New.
     (debug_dispatch_window_file): New.
     (debug_dispatch_window): New.
     (debug_insn_dispatch_info_file): New.
     (debug_ready_dispatch): New.
     (do_dispatch): New.
     (has_dispatch): New.

Reza Yazdani
--------------------------------------------------------------------------
Previous communications regarding this patch:

There were complains that there are too many hooks in my implementation. I changed the interface and only two hooks are used in the current implementation. One for boolean functions and one for action routines.

Thanks for addressing this issue. The scheduler part (haifa-sched.c) is ok. I'd move external declaration debug_ready_dispatch and debug_dispatch_window from sched-int.h to i386.h because they are defined there. Sched-int.h for definitions of machine-dependent parts of insn scheduler.


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