Skip to content

[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

Merged
merged 1 commit into from
Sep 8, 2023
Merged

[AMDGPU] Mark S_NOP as having side effects #65745

merged 1 commit into from
Sep 8, 2023

Conversation

jayfoad
Copy link
Contributor

@jayfoad jayfoad commented Sep 8, 2023

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.

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.
@jayfoad jayfoad requested a review from a team as a code owner September 8, 2023 12:35
@jayfoad jayfoad requested a review from dstutt September 8, 2023 12:35
@@ -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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@jayfoad jayfoad merged commit dd5af89 into llvm:main Sep 8, 2023
@jayfoad jayfoad deleted the s-nop-side-effects branch September 8, 2023 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants