LLVM 24.0.0git
SIPreEmitPeephole.cpp File Reference

This pass performs the peephole optimizations before code emission. More...

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "si-pre-emit-peephole"

Functions

 STATISTIC (NumModeWritesRemoved, "Number of redundant mode register writes removed")
static bool canCoissueVALUs (VALUCoexecClass Younger, VALUCoexecClass Older)
static bool hasVectorOperandOf64Bits (const MachineInstr &MI)
static VALUCoexecClass getVALUCoexecClass (const MachineInstr &MI, const GCNSubtarget &ST, bool Younger)
static VALUCoexecClass getYoungerVALUClass (const MachineInstr &MI, const GCNSubtarget &ST)
static VALUCoexecClass getOlderVALUClass (const MachineInstr &MI, const GCNSubtarget &ST)
static unsigned getAllocatedOccupancy (const MachineFunction &MF, const GCNSubtarget &ST)
static std::optional< bool > isCrossWaveVALUCoexecLoop (const MachineLoop &L, const GCNSubtarget &ST)

Variables

static constexpr unsigned MinBlockingVALUs = 10
static constexpr unsigned MinOlderABPct = 70
static constexpr unsigned MinYoungerAPct = 50
static constexpr unsigned MaxLoopInstrs = 500

Detailed Description

This pass performs the peephole optimizations before code emission.

Additionally, this pass also unpacks packed instructions (V_PK_MUL_F32/F16, V_PK_ADD_F32/F16, V_PK_FMA_F32) adjacent to MFMAs such that they can be co-issued. This helps with overlapping MFMA and certain vector instructions in machine schedules and is expected to improve performance. Only those packed instructions are unpacked that are overlapped by the MFMA latency. Rest should remain untouched. TODO: Add support for F16 packed instructions

Definition in file SIPreEmitPeephole.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "si-pre-emit-peephole"

Definition at line 34 of file SIPreEmitPeephole.cpp.

Function Documentation

◆ canCoissueVALUs()

bool canCoissueVALUs ( VALUCoexecClass Younger,
VALUCoexecClass Older )
static

Definition at line 965 of file SIPreEmitPeephole.cpp.

Referenced by isCrossWaveVALUCoexecLoop().

◆ getAllocatedOccupancy()

◆ getOlderVALUClass()

◆ getVALUCoexecClass()

VALUCoexecClass getVALUCoexecClass ( const MachineInstr & MI,
const GCNSubtarget & ST,
bool Younger )
static

Definition at line 977 of file SIPreEmitPeephole.cpp.

References MI.

Referenced by getOlderVALUClass(), and getYoungerVALUClass().

◆ getYoungerVALUClass()

◆ hasVectorOperandOf64Bits()

bool hasVectorOperandOf64Bits ( const MachineInstr & MI)
static

Definition at line 969 of file SIPreEmitPeephole.cpp.

References llvm::any_of(), and MI.

Referenced by getOlderVALUClass().

◆ isCrossWaveVALUCoexecLoop()

◆ STATISTIC()

STATISTIC ( NumModeWritesRemoved ,
"Number of redundant mode register writes removed"  )

Variable Documentation

◆ MaxLoopInstrs

unsigned MaxLoopInstrs = 500
staticconstexpr

Definition at line 1042 of file SIPreEmitPeephole.cpp.

Referenced by isCrossWaveVALUCoexecLoop().

◆ MinBlockingVALUs

unsigned MinBlockingVALUs = 10
staticconstexpr

Definition at line 1039 of file SIPreEmitPeephole.cpp.

◆ MinOlderABPct

unsigned MinOlderABPct = 70
staticconstexpr

Definition at line 1040 of file SIPreEmitPeephole.cpp.

Referenced by isCrossWaveVALUCoexecLoop().

◆ MinYoungerAPct

unsigned MinYoungerAPct = 50
staticconstexpr

Definition at line 1041 of file SIPreEmitPeephole.cpp.

Referenced by isCrossWaveVALUCoexecLoop().