-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Add VDSDIR instructions for GFX12 #75197
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 all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6bf5dd6
[AMDGPU] Add VDSDIR instructions for GFX12
mbrkusanin e2e8412
always print wait_va_vdst and wait_vm_vsrc
mbrkusanin 7eac97d
Adjust spacing in tests; Add --strict-whitespace check
mbrkusanin 30948d4
trailing space removed
mbrkusanin 7c83482
Rename opreands, comments
mbrkusanin 7532fcf
Rename tablegen file for DS instructions
mbrkusanin 2a00399
Formatting
mbrkusanin 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,191 @@ | ||
//===-- DSDIRInstructions.td - LDS/VDS Direct Instruction Definitions -----===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
//===----------------------------------------------------------------------===// | ||
// LDSDIR/VDSDIR encoding (LDSDIR is gfx11, VDSDIR is gfx12+) | ||
//===----------------------------------------------------------------------===// | ||
|
||
class LDSDIRe<bits<2> op, bit is_direct> : Enc32 { | ||
// encoding fields | ||
bits<2> attrchan; | ||
bits<6> attr; | ||
bits<4> waitvdst; | ||
bits<8> vdst; | ||
|
||
// encoding | ||
let Inst{31-24} = 0xce; // encoding | ||
let Inst{23-22} = 0x0; // reserved | ||
let Inst{21-20} = op; | ||
let Inst{19-16} = waitvdst; | ||
let Inst{15-10} = !if(is_direct, ?, attr); | ||
let Inst{9-8} = !if(is_direct, ?, attrchan); | ||
let Inst{7-0} = vdst; | ||
} | ||
|
||
class VDSDIRe<bits<2> op, bit is_direct> : Enc32 { | ||
// encoding fields | ||
bits<2> attrchan; | ||
bits<6> attr; | ||
bits<4> waitvdst; | ||
bits<8> vdst; | ||
bits<1> waitvsrc; | ||
|
||
// encoding | ||
let Inst{31-24} = 0xce; // encoding | ||
let Inst{23} = waitvsrc; | ||
let Inst{22} = 0x0; // reserved | ||
let Inst{21-20} = op; | ||
let Inst{19-16} = waitvdst; | ||
let Inst{15-10} = !if(is_direct, ?, attr); | ||
let Inst{9-8} = !if(is_direct, ?, attrchan); | ||
let Inst{7-0} = vdst; | ||
} | ||
|
||
//===----------------------------------------------------------------------===// | ||
// LDSDIR/VDSDIR Classes | ||
//===----------------------------------------------------------------------===// | ||
|
||
class LDSDIR_getIns<bit direct> { | ||
dag ret = !if(direct, | ||
(ins wait_vdst:$waitvdst), | ||
(ins InterpAttr:$attr, InterpAttrChan:$attrchan, wait_vdst:$waitvdst) | ||
); | ||
} | ||
|
||
class VDSDIR_getIns<bit direct> { | ||
dag ret = !if(direct, | ||
(ins wait_va_vdst:$waitvdst, wait_va_vsrc:$waitvsrc), | ||
(ins InterpAttr:$attr, InterpAttrChan:$attrchan, wait_va_vdst:$waitvdst, | ||
wait_va_vsrc:$waitvsrc) | ||
); | ||
} | ||
|
||
class DSDIR_Common<string opName, string asm = "", dag ins, bit direct> : | ||
InstSI<(outs VGPR_32:$vdst), ins, asm> { | ||
let LDSDIR = 1; | ||
let EXP_CNT = 1; | ||
|
||
let hasSideEffects = 0; | ||
let mayLoad = 1; | ||
let mayStore = 0; | ||
|
||
string Mnemonic = opName; | ||
let UseNamedOperandTable = 1; | ||
|
||
let Uses = [M0, EXEC]; | ||
let DisableWQM = 0; | ||
let SchedRW = [WriteLDS]; | ||
|
||
bit is_direct; | ||
let is_direct = direct; | ||
} | ||
|
||
class DSDIR_Pseudo<string opName, dag ins, bit direct> : | ||
DSDIR_Common<opName, "", ins, direct>, | ||
SIMCInstr<opName, SIEncodingFamily.NONE> { | ||
let isPseudo = 1; | ||
let isCodeGenOnly = 1; | ||
} | ||
|
||
class LDSDIR_getAsm<bit direct> { | ||
string ret = !if(direct, | ||
" $vdst$waitvdst", | ||
" $vdst, $attr$attrchan$waitvdst" | ||
); | ||
} | ||
|
||
class VDSDIR_getAsm<bit direct> { | ||
string ret = !if(direct, | ||
" $vdst$waitvdst$waitvsrc", | ||
" $vdst, $attr$attrchan$waitvdst$waitvsrc" | ||
); | ||
} | ||
|
||
class DSDIR_Real<DSDIR_Pseudo lds, dag ins, string asm, int subtarget> : | ||
DSDIR_Common<lds.Mnemonic, | ||
lds.Mnemonic # asm, | ||
ins, | ||
lds.is_direct>, | ||
SIMCInstr <lds.Mnemonic, subtarget> { | ||
let isPseudo = 0; | ||
let isCodeGenOnly = 0; | ||
} | ||
|
||
//===----------------------------------------------------------------------===// | ||
// LDS/VDS Direct Instructions | ||
//===----------------------------------------------------------------------===// | ||
|
||
let SubtargetPredicate = isGFX11Only in { | ||
|
||
def LDS_DIRECT_LOAD : DSDIR_Pseudo<"lds_direct_load", LDSDIR_getIns<1>.ret, 1>; | ||
def LDS_PARAM_LOAD : DSDIR_Pseudo<"lds_param_load", LDSDIR_getIns<0>.ret, 0>; | ||
|
||
def : GCNPat < | ||
(f32 (int_amdgcn_lds_direct_load M0)), | ||
(LDS_DIRECT_LOAD 0) | ||
>; | ||
|
||
def : GCNPat < | ||
(f32 (int_amdgcn_lds_param_load timm:$attrchan, timm:$attr, M0)), | ||
(LDS_PARAM_LOAD timm:$attr, timm:$attrchan, 0) | ||
>; | ||
|
||
} // End SubtargetPredicate = isGFX11Only | ||
|
||
let SubtargetPredicate = isGFX12Plus in { | ||
|
||
def DS_DIRECT_LOAD : DSDIR_Pseudo<"ds_direct_load", VDSDIR_getIns<1>.ret, 1>; | ||
def DS_PARAM_LOAD : DSDIR_Pseudo<"ds_param_load", VDSDIR_getIns<0>.ret, 0>; | ||
|
||
def : GCNPat < | ||
(f32 (int_amdgcn_lds_direct_load M0)), | ||
(DS_DIRECT_LOAD 0, 1) | ||
>; | ||
|
||
def : GCNPat < | ||
(f32 (int_amdgcn_lds_param_load timm:$attrchan, timm:$attr, M0)), | ||
(DS_PARAM_LOAD timm:$attr, timm:$attrchan, 0, 1) | ||
>; | ||
|
||
} // End SubtargetPredicate = isGFX12Only | ||
|
||
//===----------------------------------------------------------------------===// | ||
// GFX11 | ||
//===----------------------------------------------------------------------===// | ||
|
||
multiclass DSDIR_Real_gfx11<bits<2> op, | ||
DSDIR_Pseudo lds = !cast<DSDIR_Pseudo>(NAME)> { | ||
def _gfx11 : DSDIR_Real<lds, lds.InOperandList, | ||
LDSDIR_getAsm<lds.is_direct>.ret, | ||
SIEncodingFamily.GFX11>, | ||
LDSDIRe<op, lds.is_direct> { | ||
let AssemblerPredicate = isGFX11Only; | ||
let DecoderNamespace = "GFX11"; | ||
} | ||
} | ||
|
||
defm LDS_PARAM_LOAD : DSDIR_Real_gfx11<0x0>; | ||
defm LDS_DIRECT_LOAD : DSDIR_Real_gfx11<0x1>; | ||
|
||
//===----------------------------------------------------------------------===// | ||
// GFX12+ | ||
//===----------------------------------------------------------------------===// | ||
|
||
multiclass DSDIR_Real_gfx12<bits<2> op, | ||
DSDIR_Pseudo lds = !cast<DSDIR_Pseudo>(NAME)> { | ||
def _gfx12 : DSDIR_Real<lds, lds.InOperandList, | ||
VDSDIR_getAsm<lds.is_direct>.ret, | ||
SIEncodingFamily.GFX12>, | ||
VDSDIRe<op, lds.is_direct> { | ||
let AssemblerPredicate = isGFX12Plus; | ||
let DecoderNamespace = "GFX12"; | ||
} | ||
} | ||
|
||
defm DS_PARAM_LOAD : DSDIR_Real_gfx12<0x0>; | ||
defm DS_DIRECT_LOAD : DSDIR_Real_gfx12<0x1>; |
This file was deleted.
Oops, something went wrong.
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
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.