-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[AMDGPU] Prevent folding of flat_scr_base_hi into a 64-bit SALU #170373
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
+162
−0
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
145 changes: 145 additions & 0 deletions
145
llvm/test/CodeGen/AMDGPU/hazard-gfx1250-flat-scr-hi.mir
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,145 @@ | ||
| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 6 | ||
| # RUN: llc -mtriple=amdgcn -mcpu=gfx1250 -run-pass si-fold-operands %s -o - | FileCheck -check-prefix=GCN %s | ||
|
|
||
| --- | ||
| name: s_ashr_i64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_ashr_i64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_ASHR_I64_:%[0-9]+]]:sreg_64 = S_ASHR_I64 undef %2:sreg_64, [[COPY]], implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %2:sreg_64 = S_ASHR_I64 undef %1:sreg_64, %0, implicit-def $scc | ||
|
Contributor
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. Can you avoid using undef operands in SSA tests, I want to eventually ban that in the verifier
Collaborator
Author
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. |
||
| ... | ||
|
|
||
| --- | ||
| name: s_lshl_b64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_lshl_b64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_LSHL_B64_:%[0-9]+]]:sreg_64 = S_LSHL_B64 undef %2:sreg_64, [[COPY]], implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %2:sreg_64 = S_LSHL_B64 undef %1:sreg_64, %0, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_lshr_b64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_lshr_b64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_LSHR_B64_:%[0-9]+]]:sreg_64 = S_LSHR_B64 undef %2:sreg_64, [[COPY]], implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %2:sreg_64 = S_LSHR_B64 undef %1:sreg_64, %0, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_bfe_i64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_bfe_i64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_BFE_I64_:%[0-9]+]]:sreg_64 = S_BFE_I64 undef %2:sreg_64, [[COPY]], implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %2:sreg_64 = S_BFE_I64 undef %1:sreg_64, %0, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_bfe_u64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_bfe_u64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_BFE_U64_:%[0-9]+]]:sreg_64 = S_BFE_U64 undef %2:sreg_64, [[COPY]], implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %2:sreg_64 = S_BFE_U64 undef %1:sreg_64, %0, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_bfm_b64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_bfm_b64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_BFM_B64_:%[0-9]+]]:sreg_64 = S_BFM_B64 [[COPY]], 1, implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %1:sreg_64 = S_BFM_B64 %0, 1, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_bitcmp0_b64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_bitcmp0_b64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: S_BITCMP0_B64 undef %1:sreg_64, [[COPY]], implicit undef $scc, implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| S_BITCMP0_B64 undef %1:sreg_64, %0, implicit undef $scc, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_bitcmp1_b64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_bitcmp1_b64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: S_BITCMP1_B64 undef %1:sreg_64, [[COPY]], implicit undef $scc, implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| S_BITCMP1_B64 undef %1:sreg_64, %0, implicit undef $scc, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_bitreplicate_b64_b32 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_bitreplicate_b64_b32 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_BITREPLICATE_B64_B32_:%[0-9]+]]:sreg_64 = S_BITREPLICATE_B64_B32 [[COPY]], implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %2:sreg_64 = S_BITREPLICATE_B64_B32 %0, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_bitset0_b64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_bitset0_b64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_BITSET0_B64_:%[0-9]+]]:sreg_64 = S_BITSET0_B64 [[COPY]], undef [[S_BITSET0_B64_]], implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %1:sreg_64 = S_BITSET0_B64 %0, undef %1:sreg_64, implicit-def $scc | ||
| ... | ||
|
|
||
| --- | ||
| name: s_bitset1_b64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: s_bitset1_b64 | ||
| ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| ; GCN-NEXT: [[S_BITSET1_B64_:%[0-9]+]]:sreg_64 = S_BITSET1_B64 [[COPY]], undef [[S_BITSET1_B64_]], implicit-def $scc | ||
| %0:sreg_32 = COPY $src_flat_scratch_base_hi | ||
| %1:sreg_64 = S_BITSET1_B64 %0, undef %1:sreg_64, implicit-def $scc | ||
| ... | ||
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.
This should be a register class check without assuming this is a virtual register.
Also should cover this in a verifier test?
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.
Indeed: #170395
Why? We do not do it for other hazards.
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.
We do and should cover missed cases. The operand legality is primarily a verification function
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.
Well, should not we then just iterate all operands in the
verifyInstruction()and callisOperandLegal()? Why would we duplicate the code?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.
#170550