-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Increase max scratch allocation for GFX12 #77625
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
Changes from all commits
Commits
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 |
---|---|---|
@@ -1,62 +1,81 @@ | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE64 %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE32 %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE64 %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE32 %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,WAVE64 %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SCRATCH128K %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SCRATCH128K %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SCRATCH256K %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SCRATCH128K %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SCRATCH256K %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 -mattr=-wavefrontsize32,+wavefrontsize64 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SCRATCH1024K %s | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,SCRATCH2048K %s | ||
|
||
; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo14: | ||
; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo16: | ||
; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 | ||
; GCN: v_and_b32_e32 [[MASKED:v[0-9]+]], 0x3ffc, [[FI]] | ||
; GCN: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[MASKED]] | ||
define amdgpu_kernel void @scratch_buffer_known_high_masklo14() #0 { | ||
; GCN: v_and_b32_e32 v{{[0-9]+}}, 0xfffc, [[FI]] | ||
; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], | ||
define amdgpu_kernel void @scratch_buffer_known_high_masklo16() { | ||
%alloca = alloca i32, align 4, addrspace(5) | ||
store volatile i32 0, ptr addrspace(5) %alloca | ||
%toint = ptrtoint ptr addrspace(5) %alloca to i32 | ||
%masked = and i32 %toint, 16383 | ||
%masked = and i32 %toint, 65535 | ||
store volatile i32 %masked, ptr addrspace(1) undef | ||
ret void | ||
} | ||
|
||
; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo16: | ||
; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo17: | ||
; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 | ||
; GCN: v_and_b32_e32 [[MASKED:v[0-9]+]], 0xfffc, [[FI]] | ||
; GCN: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[MASKED]] | ||
define amdgpu_kernel void @scratch_buffer_known_high_masklo16() #0 { | ||
; SCRATCH128K-NOT: v_and_b32 | ||
; SCRATCH256K: v_and_b32_e32 v{{[0-9]+}}, 0x1fffc, [[FI]] | ||
; SCRATCH1024K: v_and_b32_e32 v{{[0-9]+}}, 0x1fffc, [[FI]] | ||
; SCRATCH2048K: v_and_b32_e32 v{{[0-9]+}}, 0x1fffc, [[FI]] | ||
; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], | ||
define amdgpu_kernel void @scratch_buffer_known_high_masklo17() { | ||
%alloca = alloca i32, align 4, addrspace(5) | ||
store volatile i32 0, ptr addrspace(5) %alloca | ||
%toint = ptrtoint ptr addrspace(5) %alloca to i32 | ||
%masked = and i32 %toint, 65535 | ||
%masked = and i32 %toint, 131071 | ||
store volatile i32 %masked, ptr addrspace(1) undef | ||
ret void | ||
} | ||
|
||
; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo17: | ||
; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo18: | ||
; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 | ||
; WAVE64-NOT: [[FI]] | ||
; WAVE64: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[FI]] | ||
|
||
; WAVE32: v_and_b32_e32 [[MASKED:v[0-9]+]], 0x1fffc, [[FI]] | ||
; WAVE32: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[MASKED]] | ||
define amdgpu_kernel void @scratch_buffer_known_high_masklo17() #0 { | ||
; SCRATCH128K-NOT: v_and_b32 | ||
; SCRATCH256K-NOT: v_and_b32 | ||
; SCRATCH1024K: v_and_b32_e32 v{{[0-9]+}}, 0x3fffc, [[FI]] | ||
; SCRATCH2048K: v_and_b32_e32 v{{[0-9]+}}, 0x3fffc, [[FI]] | ||
; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], | ||
define amdgpu_kernel void @scratch_buffer_known_high_masklo18() { | ||
%alloca = alloca i32, align 4, addrspace(5) | ||
store volatile i32 0, ptr addrspace(5) %alloca | ||
%toint = ptrtoint ptr addrspace(5) %alloca to i32 | ||
%masked = and i32 %toint, 131071 | ||
%masked = and i32 %toint, 262143 | ||
store volatile i32 %masked, ptr addrspace(1) undef | ||
ret void | ||
} | ||
|
||
; GCN-LABEL: {{^}}scratch_buffer_known_high_mask18: | ||
; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo20: | ||
; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 | ||
; GCN-NOT: [[FI]] | ||
; GCN: {{flat|global}}_store_{{dword|b32}} v{{\[[0-9]+:[0-9]+\]}}, [[FI]] | ||
define amdgpu_kernel void @scratch_buffer_known_high_mask18() #0 { | ||
; SCRATCH128K-NOT: v_and_b32 | ||
; SCRATCH256K-NOT: v_and_b32 | ||
; SCRATCH1024K-NOT: v_and_b32 | ||
; SCRATCH2048K: v_and_b32_e32 v{{[0-9]+}}, 0xffffc, [[FI]] | ||
; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], | ||
define amdgpu_kernel void @scratch_buffer_known_high_masklo20() { | ||
%alloca = alloca i32, align 4, addrspace(5) | ||
store volatile i32 0, ptr addrspace(5) %alloca | ||
%toint = ptrtoint ptr addrspace(5) %alloca to i32 | ||
%masked = and i32 %toint, 262143 | ||
%masked = and i32 %toint, 1048575 | ||
store volatile i32 %masked, ptr addrspace(1) undef | ||
ret void | ||
} | ||
|
||
attributes #0 = { nounwind } | ||
; GCN-LABEL: {{^}}scratch_buffer_known_high_masklo21: | ||
; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 4 | ||
; GCN-NOT: v_and_b32 | ||
; GCN: {{flat|global}}_store_{{dword|b32}} v[{{[0-9]+:[0-9]+}}], | ||
define amdgpu_kernel void @scratch_buffer_known_high_masklo21() { | ||
%alloca = alloca i32, align 4, addrspace(5) | ||
store volatile i32 0, ptr addrspace(5) %alloca | ||
%toint = ptrtoint ptr addrspace(5) %alloca to i32 | ||
%masked = and i32 %toint, 2097151 | ||
store volatile i32 %masked, ptr addrspace(1) undef | ||
ret void | ||
} |
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.
The masklo14 case got lost?
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.
masklo16 tests the same thing. We only need to test one "x" from each of:
x < 17
17 <= x < 18
18 <= x < 20
20 <= x < 21
21 <= x