public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: SMS in gcc4.0
@ 2005-06-02  1:25 Canqun Yang
  0 siblings, 0 replies; 15+ messages in thread
From: Canqun Yang @ 2005-06-02  1:25 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc, Mostafa Hagog, Ayal Zaks

Canqun Yang <canqun@nudt.edu.cn>:

> Steven Bosscher <stevenb@suse.de>:
>
> > On Wednesday 01 June 2005 16:43, Canqun Yang wrote:
> > > Hi, all
> > >
> > > I've taken a look on modulo-sched.c recently, and
> found
> > > that both new_cycles and orig_cycles are
> imprecise. The
> > > reason is that kernel_number_of_cycles does not
> take the
> > > data dependences of insns into account as the DFA
> > > scheduler does in haifa-sched.c.
> >
> > How does this affect the cycles computation?
> >
>
> An insns is ready for schedule only when all the 
insns
> it dependent on have already be scheduled. In haifa-
> sched.c, there is a queue to hold the insns which are
> ready for schedule.
>
> To find how the data dependence affect the cycles
> computation, the more simple way is to compare the
> two versions of assembly code generated by GCC
> respectively, one is generated by turning on '-
fmodulo-
> sched', the other not. Without SMS, the code in loop
> has many stops ';;' to seperate the instrcutions 
which
> have data dependence, while with SMS, though the
> kernel code of the loop has more instructions, but
> less stops ';;'.
>
> > > On IA-64, three improvements are needed to let 
SMS
> work.
> > > 1) Modify doloop_register_get or the similar
> function
> > > defined in doloop.c to recognize the loop count
> > > register. I have supplied a patch about this in
> April.
> >
> > Mustafa and I have a patch that has a similar
> effect, see
> > http://gcc.gnu.org/ml/gcc-patches/2005-
> 06/msg00035.html.
> >
> > > 2) Use more precise way to calculate the values 
of
> the
> > > two kind of cycles, or just ignore this benefit
> assertion.
> >
> > Probably need to be more precise :-/
> >
> > When I manually hacked modulo-sched.c to ignore 
this
> test, I
> > did see loops getting scheduled, but I also ran 
into
> ICEs in
> > cfglayout.
>
> There are no ICEs for pi.f90, swim.f, and mgrid.f
> according to my test. But, an internal compile error
> of 'unrecognizable insn' is produced
> by 'gen_sub2_insn' which explicitly minus 'ar.lc' 
when
> swim.f and mgrid.f are being compiled.


There is no ICEs for pi.f90 according to my test. But 
ICEs of 'unreconizable insn' is procuded 
by 'gen_sub2_insns' which explicitly minus 'ar.lc' 
when swim.f and mgrid.f are being compiled.


>
> >
> > > 3) The counted loop register 'ar.lc' of IA-64 can
> not be
> > > updated  directly. Another temporary register is
> needed
> > > to evaluate the value of the actural loop count
> after
> > > SMS schedule, and assign its value to 'ar.lc'.
> >
> > Actually, should SMS just not update the loop
> register in place?
> > I never figured out why it tries to produce a sub
> insns (using
> > gen_sub2_insn which is also wrong btw).
> >
>
> The current implementation of SMS does not use IA-
64's
> epilog register (ar.ec). After SMS, the loop count is
> just used to control the execution times of the 
kernel
> code, and the kernel code will execute
>    loop_count - (stage_count - 1) times
> The sub insns generated by gen_sub2_insn is used to
> produce this value.
>
>
> > Gr.
> > Steven
> >
> >
>

Canqun Yang
Creative Compiler Research Group.
National University of Defense Technology, China.

^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <OF89DFFFBC.F31A0E99-ON43256FEA.005530A7-43256FEA.0055CD57@il.ibm.com>]
* RE: SMS in gcc4.0
@ 2005-03-31 17:06 Canqun Yang
  2005-03-31 18:33 ` Steven Bosscher
  2005-03-31 18:37 ` Steven Bosscher
  0 siblings, 2 replies; 15+ messages in thread
From: Canqun Yang @ 2005-03-31 17:06 UTC (permalink / raw)
  To: MUSTAFA, mark.davis, gp, ZAKS, gcc, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 540 bytes --]

Hi, all

This patch will fix doloop_register_get defined in 
modulo-sched.c, and let the program of PI caculation 
on IA-64 be successfully modulo scheduled. On 1GHz 
Itanium-2, it costs just 3.128 seconds to execute when 
compiled with "-fmodulo-shced -O3" turned on, while 
5.454 seconds whithout "-fmodulo-sched".


2005-03-31  Canqun Yang  <canqun@nudt.edu.cn>

	* modulo-sched.c (doloop_register_get): Deal 
with if_then_else pattern.  


Canqun Yang
Creative Compiler Research Group.
National University of Defense Technology, China.

