-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[AMDGPU] Add llvm.amdgcn.dead intrinsic #123190
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9a44d96
Precommit test using poison
rovka b51d4b7
[AMDGPU] Add llvm.amdgcn.dead intrinsic
rovka aac0def
Fixup - mark as source of divergence
rovka 3ac18d3
Fixup - add test (derp)
rovka 52aebbf
More testing
rovka 5abc089
Fixup tests after rebase
rovka 8579928
fixup: remove obsolete CHECK line
rovka ec33c0f
Allow any type
rovka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -362,6 +362,8 @@ def : SourceOfDivergence<int_amdgcn_inverse_ballot>; | |
| foreach intr = AMDGPUImageDimAtomicIntrinsics in | ||
| def : SourceOfDivergence<intr>; | ||
|
|
||
| def : SourceOfDivergence<int_amdgcn_dead>; | ||
|
||
|
|
||
| class AlwaysUniform<Intrinsic intr> { | ||
| Intrinsic Intr = intr; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1200 < %s | FileCheck -check-prefix=ASM-DAG %s | ||
| ; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1200 < %s | FileCheck -check-prefix=ASM-GISEL %s | ||
|
|
||
| ; Test that we can use v0 for temporaries in the if.then block. | ||
| define i32 @dead(i1 %cond, i32 %x, ptr addrspace(1) %ptr1, ptr addrspace(1) %ptr2) #0 { | ||
| ; ASM-DAG-LABEL: dead: | ||
| ; ASM-DAG: ; %bb.0: ; %entry | ||
| ; ASM-DAG-NEXT: s_wait_loadcnt_dscnt 0x0 | ||
| ; ASM-DAG-NEXT: s_wait_expcnt 0x0 | ||
| ; ASM-DAG-NEXT: s_wait_samplecnt 0x0 | ||
| ; ASM-DAG-NEXT: s_wait_bvhcnt 0x0 | ||
| ; ASM-DAG-NEXT: s_wait_kmcnt 0x0 | ||
| ; ASM-DAG-NEXT: v_mov_b32_e32 v4, v0 | ||
| ; ASM-DAG-NEXT: v_mov_b32_e32 v0, v1 | ||
| ; ASM-DAG-NEXT: s_mov_b32 s0, exec_lo | ||
| ; ASM-DAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) | ||
| ; ASM-DAG-NEXT: v_and_b32_e32 v1, 1, v4 | ||
| ; ASM-DAG-NEXT: v_cmpx_eq_u32_e32 1, v1 | ||
| ; ASM-DAG-NEXT: s_cbranch_execz .LBB0_2 | ||
| ; ASM-DAG-NEXT: ; %bb.1: ; %if.then | ||
| ; ASM-DAG-NEXT: v_add_nc_u32_e32 v0, 1, v0 | ||
| ; ASM-DAG-NEXT: global_store_b32 v[2:3], v0, off | ||
| ; ASM-DAG-NEXT: ; implicit-def: $vgpr0 | ||
| ; ASM-DAG-NEXT: .LBB0_2: ; %if.end | ||
| ; ASM-DAG-NEXT: s_wait_alu 0xfffe | ||
| ; ASM-DAG-NEXT: s_or_b32 exec_lo, exec_lo, s0 | ||
| ; ASM-DAG-NEXT: s_setpc_b64 s[30:31] | ||
| ; | ||
| ; ASM-GISEL-LABEL: dead: | ||
| ; ASM-GISEL: ; %bb.0: ; %entry | ||
| ; ASM-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0 | ||
| ; ASM-GISEL-NEXT: s_wait_expcnt 0x0 | ||
| ; ASM-GISEL-NEXT: s_wait_samplecnt 0x0 | ||
| ; ASM-GISEL-NEXT: s_wait_bvhcnt 0x0 | ||
| ; ASM-GISEL-NEXT: s_wait_kmcnt 0x0 | ||
| ; ASM-GISEL-NEXT: v_mov_b32_e32 v4, v0 | ||
| ; ASM-GISEL-NEXT: v_mov_b32_e32 v0, v1 | ||
| ; ASM-GISEL-NEXT: s_mov_b32 s0, exec_lo | ||
| ; ASM-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1) | ||
| ; ASM-GISEL-NEXT: v_and_b32_e32 v1, 1, v4 | ||
| ; ASM-GISEL-NEXT: v_cmpx_ne_u32_e32 0, v1 | ||
| ; ASM-GISEL-NEXT: s_cbranch_execz .LBB0_2 | ||
| ; ASM-GISEL-NEXT: ; %bb.1: ; %if.then | ||
| ; ASM-GISEL-NEXT: v_add_nc_u32_e32 v0, 1, v0 | ||
| ; ASM-GISEL-NEXT: global_store_b32 v[2:3], v0, off | ||
| ; ASM-GISEL-NEXT: ; implicit-def: $vgpr0 | ||
| ; ASM-GISEL-NEXT: .LBB0_2: ; %if.end | ||
| ; ASM-GISEL-NEXT: s_wait_alu 0xfffe | ||
| ; ASM-GISEL-NEXT: s_or_b32 exec_lo, exec_lo, s0 | ||
| ; ASM-GISEL-NEXT: s_setpc_b64 s[30:31] | ||
| entry: | ||
| %dead = call i32 @llvm.amdgcn.dead.i32() | ||
| br i1 %cond, label %if.then, label %if.end | ||
|
|
||
| if.then: ; preds = %entry | ||
| %temp = add i32 %x, 1 | ||
| store i32 %temp, ptr addrspace(1) %ptr1 | ||
| br label %if.end | ||
|
|
||
| if.end: | ||
| %res = phi i32 [ %x, %entry ], [ %dead, %if.then ] | ||
| ret i32 %res | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So is this just convergent poison? Why isn't it IntrConvergent?
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.
Because in my current usage it's ok for it to be sunk from the entry block into
shader. In my very limited understanding, convergent would preclude that (but do correct me if I'm wrong).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.
But is hosting correct? In the future with convergence tokens this will be explicit for where movement can occur
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.
I think hoisting should be correct too.
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.
Yes, hoisting is semantically correct, just undesired in practice.