-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[AMDGPU] Set AS8 address width to 48 bits #139419
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
arichardson
merged 6 commits into
main
from
users/arichardson/spr/amdgpu-set-as8-address-width-to-48-bits
May 20, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
df51e2c
[𝘀𝗽𝗿] changes to main this commit is based on
arichardson 5effd00
[𝘀𝗽𝗿] initial version
arichardson d07f3fc
[𝘀𝗽𝗿] changes introduced through rebase
arichardson 9b7ff16
use shiftamount and add another autoupgrade
arichardson f7d7367
[𝘀𝗽𝗿] changes introduced through rebase
arichardson c360ee9
rebased
arichardson 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// RUN: %clang_cc1 %s -O0 -triple amdgcn -emit-llvm -o - | FileCheck %s | ||
// RUN: %clang_cc1 %s -O0 -triple amdgcn---opencl -emit-llvm -o - | FileCheck %s | ||
|
||
// CHECK: target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9" | ||
// CHECK: target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9" | ||
void foo(void) {} |
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
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 |
---|---|---|
@@ -1,14 +1,13 @@ | ||
; RUN: not --crash llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -o - < %s 2>&1 | FileCheck -check-prefix=GISEL-ERR %s | ||
|
||
; GISEL-ERR: LLVM ERROR: unable to legalize instruction: %{{[0-9]+}}:_(p8) = G_PTR_ADD %{{[0-9]+}}:_, %{{[0-9]+}}:_(s128) | ||
; GISEL-ERR: LLVM ERROR: unable to legalize instruction: %{{[0-9]+}}:_(p8) = G_PTR_ADD %{{[0-9]+}}:_, %{{[0-9]+}}:_(s48) | ||
|
||
|
||
define float @gep_on_rsrc(ptr addrspace(8) %rsrc) { | ||
body: | ||
%next = getelementptr float, ptr addrspace(8) %rsrc, i128 1 | ||
%next = getelementptr float, ptr addrspace(8) %rsrc, i48 1 | ||
%res = call float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8) %next, i32 0, i32 0, i32 0) | ||
ret float %res | ||
} | ||
|
||
declare float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8), i32, i32, i32 immarg) | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -o - %s | FileCheck -check-prefix=GCN %s | ||
; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -o - %s | FileCheck -check-prefixes=GFX10PLUS,GFX10 %s | ||
; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1100 -amdgpu-enable-delay-alu=0 -o - %s | FileCheck -check-prefixes=GFX10PLUS,GFX11 %s | ||
|
@@ -145,79 +145,79 @@ define amdgpu_ps ptr addrspace(7) @s_ptrmask_buffer_fat_ptr_i32_neg8(ptr addrspa | |
ret ptr addrspace(7) %masked | ||
} | ||
|
||
define ptr addrspace(8) @v_ptrmask_buffer_resource_variable_i128(ptr addrspace(8) %ptr, i128 %mask) { | ||
; GCN-LABEL: v_ptrmask_buffer_resource_variable_i128: | ||
define ptr addrspace(8) @v_ptrmask_buffer_resource_variable_i48(ptr addrspace(8) %ptr, i48 %mask) { | ||
; GCN-LABEL: v_ptrmask_buffer_resource_variable_i48: | ||
; GCN: ; %bb.0: | ||
; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; GCN-NEXT: v_or_b32_e32 v5, 0xffff0000, v5 | ||
; GCN-NEXT: v_and_b32_e32 v1, v1, v5 | ||
; GCN-NEXT: v_and_b32_e32 v0, v0, v4 | ||
; GCN-NEXT: v_and_b32_e32 v3, v3, v7 | ||
; GCN-NEXT: v_and_b32_e32 v2, v2, v6 | ||
; GCN-NEXT: s_setpc_b64 s[30:31] | ||
; | ||
; GFX10PLUS-LABEL: v_ptrmask_buffer_resource_variable_i128: | ||
; GFX10PLUS-LABEL: v_ptrmask_buffer_resource_variable_i48: | ||
; GFX10PLUS: ; %bb.0: | ||
; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; GFX10PLUS-NEXT: v_or_b32_e32 v5, 0xffff0000, v5 | ||
; GFX10PLUS-NEXT: v_and_b32_e32 v0, v0, v4 | ||
; GFX10PLUS-NEXT: v_and_b32_e32 v1, v1, v5 | ||
; GFX10PLUS-NEXT: v_and_b32_e32 v2, v2, v6 | ||
; GFX10PLUS-NEXT: v_and_b32_e32 v3, v3, v7 | ||
; GFX10PLUS-NEXT: s_setpc_b64 s[30:31] | ||
%masked = call ptr addrspace(8) @llvm.ptrmask.p8.i128(ptr addrspace(8) %ptr, i128 %mask) | ||
%masked = call ptr addrspace(8) @llvm.ptrmask.p8.i48(ptr addrspace(8) %ptr, i48 %mask) | ||
ret ptr addrspace(8) %masked | ||
} | ||
|
||
define ptr addrspace(8) @v_ptrmask_buffer_resource_variable_i128_neg8(ptr addrspace(8) %ptr) { | ||
; GCN-LABEL: v_ptrmask_buffer_resource_variable_i128_neg8: | ||
define ptr addrspace(8) @v_ptrmask_buffer_resource_variable_i48_neg8(ptr addrspace(8) %ptr) { | ||
; GCN-LABEL: v_ptrmask_buffer_resource_variable_i48_neg8: | ||
; GCN: ; %bb.0: | ||
; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; GCN-NEXT: v_and_b32_e32 v0, -8, v0 | ||
; GCN-NEXT: s_setpc_b64 s[30:31] | ||
; | ||
; GFX10PLUS-LABEL: v_ptrmask_buffer_resource_variable_i128_neg8: | ||
; GFX10PLUS-LABEL: v_ptrmask_buffer_resource_variable_i48_neg8: | ||
; GFX10PLUS: ; %bb.0: | ||
; GFX10PLUS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; GFX10PLUS-NEXT: v_and_b32_e32 v0, -8, v0 | ||
; GFX10PLUS-NEXT: s_setpc_b64 s[30:31] | ||
%masked = call ptr addrspace(8) @llvm.ptrmask.p8.i128(ptr addrspace(8) %ptr, i128 -8) | ||
%masked = call ptr addrspace(8) @llvm.ptrmask.p8.i48(ptr addrspace(8) %ptr, i48 -8) | ||
ret ptr addrspace(8) %masked | ||
} | ||
|
||
define amdgpu_ps ptr addrspace(8) @s_ptrmask_buffer_resource_variable_i128(ptr addrspace(8) inreg %ptr, i128 inreg %mask) { | ||
; GCN-LABEL: s_ptrmask_buffer_resource_variable_i128: | ||
define amdgpu_ps ptr addrspace(8) @s_ptrmask_buffer_resource_variable_i48(ptr addrspace(8) inreg %ptr, i48 inreg %mask) { | ||
; GCN-LABEL: s_ptrmask_buffer_resource_variable_i48: | ||
; GCN: ; %bb.0: | ||
; GCN-NEXT: s_and_b64 s[4:5], s[4:5], s[8:9] | ||
; GCN-NEXT: s_or_b32 s7, s7, 0xffff0000 | ||
; GCN-NEXT: s_and_b64 s[0:1], s[2:3], s[6:7] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't read AMDGPU assembly properly so would be good to double-check that this is correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That does look right, yeah |
||
; GCN-NEXT: s_mov_b32 s2, s4 | ||
; GCN-NEXT: s_mov_b32 s3, s5 | ||
; GCN-NEXT: ; return to shader part epilog | ||
; | ||
; GFX10PLUS-LABEL: s_ptrmask_buffer_resource_variable_i128: | ||
; GFX10PLUS-LABEL: s_ptrmask_buffer_resource_variable_i48: | ||
; GFX10PLUS: ; %bb.0: | ||
; GFX10PLUS-NEXT: s_or_b32 s7, s7, 0xffff0000 | ||
; GFX10PLUS-NEXT: s_and_b64 s[0:1], s[2:3], s[6:7] | ||
; GFX10PLUS-NEXT: s_and_b64 s[2:3], s[4:5], s[8:9] | ||
; GFX10PLUS-NEXT: s_mov_b32 s2, s4 | ||
; GFX10PLUS-NEXT: s_mov_b32 s3, s5 | ||
; GFX10PLUS-NEXT: ; return to shader part epilog | ||
%masked = call ptr addrspace(8) @llvm.ptrmask.p8.i128(ptr addrspace(8) %ptr, i128 %mask) | ||
%masked = call ptr addrspace(8) @llvm.ptrmask.p8.i48(ptr addrspace(8) %ptr, i48 %mask) | ||
ret ptr addrspace(8) %masked | ||
} | ||
|
||
define amdgpu_ps ptr addrspace(8) @s_ptrmask_buffer_resource_variable_i128_neg8(ptr addrspace(8) inreg %ptr) { | ||
; GCN-LABEL: s_ptrmask_buffer_resource_variable_i128_neg8: | ||
define amdgpu_ps ptr addrspace(8) @s_ptrmask_buffer_resource_variable_i48_neg8(ptr addrspace(8) inreg %ptr) { | ||
; GCN-LABEL: s_ptrmask_buffer_resource_variable_i48_neg8: | ||
; GCN: ; %bb.0: | ||
; GCN-NEXT: s_mov_b32 s1, s3 | ||
; GCN-NEXT: s_and_b32 s0, s2, -8 | ||
; GCN-NEXT: s_mov_b32 s2, s4 | ||
; GCN-NEXT: s_mov_b32 s3, s5 | ||
; GCN-NEXT: ; return to shader part epilog | ||
; | ||
; GFX10PLUS-LABEL: s_ptrmask_buffer_resource_variable_i128_neg8: | ||
; GFX10PLUS-LABEL: s_ptrmask_buffer_resource_variable_i48_neg8: | ||
; GFX10PLUS: ; %bb.0: | ||
; GFX10PLUS-NEXT: s_mov_b32 s1, s3 | ||
; GFX10PLUS-NEXT: s_and_b32 s0, s2, -8 | ||
; GFX10PLUS-NEXT: s_mov_b32 s2, s4 | ||
; GFX10PLUS-NEXT: s_mov_b32 s3, s5 | ||
; GFX10PLUS-NEXT: ; return to shader part epilog | ||
%masked = call ptr addrspace(8) @llvm.ptrmask.p8.i128(ptr addrspace(8) %ptr, i128 -8) | ||
%masked = call ptr addrspace(8) @llvm.ptrmask.p8.i48(ptr addrspace(8) %ptr, i48 -8) | ||
ret ptr addrspace(8) %masked | ||
} | ||
|
||
|
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
2 changes: 1 addition & 1 deletion
2
llvm/test/Transforms/InferAddressSpaces/AMDGPU/noop-ptrint-pair.ll
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
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
Oops, something went wrong.
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.