-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[AMDGPU] Change handling of unsupported non-compute shaders with HSA #126798
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 1 commit
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --tool not --version 5 | ||
| ; RUN: not llc -mtriple=amdgcn-unknown-amdhsa -O0 -stop-after=amdgpu-isel -o - < %s 2>&1 | FileCheck %s | ||
ro-i marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @I = global i32 42 | ||
| @P = global ptr @I | ||
|
|
||
| ; CHECK: error: <unknown>:0:0: in function pixel_shader_zero_args void (): unsupported non-compute shaders with HSA | ||
| ; CHECK: error: <unknown>:0:0: in function pixel_shader_one_arg void (ptr): unsupported non-compute shaders with HSA | ||
| ; CHECK: error: <unknown>:0:0: in function pixel_shader_two_args void (ptr, i32): unsupported non-compute shaders with HSA | ||
| ; CHECK: error: <unknown>:0:0: in function vertex_shader_zero_args void (): unsupported non-compute shaders with HSA | ||
| ; CHECK: error: <unknown>:0:0: in function vertex_shader_one_arg void (ptr): unsupported non-compute shaders with HSA | ||
| ; CHECK: error: <unknown>:0:0: in function vertex_shader_two_args void (ptr, i32): unsupported non-compute shaders with HSA | ||
| ; CHECK: error: <unknown>:0:0: in function geometry_shader_zero_args void (): unsupported non-compute shaders with HSA | ||
| ; CHECK: error: <unknown>:0:0: in function geometry_shader_one_arg void (ptr): unsupported non-compute shaders with HSA | ||
| ; CHECK: error: <unknown>:0:0: in function geometry_shader_two_args void (ptr, i32): unsupported non-compute shaders with HSA | ||
|
|
||
| ; CHECK-LABEL: name: pixel_shader_zero_args | ||
ro-i marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %2:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @I, target-flags(amdgpu-gotprel32-hi) @I, implicit-def dead $scc | ||
| ; CHECK-NEXT: %3:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %2, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %5:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: %4:vgpr_32 = FLAT_LOAD_DWORD killed %5, 0, 0, implicit $exec, implicit $flat_scr :: (dereferenceable load (s32) from @I) | ||
| ; CHECK-NEXT: %6:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @P, target-flags(amdgpu-gotprel32-hi) @P, implicit-def dead $scc | ||
| ; CHECK-NEXT: %7:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %6, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %8:vreg_64 = COPY %7 | ||
| ; CHECK-NEXT: FLAT_STORE_DWORD killed %8, killed %4, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into @P) | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_ps void @pixel_shader_zero_args() { | ||
| %i = load i32, ptr @I | ||
| store i32 %i, ptr @P | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK-LABEL: name: pixel_shader_one_arg | ||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %4:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %5:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %6:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %7:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %3:sreg_64 = REG_SEQUENCE %4, %subreg.sub0, %6, %subreg.sub1 | ||
| ; CHECK-NEXT: %2:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: %8:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @I, target-flags(amdgpu-gotprel32-hi) @I, implicit-def dead $scc | ||
| ; CHECK-NEXT: %9:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %8, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %11:vreg_64 = COPY %9 | ||
| ; CHECK-NEXT: %10:vgpr_32 = FLAT_LOAD_DWORD killed %11, 0, 0, implicit $exec, implicit $flat_scr :: (dereferenceable load (s32) from @I) | ||
| ; CHECK-NEXT: %12:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: FLAT_STORE_DWORD %12, killed %10, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %ir.p) | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_ps void @pixel_shader_one_arg(ptr %p) { | ||
| %i = load i32, ptr @I | ||
| store i32 %i, ptr %p | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK-LABEL: name: pixel_shader_two_args | ||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %5:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %6:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %7:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %8:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %4:sreg_64 = REG_SEQUENCE %5, %subreg.sub0, %7, %subreg.sub1 | ||
| ; CHECK-NEXT: %3:vgpr_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %2:vreg_64 = COPY %4 | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_ps void @pixel_shader_two_args(ptr %p, i32 %i) { | ||
| store i32 %i, ptr %p | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK-LABEL: name: vertex_shader_zero_args | ||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %2:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @I, target-flags(amdgpu-gotprel32-hi) @I, implicit-def dead $scc | ||
| ; CHECK-NEXT: %3:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %2, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %5:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: %4:vgpr_32 = FLAT_LOAD_DWORD killed %5, 0, 0, implicit $exec, implicit $flat_scr :: (dereferenceable load (s32) from @I) | ||
| ; CHECK-NEXT: %6:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @P, target-flags(amdgpu-gotprel32-hi) @P, implicit-def dead $scc | ||
| ; CHECK-NEXT: %7:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %6, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %8:vreg_64 = COPY %7 | ||
| ; CHECK-NEXT: FLAT_STORE_DWORD killed %8, killed %4, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into @P) | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_vs void @vertex_shader_zero_args() { | ||
| %i = load i32, ptr @I | ||
| store i32 %i, ptr @P | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK-LABEL: name: vertex_shader_one_arg | ||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %4:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %5:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %6:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %7:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %3:sreg_64 = REG_SEQUENCE %4, %subreg.sub0, %6, %subreg.sub1 | ||
| ; CHECK-NEXT: %2:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: %8:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @I, target-flags(amdgpu-gotprel32-hi) @I, implicit-def dead $scc | ||
| ; CHECK-NEXT: %9:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %8, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %11:vreg_64 = COPY %9 | ||
| ; CHECK-NEXT: %10:vgpr_32 = FLAT_LOAD_DWORD killed %11, 0, 0, implicit $exec, implicit $flat_scr :: (dereferenceable load (s32) from @I) | ||
| ; CHECK-NEXT: %12:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: FLAT_STORE_DWORD %12, killed %10, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %ir.p) | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_vs void @vertex_shader_one_arg(ptr %p) { | ||
| %i = load i32, ptr @I | ||
| store i32 %i, ptr %p | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK-LABEL: name: vertex_shader_two_args | ||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %5:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %6:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %7:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %8:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %4:sreg_64 = REG_SEQUENCE %5, %subreg.sub0, %7, %subreg.sub1 | ||
| ; CHECK-NEXT: %3:vgpr_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %2:vreg_64 = COPY %4 | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_vs void @vertex_shader_two_args(ptr %p, i32 %i) { | ||
| store i32 %i, ptr %p | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK-LABEL: name: geometry_shader_zero_args | ||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %2:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @I, target-flags(amdgpu-gotprel32-hi) @I, implicit-def dead $scc | ||
| ; CHECK-NEXT: %3:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %2, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %5:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: %4:vgpr_32 = FLAT_LOAD_DWORD killed %5, 0, 0, implicit $exec, implicit $flat_scr :: (dereferenceable load (s32) from @I) | ||
| ; CHECK-NEXT: %6:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @P, target-flags(amdgpu-gotprel32-hi) @P, implicit-def dead $scc | ||
| ; CHECK-NEXT: %7:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %6, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %8:vreg_64 = COPY %7 | ||
| ; CHECK-NEXT: FLAT_STORE_DWORD killed %8, killed %4, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into @P) | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_gs void @geometry_shader_zero_args() { | ||
| %i = load i32, ptr @I | ||
| store i32 %i, ptr @P | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK-LABEL: name: geometry_shader_one_arg | ||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %4:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %5:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %6:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %7:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %3:sreg_64 = REG_SEQUENCE %4, %subreg.sub0, %6, %subreg.sub1 | ||
| ; CHECK-NEXT: %2:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: %8:sreg_64 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @I, target-flags(amdgpu-gotprel32-hi) @I, implicit-def dead $scc | ||
| ; CHECK-NEXT: %9:sreg_64_xexec = S_LOAD_DWORDX2_IMM killed %8, 0, 0 :: (dereferenceable invariant load (s64) from got, addrspace 4) | ||
| ; CHECK-NEXT: %11:vreg_64 = COPY %9 | ||
| ; CHECK-NEXT: %10:vgpr_32 = FLAT_LOAD_DWORD killed %11, 0, 0, implicit $exec, implicit $flat_scr :: (dereferenceable load (s32) from @I) | ||
| ; CHECK-NEXT: %12:vreg_64 = COPY %3 | ||
| ; CHECK-NEXT: FLAT_STORE_DWORD %12, killed %10, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %ir.p) | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_gs void @geometry_shader_one_arg(ptr %p) { | ||
| %i = load i32, ptr @I | ||
| store i32 %i, ptr %p | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK-LABEL: name: geometry_shader_two_args | ||
| ; CHECK: bb.0 (%ir-block.0): | ||
| ; CHECK-NEXT: %5:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %6:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %7:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %8:sreg_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %4:sreg_64 = REG_SEQUENCE %5, %subreg.sub0, %7, %subreg.sub1 | ||
| ; CHECK-NEXT: %3:vgpr_32 = IMPLICIT_DEF | ||
| ; CHECK-NEXT: %2:vreg_64 = COPY %4 | ||
| ; CHECK-NEXT: S_ENDPGM 0 | ||
| define amdgpu_gs void @geometry_shader_two_args(ptr %p, i32 %i) { | ||
| store i32 %i, ptr %p | ||
| ret void | ||
| } | ||
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.
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.
If you want to keep this as it is with the separated handling down here, I'd go with a broader IsError or something.
However, I think it would be cleaner to just have a separate loop populating InVals in the error case with the undefs
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.
When I do this:
I get the following error later:
llc: ~/git/trunk21.0/llvm-project/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h:945: void llvm::SIMachineFunctionInfo::setScratchRSrcReg(llvm::Register): Assertion `Reg != 0 && "Should never be unset"' failed.I suspect the problem is that the other initialization stuff isn't done because of the early return.
Or are you thinking about something else?
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.
Oh right, the other special input setup stuff still needs to happen. I suppose you can rename the variable
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.
Although in that case we should stop requiring the CC lowering to set up the scratch resource. It's really a fixed constant
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.
Already done :)
Hm, the function seems to do a lot of things (which I don't fully understand yet) in the case of
IsGraphicsandIsEntryFunc. Is it possible to pull all this into the error handling without too much code duplication?