Skip to content

Commit c15104f

Browse files
committed
unpack packed instructions overlapped by MFMAs post-RA scheduling
1 parent d7e6e72 commit c15104f

File tree

4 files changed

+503
-5
lines changed

4 files changed

+503
-5
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6359,6 +6359,66 @@ bool SIInstrInfo::isOperandLegal(const MachineInstr &MI, unsigned OpIdx,
63596359
return isImmOperandLegal(MI, OpIdx, *MO);
63606360
}
63616361

6362+
bool SIInstrInfo::isNeverCoissue(MachineInstr &MI) const {
6363+
bool IsGFX950Only = ST.hasGFX950Insts();
6364+
bool IsGFX940Only = ST.hasGFX940Insts();
6365+
6366+
if (!IsGFX950Only && !IsGFX940Only)
6367+
return false;
6368+
6369+
if (!isVALU(MI))
6370+
return false;
6371+
6372+
// V_COS, V_EXP, V_RCP, etc.
6373+
if (isTRANS(MI))
6374+
return true;
6375+
6376+
// DOT2, DOT2C, DOT4, etc.
6377+
if (isDOT(MI))
6378+
return true;
6379+
6380+
// MFMA, SMFMA
6381+
if (isMFMA(MI))
6382+
return true;
6383+
6384+
unsigned Opcode = MI.getOpcode();
6385+
switch (Opcode) {
6386+
case AMDGPU::V_CVT_PK_BF8_F32_e64:
6387+
case AMDGPU::V_CVT_PK_FP8_F32_e64:
6388+
case AMDGPU::V_MQSAD_PK_U16_U8_e64:
6389+
case AMDGPU::V_MQSAD_U32_U8_e64:
6390+
case AMDGPU::V_PK_ADD_F16:
6391+
case AMDGPU::V_PK_ADD_F32:
6392+
case AMDGPU::V_PK_ADD_I16:
6393+
case AMDGPU::V_PK_ADD_U16:
6394+
case AMDGPU::V_PK_ASHRREV_I16:
6395+
case AMDGPU::V_PK_FMA_F16:
6396+
case AMDGPU::V_PK_FMA_F32:
6397+
case AMDGPU::V_PK_FMAC_F16_e32:
6398+
case AMDGPU::V_PK_FMAC_F16_e64:
6399+
case AMDGPU::V_PK_LSHLREV_B16:
6400+
case AMDGPU::V_PK_LSHRREV_B16:
6401+
case AMDGPU::V_PK_MAD_I16:
6402+
case AMDGPU::V_PK_MAD_U16:
6403+
case AMDGPU::V_PK_MAX_F16:
6404+
case AMDGPU::V_PK_MAX_I16:
6405+
case AMDGPU::V_PK_MAX_U16:
6406+
case AMDGPU::V_PK_MIN_F16:
6407+
case AMDGPU::V_PK_MIN_I16:
6408+
case AMDGPU::V_PK_MIN_U16:
6409+
case AMDGPU::V_PK_MOV_B32:
6410+
case AMDGPU::V_PK_MUL_F16:
6411+
case AMDGPU::V_PK_MUL_F32:
6412+
case AMDGPU::V_PK_MUL_LO_U16:
6413+
case AMDGPU::V_PK_SUB_I16:
6414+
case AMDGPU::V_PK_SUB_U16:
6415+
case AMDGPU::V_QSAD_PK_U16_U8_e64:
6416+
return true;
6417+
default:
6418+
return false;
6419+
}
6420+
}
6421+
63626422
void SIInstrInfo::legalizeOperandsVOP2(MachineRegisterInfo &MRI,
63636423
MachineInstr &MI) const {
63646424
unsigned Opc = MI.getOpcode();

llvm/lib/Target/AMDGPU/SIInstrInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,8 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
12001200
return isImmOperandLegal(MI.getDesc(), OpNo, MO);
12011201
}
12021202

1203+
bool isNeverCoissue(MachineInstr &MI) const;
1204+
12031205
/// Check if this immediate value can be used for AV_MOV_B64_IMM_PSEUDO.
12041206
bool isLegalAV64PseudoImm(uint64_t Imm) const;
12051207

0 commit comments

Comments
 (0)