Skip to content

Commit 7998b71

Browse files
committed
[AMDGPU] Rewrite GFX12 SGPR hazard handling to dedicated pass
- Algorithm operates over whole IR to attempt to minimize waits. - Add support for VALU->VALU SGPR hazards via VA_SDST/VA_VCC.
1 parent dd42651 commit 7998b71

File tree

95 files changed

+2577
-2094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2577
-2094
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ void initializeAMDGPUSetWavePriorityPass(PassRegistry &);
463463
void initializeGCNRewritePartialRegUsesPass(llvm::PassRegistry &);
464464
extern char &GCNRewritePartialRegUsesID;
465465

466+
void initializeAMDGPUWaitSGPRHazardsLegacyPass(PassRegistry &);
467+
extern char &AMDGPUWaitSGPRHazardsLegacyID;
468+
466469
namespace AMDGPU {
467470
enum TargetIndex {
468471
TI_CONSTDATA_START,

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "AMDGPUTargetObjectFile.h"
3030
#include "AMDGPUTargetTransformInfo.h"
3131
#include "AMDGPUUnifyDivergentExitNodes.h"
32+
#include "AMDGPUWaitSGPRHazards.h"
3233
#include "GCNDPPCombine.h"
3334
#include "GCNIterativeScheduler.h"
3435
#include "GCNSchedStrategy.h"
@@ -545,6 +546,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
545546
initializeGCNRewritePartialRegUsesPass(*PR);
546547
initializeGCNRegPressurePrinterPass(*PR);
547548
initializeAMDGPUPreloadKernArgPrologLegacyPass(*PR);
549+
initializeAMDGPUWaitSGPRHazardsLegacyPass(*PR);
548550
}
549551

550552
static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
@@ -1670,6 +1672,8 @@ void GCNPassConfig::addPreEmitPass() {
16701672
// cases.
16711673
addPass(&PostRAHazardRecognizerID);
16721674

1675+
addPass(&AMDGPUWaitSGPRHazardsLegacyID);
1676+
16731677
if (isPassEnabled(EnableInsertDelayAlu, CodeGenOptLevel::Less))
16741678
addPass(&AMDGPUInsertDelayAluID);
16751679

0 commit comments

Comments
 (0)