-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[AMDGPU] Mark S_NOP as having side effects #65745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This prevents S_NOP from being rescheduled past other (side-effecting) instructions, which is useful because it is generally used to introduce a short delay or to avoid hazards. Currently this only affects MIR tests because the compiler itself only inserts nops in PostRAHazardRecognizer which runs after all scheduling.
@@ -63,9 +63,9 @@ body: | | |||
; CHECK-NEXT: {{ $}} | |||
; CHECK-NEXT: bb.1: | |||
; CHECK-NEXT: S_NOP 0, implicit %1.sub2 | |||
; CHECK-NEXT: S_NOP 0, implicit undef %4.sub0:vreg_128 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S_NOPs can't be reordered now, since they all have side effects.
@@ -343,9 +343,41 @@ body: | | |||
; GCN: bb.0: | |||
; GCN-NEXT: successors: %bb.1(0x80000000) | |||
; GCN-NEXT: {{ $}} | |||
; GCN-NEXT: S_NOP 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S_NOPs are no longer deleted by dead-mi-elimination.
@@ -72,8 +72,7 @@ | |||
; GFX908-NEXT: ; implicit-def: $vgpr59 | |||
; GFX908-NEXT: ; implicit-def: $vgpr60 | |||
; GFX908-NEXT: ; implicit-def: $vgpr61 | |||
; GFX908-NEXT: s_nop 0 | |||
; GFX908-NEXT: s_nop 0 | |||
; GFX908-NEXT: s_nop 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCNHazardRecognizer wants to delay for 2 cycles here. If there was already an S_NOP 0 here it would add another one, instead of modifying it to be an S_NOP 1.
This prevents S_NOP from being rescheduled past other (side-effecting)
instructions, which is useful because it is generally used to introduce
a short delay or to avoid hazards. Currently this only affects MIR tests
because the compiler itself only inserts nops in PostRAHazardRecognizer
which runs after all scheduling.