-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU][True16][CodeGen] 16bit spill support in true16 mode #128060
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
broxigarchen
merged 2 commits into
llvm:main
from
broxigarchen:main-merge-true16-codegen-spill
Feb 26, 2025
Merged
Changes from all commits
Commits
Show all changes
2 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,140 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -march=amdgcn -verify-machineinstrs -mcpu=gfx1100 -mattr=+real-true16 -run-pass=prologepilog -o - %s | FileCheck -check-prefix=EXPANDED %s | ||
|
||
--- | ||
name: spill_restore_vgpr16 | ||
tracksRegLiveness: true | ||
stack: | ||
- { id: 0, name: '', type: spill-slot, offset: 0, size: 4, alignment: 4 } | ||
- { id: 1, name: '', type: spill-slot, offset: 4, size: 4, alignment: 4 } | ||
machineFunctionInfo: | ||
scratchRSrcReg: $sgpr0_sgpr1_sgpr2_sgpr3 | ||
stackPtrOffsetReg: $sgpr32 | ||
hasSpilledVGPRs: true | ||
body: | | ||
; EXPANDED-LABEL: name: spill_restore_vgpr16 | ||
; EXPANDED: bb.0: | ||
; EXPANDED-NEXT: successors: %bb.1(0x80000000) | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: S_NOP 0, implicit-def renamable $vgpr0_lo16, implicit-def renamable $vgpr0_hi16 | ||
; EXPANDED-NEXT: SCRATCH_STORE_SHORT_SADDR_t16 killed $vgpr0_hi16, $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (store (s16) into %stack.1, align 4, addrspace 5) | ||
; EXPANDED-NEXT: S_NOP 0, implicit renamable $vgpr0_lo16 | ||
; EXPANDED-NEXT: SCRATCH_STORE_SHORT_SADDR_t16 killed $vgpr0_lo16, $sgpr32, 0, 0, implicit $exec, implicit $flat_scr :: (store (s16) into %stack.0, align 4, addrspace 5) | ||
; EXPANDED-NEXT: S_CBRANCH_SCC1 %bb.1, implicit undef $scc | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: bb.1: | ||
; EXPANDED-NEXT: successors: %bb.2(0x80000000) | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: S_NOP 1 | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: bb.2: | ||
; EXPANDED-NEXT: $vgpr0_lo16 = SCRATCH_LOAD_SHORT_D16_SADDR_t16 $sgpr32, 0, 0, implicit $exec, implicit $flat_scr :: (load (s16) from %stack.0, align 4, addrspace 5) | ||
; EXPANDED-NEXT: $vgpr0_hi16 = SCRATCH_LOAD_SHORT_D16_SADDR_t16 $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (load (s16) from %stack.1, align 4, addrspace 5) | ||
; EXPANDED-NEXT: S_NOP 0, implicit killed renamable $vgpr0_lo16, implicit killed renamable $vgpr0_hi16 | ||
bb.0: | ||
successors: %bb.1(0x80000000) | ||
S_NOP 0, implicit-def renamable $vgpr0_lo16, implicit-def renamable $vgpr0_hi16 | ||
SI_SPILL_V16_SAVE killed $vgpr0_hi16, %stack.1, $sgpr32, 0, implicit $exec :: (store (s16) into %stack.1, addrspace 5) | ||
S_NOP 0, implicit renamable $vgpr0_lo16 | ||
SI_SPILL_V16_SAVE killed $vgpr0_lo16, %stack.0, $sgpr32, 0, implicit $exec :: (store (s16) into %stack.0, addrspace 5) | ||
S_CBRANCH_SCC1 %bb.1, implicit undef $scc | ||
bb.1: | ||
successors: %bb.2(0x80000000) | ||
S_NOP 1 | ||
bb.2: | ||
$vgpr0_lo16 = SI_SPILL_V16_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s16) from %stack.0, addrspace 5) | ||
$vgpr0_hi16 = SI_SPILL_V16_RESTORE %stack.1, $sgpr32, 0, implicit $exec :: (load (s16) from %stack.1, addrspace 5) | ||
S_NOP 0, implicit killed renamable $vgpr0_lo16, implicit killed renamable $vgpr0_hi16 | ||
... | ||
|
||
--- | ||
name: spill_restore_vgpr16_middle_of_block | ||
tracksRegLiveness: true | ||
stack: | ||
- { id: 0, name: '', type: spill-slot, offset: 0, size: 4, alignment: 4 } | ||
- { id: 1, name: '', type: spill-slot, offset: 4, size: 4, alignment: 4 } | ||
machineFunctionInfo: | ||
scratchRSrcReg: $sgpr0_sgpr1_sgpr2_sgpr3 | ||
stackPtrOffsetReg: $sgpr32 | ||
hasSpilledVGPRs: true | ||
body: | | ||
; EXPANDED-LABEL: name: spill_restore_vgpr16_middle_of_block | ||
; EXPANDED: bb.0: | ||
; EXPANDED-NEXT: successors: %bb.1(0x80000000) | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: S_NOP 0, implicit-def renamable $vgpr0_lo16, implicit-def renamable $vgpr0_hi16 | ||
; EXPANDED-NEXT: SCRATCH_STORE_SHORT_SADDR_t16 killed $vgpr0_hi16, $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (store (s16) into %stack.1, align 4, addrspace 5) | ||
; EXPANDED-NEXT: S_NOP 0, implicit renamable $vgpr0_lo16 | ||
; EXPANDED-NEXT: SCRATCH_STORE_SHORT_SADDR_t16 killed $vgpr0_lo16, $sgpr32, 0, 0, implicit $exec, implicit $flat_scr :: (store (s16) into %stack.0, align 4, addrspace 5) | ||
; EXPANDED-NEXT: S_CBRANCH_SCC1 %bb.1, implicit undef $scc | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: bb.1: | ||
; EXPANDED-NEXT: successors: %bb.2(0x80000000) | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: S_NOP 1 | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: bb.2: | ||
; EXPANDED-NEXT: S_NOP 1 | ||
; EXPANDED-NEXT: $vgpr0_lo16 = SCRATCH_LOAD_SHORT_D16_SADDR_t16 $sgpr32, 0, 0, implicit $exec, implicit $flat_scr :: (load (s16) from %stack.0, align 4, addrspace 5) | ||
; EXPANDED-NEXT: $vgpr0_hi16 = SCRATCH_LOAD_SHORT_D16_SADDR_t16 $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (load (s16) from %stack.1, align 4, addrspace 5) | ||
; EXPANDED-NEXT: S_NOP 0, implicit killed renamable $vgpr0_lo16, implicit killed renamable $vgpr0_hi16 | ||
bb.0: | ||
successors: %bb.1(0x80000000) | ||
S_NOP 0, implicit-def renamable $vgpr0_lo16, implicit-def renamable $vgpr0_hi16 | ||
SI_SPILL_V16_SAVE killed $vgpr0_hi16, %stack.1, $sgpr32, 0, implicit $exec :: (store (s16) into %stack.1, addrspace 5) | ||
S_NOP 0, implicit renamable $vgpr0_lo16 | ||
SI_SPILL_V16_SAVE killed $vgpr0_lo16, %stack.0, $sgpr32, 0, implicit $exec :: (store (s16) into %stack.0, addrspace 5) | ||
S_CBRANCH_SCC1 %bb.1, implicit undef $scc | ||
bb.1: | ||
successors: %bb.2(0x80000000) | ||
S_NOP 1 | ||
bb.2: | ||
S_NOP 1 | ||
$vgpr0_lo16 = SI_SPILL_V16_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s16) from %stack.0, addrspace 5) | ||
$vgpr0_hi16 = SI_SPILL_V16_RESTORE %stack.1, $sgpr32, 0, implicit $exec :: (load (s16) from %stack.1, addrspace 5) | ||
S_NOP 0, implicit killed renamable $vgpr0_lo16, implicit killed renamable $vgpr0_hi16 | ||
... | ||
|
||
--- | ||
name: spill_restore_vgpr16_end_of_block | ||
tracksRegLiveness: true | ||
stack: | ||
- { id: 0, name: '', type: spill-slot, offset: 0, size: 4, alignment: 4 } | ||
- { id: 1, name: '', type: spill-slot, offset: 4, size: 4, alignment: 4 } | ||
machineFunctionInfo: | ||
scratchRSrcReg: $sgpr0_sgpr1_sgpr2_sgpr3 | ||
stackPtrOffsetReg: $sgpr32 | ||
hasSpilledVGPRs: true | ||
body: | | ||
; EXPANDED-LABEL: name: spill_restore_vgpr16_end_of_block | ||
; EXPANDED: bb.0: | ||
; EXPANDED-NEXT: successors: %bb.1(0x80000000) | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: S_NOP 0, implicit-def renamable $vgpr0_lo16, implicit-def renamable $vgpr0_hi16 | ||
; EXPANDED-NEXT: SCRATCH_STORE_SHORT_SADDR_t16 killed $vgpr0_hi16, $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (store (s16) into %stack.1, align 4, addrspace 5) | ||
; EXPANDED-NEXT: S_NOP 0, implicit renamable $vgpr0_lo16 | ||
; EXPANDED-NEXT: SCRATCH_STORE_SHORT_SADDR_t16 killed $vgpr0_lo16, $sgpr32, 0, 0, implicit $exec, implicit $flat_scr :: (store (s16) into %stack.0, align 4, addrspace 5) | ||
; EXPANDED-NEXT: S_CBRANCH_SCC1 %bb.1, implicit undef $scc | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: bb.1: | ||
; EXPANDED-NEXT: successors: %bb.2(0x80000000) | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: S_NOP 1 | ||
; EXPANDED-NEXT: {{ $}} | ||
; EXPANDED-NEXT: bb.2: | ||
; EXPANDED-NEXT: $vgpr0_lo16 = SCRATCH_LOAD_SHORT_D16_SADDR_t16 $sgpr32, 0, 0, implicit $exec, implicit $flat_scr :: (load (s16) from %stack.0, align 4, addrspace 5) | ||
; EXPANDED-NEXT: $vgpr0_hi16 = SCRATCH_LOAD_SHORT_D16_SADDR_t16 $sgpr32, 4, 0, implicit $exec, implicit $flat_scr :: (load (s16) from %stack.1, align 4, addrspace 5) | ||
bb.0: | ||
successors: %bb.1(0x80000000) | ||
S_NOP 0, implicit-def renamable $vgpr0_lo16, implicit-def renamable $vgpr0_hi16 | ||
SI_SPILL_V16_SAVE killed $vgpr0_hi16, %stack.1, $sgpr32, 0, implicit $exec :: (store (s16) into %stack.1, addrspace 5) | ||
S_NOP 0, implicit renamable $vgpr0_lo16 | ||
SI_SPILL_V16_SAVE killed $vgpr0_lo16, %stack.0, $sgpr32, 0, implicit $exec :: (store (s16) into %stack.0, addrspace 5) | ||
S_CBRANCH_SCC1 %bb.1, implicit undef $scc | ||
bb.1: | ||
successors: %bb.2(0x80000000) | ||
S_NOP 1 | ||
bb.2: | ||
$vgpr0_lo16 = SI_SPILL_V16_RESTORE %stack.0, $sgpr32, 0, implicit $exec :: (load (s16) from %stack.0, addrspace 5) | ||
$vgpr0_hi16 = SI_SPILL_V16_RESTORE %stack.1, $sgpr32, 0, implicit $exec :: (load (s16) from %stack.1, addrspace 5) | ||
... |
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.
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 the mubuf ABI does not work with true16? Or is this todo? Can you assert ST.enableFlatScratch at least?
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 am not sure about this part. Might need some input from @Sisyph when he is back from vacation.
Added an assert first
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 don't think there is a conceptual issue here, just we did not implement T16 BUF instructions or spilling using them yet. We have a ticket to track it. Do you have any idea of the priority of the BUF spilling? It looks like all the latest subtargets have ArchitectedFlatScratch and so use the scratch path.
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 don't remember all the details, but I thought gfx11 still defaulted to mubuf path? I vaguely remember a few rounds of the addressing modes not actually working and/or being as good as mubuf with scratch