-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[AMDGPU] Use get_BUF_ps to default real_name of BUF instructions. NFC. #84524
Merged
Conversation
This file contains 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
Contributor
jayfoad
commented
Mar 8, 2024
- Use get_BUF_ps.Mnemonic instead of !tolower(NAME)
- Swap hasTFE and real_name arguments
- Use optional arguments defaulted to get_BUF_ps.Mnemonic
@llvm/pr-subscribers-backend-amdgpu Author: Jay Foad (jayfoad) Changes
Full diff: https://github.com/llvm/llvm-project/pull/84524.diff 1 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/BUFInstructions.td b/llvm/lib/Target/AMDGPU/BUFInstructions.td
index dedf381afca892..d1cbe2840a02fc 100644
--- a/llvm/lib/Target/AMDGPU/BUFInstructions.td
+++ b/llvm/lib/Target/AMDGPU/BUFInstructions.td
@@ -2484,15 +2484,15 @@ multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Impl2<bits<8> op, string real_name> :
MUBUF_Real_AllAddr_gfx11_Impl2<op, real_name>,
MUBUF_Real_AllAddr_gfx12_Impl2<op, real_name>;
-multiclass MUBUF_Real_AllAddr_gfx11_Impl<bits<8> op, string real_name,
- bit hasTFE = 1> {
+multiclass MUBUF_Real_AllAddr_gfx11_Impl<bits<8> op, bit hasTFE,
+ string real_name = get_BUF_ps<NAME>.Mnemonic> {
defm NAME : MUBUF_Real_AllAddr_gfx11_Impl2<op, real_name>;
if hasTFE then
defm _TFE : MUBUF_Real_AllAddr_gfx11_Impl2<op, real_name>;
}
-multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Impl<bits<8> op, string real_name,
- bit hasTFE = 1> {
+multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Impl<bits<8> op, bit hasTFE,
+ string real_name> {
defm NAME : MUBUF_Real_AllAddr_gfx11_gfx12_Impl2<op, real_name>;
if hasTFE then
defm _TFE : MUBUF_Real_AllAddr_gfx11_gfx12_Impl2<op, real_name>;
@@ -2500,10 +2500,11 @@ multiclass MUBUF_Real_AllAddr_gfx11_gfx12_Impl<bits<8> op, string real_name,
// Non-renamed, non-atomic gfx11/gfx12 mubuf instructions.
multiclass MUBUF_Real_AllAddr_gfx11<bits<8> op, bit hasTFE = 1> :
- MUBUF_Real_AllAddr_gfx11_Impl<op, get_BUF_ps<NAME>.Mnemonic, hasTFE>;
+ MUBUF_Real_AllAddr_gfx11_Impl<op, hasTFE>;
-multiclass MUBUF_Real_AllAddr_gfx11_gfx12<bits<8> op, string real_name = !tolower(NAME)> :
- MUBUF_Real_AllAddr_gfx11_gfx12_Impl<op, real_name> {
+multiclass MUBUF_Real_AllAddr_gfx11_gfx12<bits<8> op,
+ string real_name = get_BUF_ps<NAME>.Mnemonic> :
+ MUBUF_Real_AllAddr_gfx11_gfx12_Impl<op, /*hasTFE=*/1, real_name> {
defvar ps = get_BUF_ps<NAME>;
if !ne(ps.Mnemonic, real_name) then
def : Mnem_gfx11_gfx12<ps.Mnemonic, real_name>;
@@ -2519,7 +2520,7 @@ multiclass MUBUF_Real_Atomic_gfx11_impl<bits<8> op, bit is_return,
}
multiclass MUBUF_Real_Atomic_gfx12_impl<bits<8> op, bit is_return,
- string real_name> {
+ string real_name = get_BUF_ps<NAME>.Mnemonic> {
defvar Rtn = !if(is_return, "_RTN", "");
defm _VBUFFER_BOTHEN#Rtn : VBUFFER_MUBUF_Real_gfx12<op, real_name>;
defm _VBUFFER_IDXEN#Rtn : VBUFFER_MUBUF_Real_gfx12<op, real_name>;
@@ -2533,16 +2534,19 @@ multiclass MUBUF_Real_Atomic_gfx11_gfx12_impl<bits<8> op, bit is_return,
MUBUF_Real_Atomic_gfx12_impl<op, is_return, real_name>;
multiclass MUBUF_Real_Atomic_gfx12<bits<8> op> :
- MUBUF_Real_Atomic_gfx12_impl<op, 0, get_BUF_ps<NAME>.Mnemonic>,
- MUBUF_Real_Atomic_gfx12_impl<op, 1, get_BUF_ps<NAME>.Mnemonic>;
+ MUBUF_Real_Atomic_gfx12_impl<op, 0>,
+ MUBUF_Real_Atomic_gfx12_impl<op, 1>;
multiclass MUBUF_Real_Atomic_gfx11<bits<8> op, string real_name> :
MUBUF_Real_Atomic_gfx11_impl<op, 0, real_name>,
MUBUF_Real_Atomic_gfx11_impl<op, 1, real_name> {
- def : Mnem_gfx11_gfx12<get_BUF_ps<NAME>.Mnemonic, real_name>;
+ defvar ps = get_BUF_ps<NAME>;
+ def : Mnem_gfx11_gfx12<ps.Mnemonic, real_name>;
}
-multiclass MUBUF_Real_Atomic_gfx11_gfx12<bits<8> op, string gfx12_name = !tolower(NAME), string gfx11_name = gfx12_name> :
+multiclass MUBUF_Real_Atomic_gfx11_gfx12<bits<8> op,
+ string gfx12_name = get_BUF_ps<NAME>.Mnemonic,
+ string gfx11_name = gfx12_name> :
MUBUF_Real_Atomic_gfx11_impl<op, 0, gfx11_name>,
MUBUF_Real_Atomic_gfx11_impl<op, 1, gfx11_name>,
MUBUF_Real_Atomic_gfx12_impl<op, 0, gfx12_name>,
@@ -2887,7 +2891,8 @@ multiclass MTBUF_Real_AllAddr_gfx11_gfx12_Impl<bits<4> op, string real_name> {
defm _VBUFFER_OFFSET : VBUFFER_MTBUF_Real_gfx12<op, real_name>;
}
-multiclass MTBUF_Real_AllAddr_gfx11_gfx12<bits<4> op, string real_name = !tolower(NAME)>
+multiclass MTBUF_Real_AllAddr_gfx11_gfx12<bits<4> op,
+ string real_name = get_BUF_ps<NAME>.Mnemonic>
: MTBUF_Real_AllAddr_gfx11_gfx12_Impl<op, real_name> {
defvar ps = get_BUF_ps<NAME>;
if !ne(ps.Mnemonic, real_name) then
|
jayfoad
requested review from
kosarev,
Sisyph,
rampitec,
piotrAMD and
mbrkusanin
March 8, 2024 17:51
Sisyph
approved these changes
Mar 8, 2024
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 change to get_BUF_ps.Mnemonic is a slight improvement, and the rest is neutral. LGTM.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.