|
LLVM 24.0.0git
|
#include "GCNHazardRecognizer.h"#include "AMDGPUTargetMachine.h"#include "AMDGPUWaitcntUtils.h"#include "GCNSubtarget.h"#include "SIMachineFunctionInfo.h"#include "llvm/ADT/Statistic.h"#include "llvm/CodeGen/MachineFrameInfo.h"#include "llvm/CodeGen/MachineFunction.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/ScheduleDAG.h"#include "llvm/Support/Debug.h"#include "llvm/TargetParser/AMDGPUTargetParser.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "gcn-hazard-recognizer" |
| #define | DEBUG_TYPE_VERBOSE "gcn-hazard-recognizer-verbose" |
Enumerations | |
| enum | HazardFnResult { HazardFound , HazardExpired , NoHazardFound } |
Variables | |
| static cl::opt< unsigned, false, MFMAPaddingRatioParser > | MFMAPaddingRatio ("amdgpu-mfma-padding-ratio", cl::init(0), cl::Hidden, cl::desc("Fill a percentage of the latency between " "neighboring MFMA with s_nops.")) |
| static cl::opt< unsigned > | NopPadding ("amdgpu-snop-padding", cl::init(0), cl::Hidden, cl::desc("Insert a s_nop x before every instruction")) |
| static cl::opt< bool > | EnableWMMAVnopHoisting ("amdgpu-wmma-vnop-hoisting", cl::init(true), cl::Hidden, cl::desc("Hoist WMMA hazard V_NOPs from loops to preheaders")) |
| #define DEBUG_TYPE "gcn-hazard-recognizer" |
Definition at line 28 of file GCNHazardRecognizer.cpp.
| #define DEBUG_TYPE_VERBOSE "gcn-hazard-recognizer-verbose" |
Definition at line 31 of file GCNHazardRecognizer.cpp.
| enum HazardFnResult |
| Enumerator | |
|---|---|
| HazardFound | |
| HazardExpired | |
| NoHazardFound | |
Definition at line 873 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 1106 of file GCNHazardRecognizer.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops, addRegUnits(), and TRI.
|
static |
Definition at line 1100 of file GCNHazardRecognizer.cpp.
References Reg, llvm::BitVector::set(), and TRI.
Referenced by addRegsToSet().
|
static |
Definition at line 1119 of file GCNHazardRecognizer.cpp.
References llvm::SIInstrInfo::isSMRD(), and MI.
|
static |
Definition at line 1123 of file GCNHazardRecognizer.cpp.
References llvm::SIInstrInfo::isVMEM(), and MI.
|
static |
Checks whether the provided MI "consumes" the operand with a Dest sel fowarding issue Dst .
We may "consume" the Dst via a standard explicit RAW, or through irregular ways (e.g implicit RAW, certain types of WAW)
Definition at line 1495 of file GCNHazardRecognizer.cpp.
References TRI.
|
static |
Definition at line 4108 of file GCNHazardRecognizer.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::MachineBasicBlock::end(), llvm::MachineFunction::front(), and TII.
|
static |
Dest sel forwarding issue occurs if additional logic is needed to swizzle / pack the computed value into correct bit position of the dest register.
This occurs if we have SDWA with dst_sel != DWORD or if we have op_sel with dst_sel that is not aligned to the register. This function analayzes the MI and
Definition at line 1449 of file GCNHazardRecognizer.cpp.
References llvm::SISrcMods::DST_OP_SEL, llvm::AMDGPU::SDWA::DWORD, llvm::AMDGPU::FP4, llvm::AMDGPU::FP8, llvm::AMDGPU::getFPDstSelType(), llvm::AMDGPU::hasNamedOperand(), llvm::SIInstrInfo::isSDWA(), llvm::SIInstrInfo::isVALU(), MI, llvm::SISrcMods::OP_SEL_0, and TII.
|
static |
Definition at line 535 of file GCNHazardRecognizer.cpp.
References llvm::AMDGPU::EncodingFields< HwregId, HwregOffset, HwregSize >::decode(), llvm::MachineOperand::getImm(), and TII.
One MFMA can be written with up to four opcodes that differ only in how vdst and src2 are encoded: both are either AGPRs or VGPRs, and the mac form ties vdst to src2 instead of taking them as separate operands.
Definition at line 3167 of file GCNHazardRecognizer.cpp.
References llvm::AMDGPU::getAGPRFormOp(), llvm::AMDGPU::getMFMAEarlyClobberOp(), and Opc.
Referenced by isSameMFMA().
|
static |
Definition at line 964 of file GCNHazardRecognizer.cpp.
References E(), llvm::SIInstrInfo::getNumWaitStates(), getWaitStatesSince(), I, llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), and MBB.
Referenced by getWaitStatesSince(), and getWaitStatesSince().
|
static |
Definition at line 1003 of file GCNHazardRecognizer.cpp.
References llvm::SIInstrInfo::getNumWaitStates(), getWaitStatesSince(), and MI.
|
static |
Definition at line 2567 of file GCNHazardRecognizer.cpp.
References assert(), llvm::SIInstrInfo::isSWMMAC(), llvm::Latency, llvm_unreachable, MI, and TII.
|
static |
Definition at line 3204 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 3213 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 3560 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 3532 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 3193 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 3221 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 3182 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 3550 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 3540 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 878 of file GCNHazardRecognizer.cpp.
References E(), llvm::SmallVectorImpl< T >::emplace_back(), HazardExpired, HazardFound, I, llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key, llvm::SetVector< T, Vector, Set, N >::insert(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::insert_as(), isEqual(), LHS, MBB, RHS, llvm::SetVector< T, Vector, Set, N >::size(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
|
static |
Definition at line 641 of file GCNHazardRecognizer.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::BuildMI(), MI, and TII.
|
static |
Definition at line 2524 of file GCNHazardRecognizer.cpp.
References llvm::SIInstrInfo::isSWMMAC(), llvm::SIInstrInfo::isVALU(), llvm::SIInstrInfo::isWMMA(), and MI.
Definition at line 448 of file GCNHazardRecognizer.cpp.
Referenced by llvm::GCNHazardRecognizer::getHazardType(), and llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
|
static |
Definition at line 531 of file GCNHazardRecognizer.cpp.
References llvm::SIInstrInfo::isLDSDMA(), and MI.
Referenced by llvm::GCNHazardRecognizer::getHazardType(), and llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
|
static |
Definition at line 513 of file GCNHazardRecognizer.cpp.
References MI.
Referenced by llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
Definition at line 471 of file GCNHazardRecognizer.cpp.
Referenced by llvm::GCNHazardRecognizer::getHazardType(), and llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
Definition at line 467 of file GCNHazardRecognizer.cpp.
Referenced by llvm::GCNHazardRecognizer::getHazardType(), and llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
Opc0 and Opc1 are the same MFMA, ignoring the mac form and whether vdst/src2 are AGPRs or VGPRs. Definition at line 3177 of file GCNHazardRecognizer.cpp.
References getMFMANonMacAGPRFormOp().
|
static |
Definition at line 487 of file GCNHazardRecognizer.cpp.
Referenced by llvm::GCNHazardRecognizer::getHazardType(), and llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
Definition at line 452 of file GCNHazardRecognizer.cpp.
Referenced by llvm::GCNHazardRecognizer::getHazardType(), and llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
Definition at line 475 of file GCNHazardRecognizer.cpp.
Referenced by llvm::GCNHazardRecognizer::getHazardType(), and llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
Definition at line 456 of file GCNHazardRecognizer.cpp.
Referenced by llvm::GCNHazardRecognizer::getHazardType(), and llvm::GCNHazardRecognizer::PreEmitNoopsCommon().
|
static |
Definition at line 2032 of file GCNHazardRecognizer.cpp.
References I.
|
static |
Definition at line 1791 of file GCNHazardRecognizer.cpp.
|
static |
Definition at line 2012 of file GCNHazardRecognizer.cpp.
References llvm::SIInstrInfo::isDS(), llvm::SIInstrInfo::isLDSDMA(), llvm::SIInstrInfo::isVMEM(), MBB, and MI.
Referenced by llvm::GCNHazardRecognizer::GCNHazardRecognizer().
|
static |
Definition at line 4222 of file GCNHazardRecognizer.cpp.
References I.
| STATISTIC | ( | NumWMMAHoistingBailed | , |
| "Number of WMMA hazards where V_NOP hoisting was not possible" | ) |
| STATISTIC | ( | NumWMMANopsHoisted | , |
| "Number of WMMA hazard V_NOPs hoisted from loops" | ) |
|
static |
Definition at line 3897 of file GCNHazardRecognizer.cpp.
References assert(), llvm::MachineBasicBlock::end(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getParent(), I, and llvm::MachineInstr::isBundled().
|
static |
|
static |
|
static |
Referenced by llvm::GCNHazardRecognizer::PreEmitNoops().