[-- Attachment #2: pi.f90 --]
[-- Type: application/octet-stream, Size: 298 bytes --]

! Compute the value of pi by numeric integration
program pi_ex
   implicit none
   integer n, i
   double precision h, pi
   parameter (n=80000000)
   h = 1.0 / n

   pi = 0.0
   do i=1, n
      pi = pi + h * (4 / (1.0  +  h*(i-0.5) * h*(i-0.5)))
   end do
   
   write(*,*) pi
end 

[-- Attachment #3: modulo-sched.txt --]
[-- Type: text/plain, Size: 2328 bytes --]

*** /home/ycq/mainline/gcc/gcc/modulo-sched.c	Mon Mar 21 10:49:23 2005
--- modulo-sched.c	Thu Mar 31 21:11:08 2005
*************** static rtx
*** 263,269 ****
  doloop_register_get (rtx insn, rtx *comp)
  {
    rtx pattern, cmp, inc, reg, condition;
! 
    if (!JUMP_P (insn))
      return NULL_RTX;
    pattern = PATTERN (insn);
--- 263,270 ----
  doloop_register_get (rtx insn, rtx *comp)
  {
    rtx pattern, cmp, inc, reg, condition;
!   rtx src;
!   
    if (!JUMP_P (insn))
      return NULL_RTX;
    pattern = PATTERN (insn);
*************** doloop_register_get (rtx insn, rtx *comp
*** 293,303 ****
  
    /* Extract loop counter register.  */
    reg = SET_DEST (inc);
  
    /* Check if something = (plus (reg) (const_int -1)).  */
!   if (GET_CODE (SET_SRC (inc)) != PLUS
!       || XEXP (SET_SRC (inc), 0) != reg
!       || XEXP (SET_SRC (inc), 1) != constm1_rtx)
      return NULL_RTX;
  
    /* Check for (set (pc) (if_then_else (condition)
--- 294,315 ----
  
    /* Extract loop counter register.  */
    reg = SET_DEST (inc);
+   src = SET_SRC (inc);
  
+   /* On IA-64, the RTL pattern of SRC is just like this 
+     (if_then_else:DI (ne (reg:DI 332 ar.lc)
+             (const_int 0 [0x0]))
+         (plus:DI (reg:DI 332 ar.lc)
+             (const_int -1 [0xffffffffffffffff]))
+         (reg:DI 332 ar.lc))  */
+ 
+   if (GET_CODE (src) == IF_THEN_ELSE)
+     src = XEXP (src, 1);
+   
    /* Check if something = (plus (reg) (const_int -1)).  */
!   if (GET_CODE (src) != PLUS
!       || XEXP (src, 0) != reg
!       || XEXP (src, 1) != constm1_rtx)
      return NULL_RTX;
  
    /* Check for (set (pc) (if_then_else (condition)
*************** doloop_register_get (rtx insn, rtx *comp
*** 318,324 ****
       if ((GET_CODE (condition) != GE && GET_CODE (condition) != NE)
  	 || GET_CODE (XEXP (condition, 1)) != CONST_INT).  */
    if (GET_CODE (condition) != NE
!       || XEXP (condition, 1) != const1_rtx)
      return NULL_RTX;
  
    if (XEXP (condition, 0) == reg)
--- 330,337 ----
       if ((GET_CODE (condition) != GE && GET_CODE (condition) != NE)
  	 || GET_CODE (XEXP (condition, 1)) != CONST_INT).  */
    if (GET_CODE (condition) != NE
!       || (XEXP (condition, 1) != const1_rtx
! 	  && XEXP (condition, 1) != const0_rtx))
      return NULL_RTX;
  
    if (XEXP (condition, 0) == reg)

^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <EFA13842B4FD55469C1A837C9C849644019D731D@hdsmsx401.amr.corp.intel.com>]

end of thread, other threads:[~2005-06-02 13:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-02  1:25 SMS in gcc4.0 Canqun Yang
     [not found] <OF89DFFFBC.F31A0E99-ON43256FEA.005530A7-43256FEA.0055CD57@il.ibm.com>
     [not found] ` <200504211739.42879.stevenb@suse.de>
2005-04-22  3:57   ` Canqun Yang
2005-04-22  6:58     ` Steven Bosscher
2005-05-09 10:54       ` Mostafa Hagog
2005-06-01 14:28         ` Canqun Yang
2005-06-01 14:35           ` Steven Bosscher
2005-06-02  1:13             ` Canqun Yang
2005-06-02 13:41               ` Mostafa Hagog
2005-06-02 13:09             ` Mostafa Hagog
2005-06-02 13:14               ` Steven Bosscher
  -- strict thread matches above, loose matches on Subject: below --
2005-03-31 17:06 Canqun Yang
2005-03-31 18:33 ` Steven Bosscher
2005-03-31 18:37 ` Steven Bosscher
2005-03-31 18:52   ` Mostafa Hagog
     [not found] <EFA13842B4FD55469C1A837C9C849644019D731D@hdsmsx401.amr.corp.intel.com>
2005-03-31 16:13 ` Mostafa Hagog

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).