-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[AMDGPU] Handle amdgpu.last.use metadata #83816
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
4 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 < %s | FileCheck --check-prefixes=GFX12,GFX12-WGP %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 -mattr=+cumode < %s | FileCheck --check-prefixes=GFX12,GFX12-CU %s | ||
|
||
define amdgpu_kernel void @flat_last_use_load_0(ptr %in, ptr %out) { | ||
; GFX12-LABEL: flat_last_use_load_0: | ||
; GFX12: ; %bb.0: ; %entry | ||
; GFX12-NEXT: s_load_b128 s[0:3], s[0:1], 0x0 | ||
; GFX12-NEXT: s_wait_kmcnt 0x0 | ||
; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 | ||
; GFX12-NEXT: flat_load_b32 v2, v[0:1] th:TH_LOAD_LU | ||
; GFX12-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3 | ||
; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0 | ||
; GFX12-NEXT: flat_store_b32 v[0:1], v2 | ||
; GFX12-NEXT: s_endpgm | ||
entry: | ||
%val = load i32, ptr %in, align 4, !amdgpu.last.use !{} | ||
store i32 %val, ptr %out | ||
ret void | ||
} | ||
|
||
define amdgpu_kernel void @flat_last_use_load_1(ptr %in, ptr %out) { | ||
; GFX12-LABEL: flat_last_use_load_1: | ||
; GFX12: ; %bb.0: ; %entry | ||
; GFX12-NEXT: s_load_b128 s[0:3], s[0:1], 0x0 | ||
; GFX12-NEXT: v_lshlrev_b32_e32 v0, 2, v0 | ||
; GFX12-NEXT: s_wait_kmcnt 0x0 | ||
; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) | ||
; GFX12-NEXT: v_add_co_u32 v0, s0, s0, v0 | ||
; GFX12-NEXT: v_add_co_ci_u32_e64 v1, null, s1, 0, s0 | ||
; GFX12-NEXT: flat_load_b32 v2, v[0:1] th:TH_LOAD_LU | ||
; GFX12-NEXT: v_dual_mov_b32 v1, s3 :: v_dual_mov_b32 v0, s2 | ||
; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0 | ||
; GFX12-NEXT: flat_store_b32 v[0:1], v2 | ||
; GFX12-NEXT: s_endpgm | ||
entry: | ||
%tid = call i32 @llvm.amdgcn.workitem.id.x() | ||
%val.gep = getelementptr inbounds i32, ptr %in, i32 %tid | ||
%val = load i32, ptr %val.gep, align 4, !amdgpu.last.use !{} | ||
store i32 %val, ptr %out | ||
ret void | ||
} | ||
|
||
define amdgpu_kernel void @flat_last_use_and_volatile_load(ptr %in, ptr %out) { | ||
; GFX12-LABEL: flat_last_use_and_volatile_load: | ||
; GFX12: ; %bb.0: ; %entry | ||
; GFX12-NEXT: s_load_b128 s[0:3], s[0:1], 0x0 | ||
; GFX12-NEXT: s_wait_kmcnt 0x0 | ||
; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 | ||
; GFX12-NEXT: flat_load_b32 v2, v[0:1] th:TH_LOAD_BYPASS scope:SCOPE_SYS | ||
; GFX12-NEXT: s_wait_loadcnt 0x0 | ||
; GFX12-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3 | ||
; GFX12-NEXT: s_wait_dscnt 0x0 | ||
; GFX12-NEXT: flat_store_b32 v[0:1], v2 | ||
; GFX12-NEXT: s_endpgm | ||
entry: | ||
%val = load volatile i32, ptr %in, align 4, !amdgpu.last.use !{} | ||
store i32 %val, ptr %out | ||
ret void | ||
} | ||
|
||
define amdgpu_kernel void @flat_last_use_and_nontemporal_load(ptr %in, ptr %out) { | ||
; GFX12-LABEL: flat_last_use_and_nontemporal_load: | ||
; GFX12: ; %bb.0: ; %entry | ||
; GFX12-NEXT: s_load_b128 s[0:3], s[0:1], 0x0 | ||
; GFX12-NEXT: s_wait_kmcnt 0x0 | ||
; GFX12-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1 | ||
; GFX12-NEXT: flat_load_b32 v2, v[0:1] th:TH_LOAD_LU | ||
; GFX12-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3 | ||
; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0 | ||
; GFX12-NEXT: flat_store_b32 v[0:1], v2 | ||
; GFX12-NEXT: s_endpgm | ||
entry: | ||
%val = load i32, ptr %in, align 4, !amdgpu.last.use !{}, !nontemporal !0 | ||
store i32 %val, ptr %out | ||
ret void | ||
} | ||
|
||
!0 = !{i32 1} | ||
declare i32 @llvm.amdgcn.workitem.id.x() | ||
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: | ||
; GFX12-CU: {{.*}} | ||
; GFX12-WGP: {{.*}} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.