public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/95382] New: [haifa-sched][DO_PREDICATION] execution test: wrong scheduling result.
@ 2020-05-28 12:34 xuemaosheng at huawei dot com
  2020-05-29  6:14 ` [Bug rtl-optimization/95382] " rguenth at gcc dot gnu.org
  2020-05-29  6:22 ` xuemaosheng at huawei dot com
  0 siblings, 2 replies; 3+ messages in thread
From: xuemaosheng at huawei dot com @ 2020-05-28 12:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95382

            Bug ID: 95382
           Summary: [haifa-sched][DO_PREDICATION] execution test: wrong
                    scheduling result.
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xuemaosheng at huawei dot com
  Target Milestone: ---

Created attachment 48626
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48626&action=edit
the source file

After we enable the schedule DO_PREDICATION, we get wrong scheduling result in
sched2 pass.
The key dump is shown as following:

.......(Unimportant things)

;;      |   93 |   15 | a20=sxn([a19])                                 
;;      |   94 |   10 | t2=a20==0                                     
;;      |   95 |    9 | pc={(t2!=0)?L107:pc}        jump_insn1                  
;;      |  159 |   10 | a21=0xffffffffffff8000                                  
;;      |   98 |    9 | t0=a23!=a21                                     
;;      |   99 |    8 | pc={(t0==0)?L173:pc}        jump_insn2                  
;;      |  105 |    7 | a22=a23/a20                 div_insn                   
;;      |  106 |    1 | a23=sxn(a22)  

.......(Unimportant things)    

;;   --- EBB Dependences --- from bb4 to bb6 
;;      insn  code    bb   dep  prio  cost   reservation

.......(Unimportant things)

;;       93    94     4     4    15     1   : 105(t,1) 99(a,0) 94(t,5)          
;;       94  1645     4     1    10     1   : 106(t,1) 95(t,1)       
;;       95   139     4    13     9     1   : 106(c,1) 99(a,1)nm             
;;      159   129     5     0    10     1   : 98(t,1)                
;;       98  1650     5     2     9     1   : 105(t,1) 106(t,1)m 99(t,1)
;;       99   139     5    15     8     1   : 105(c,1) 106(c,1)              
;;      105    37     6     4     7     1   : 106(t,6)m                      
;;      106    94     6     6     1     1   :  

.......(Unimportant things)         

When we enable the schedule DO_PREDICATION, we can produce conditional 
execution insn.

Since insn 98(t0=a23!=a21) doesn't have dependence with jump_insn1 95
(pc={(t2!=0)?L107:pc}), so insn 98 can issue before jump_insn1 95.
And insn 93 (a20=sxn([a19])) can also issue before jump_insn1 95.
After that, insn 105(a22=a23/a20) can become conditional execution insn shown 
as following dump:

;;       51-->     93 a20=sxn([a19])                          :         
rescanning insn with uid = 105.                                                 
;;              dependencies resolved: insn    105 predicated                   
;;              Ready-->Q: insn    105: queued for 1 cycles (change queue
index).
;;              tick updated: insn    105 into queue with cost=1  

After  predicating, insn 105 have become : [t0]a22=a23/a20

;;       52-->    105 (t0) a22=a23/a20                        :               
;;      Ready list (t =  52):

.......(Unimportant things) 

;;      Ready list (t =  56):        94:50:prio=10                              
[52;56]:94                                                                      
;;       56-->     94 t2=a20==0                               :         

.......(Unimportant things)                
;;      Ready list (t =  57):        95:51:prio=9                               
[56;57]:95                                                                      
;;       57-->     95 pc={(t2!=0)?L107:pc}                    :


finally, insn 105([t0]a22=a23/a20) is issued before insn 95
(pc={(t2!=0)?L107:pc}).
However, insn 95 has decided reg a20 is valid not.
In this case, a20 is 0, so we get division by 0 error.

The scheduling result is shown as the following:

tstneq@ags      t0, a23, a21       # [28]       # 98
....
l16si@agl       a20, a19, 0        # [51]       # 93
....
[t0] quos@sau   a22, a23, a20      # [52]       # 105
tsteqi@sau      t2, a20, 0         # [53]       # 94
[t2] b@pcu              .L5, 1     # [54]       # 95
[!t0] b@pcu             .L28, 0    # [55]       # 99
......

Insn 105 (div_insn)should not be issued before insn 95(jump_insn1).
Note: This ebb is 3 basic-blocks.

Since supporting DO_PREDICATION target is little, it's difficult to recurrent
in other target.

How can we solve the problem?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug rtl-optimization/95382] [haifa-sched][DO_PREDICATION] execution test: wrong scheduling result.
  2020-05-28 12:34 [Bug rtl-optimization/95382] New: [haifa-sched][DO_PREDICATION] execution test: wrong scheduling result xuemaosheng at huawei dot com
@ 2020-05-29  6:14 ` rguenth at gcc dot gnu.org
  2020-05-29  6:22 ` xuemaosheng at huawei dot com
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-29  6:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95382

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
You'll likely get more help when asking on the mailing list.  Bugzilla is not
well suited to get attention to custom modified ports.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug rtl-optimization/95382] [haifa-sched][DO_PREDICATION] execution test: wrong scheduling result.
  2020-05-28 12:34 [Bug rtl-optimization/95382] New: [haifa-sched][DO_PREDICATION] execution test: wrong scheduling result xuemaosheng at huawei dot com
  2020-05-29  6:14 ` [Bug rtl-optimization/95382] " rguenth at gcc dot gnu.org
@ 2020-05-29  6:22 ` xuemaosheng at huawei dot com
  1 sibling, 0 replies; 3+ messages in thread
From: xuemaosheng at huawei dot com @ 2020-05-29  6:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95382

--- Comment #2 from otcmaf <xuemaosheng at huawei dot com> ---
(In reply to Richard Biener from comment #1)
> You'll likely get more help when asking on the mailing list.  Bugzilla is
> not well suited to get attention to custom modified ports.

Ok,thanks.  Do you know who is the maintainer of the DO_PREDICATION attribute
in haifa-sched.  Last time I asked on the mailing list about other issue, but I
also
got noting atterntion.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-29  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 12:34 [Bug rtl-optimization/95382] New: [haifa-sched][DO_PREDICATION] execution test: wrong scheduling result xuemaosheng at huawei dot com
2020-05-29  6:14 ` [Bug rtl-optimization/95382] " rguenth at gcc dot gnu.org
2020-05-29  6:22 ` xuemaosheng at huawei dot com

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).