Skip to content

Conversation

rampitec
Copy link
Collaborator

Co-authored-by: Stephen Thomas [email protected]

@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Stanislav Mekhanoshin (rampitec)

Changes

Co-authored-by: Stephen Thomas <[email protected]>


Full diff: https://github.com/llvm/llvm-project/pull/153881.diff

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp (+2-2)
diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
index fa3ca27a5f47c..49a681efc79c7 100644
--- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
@@ -1749,7 +1749,7 @@ bool GCNHazardRecognizer::fixVALUPartialForwardingHazard(MachineInstr *MI) {
 
   BuildMI(*MI->getParent(), MI, MI->getDebugLoc(),
           TII.get(AMDGPU::S_WAITCNT_DEPCTR))
-      .addImm(0x0fff);
+      .addImm(AMDGPU::DepCtr::encodeFieldVaVdst(0));
 
   return true;
 }
@@ -1799,7 +1799,7 @@ bool GCNHazardRecognizer::fixVALUTransUseHazard(MachineInstr *MI) {
     if (SIInstrInfo::isVMEM(I) || SIInstrInfo::isDS(I) ||
         SIInstrInfo::isEXP(I) ||
         (I.getOpcode() == AMDGPU::S_WAITCNT_DEPCTR &&
-         I.getOperand(0).getImm() == 0x0fff))
+         AMDGPU::DepCtr::decodeFieldVaVdst(I.getOperand(0).getImm()) == 0))
       return HazardExpired;
 
     // Track registers writes

rampitec and others added 3 commits August 15, 2025 15:24
…t instructions

This simply updates the pass's cognizance of these instructions, and for the
most part the hazards where they might be encountered do not exist for gfx12.
Nonetheless, encountering them has to be checked for as doing so would indicate
a compiler error.

Co-authored-by: Stephen Thomas <[email protected]>
@rampitec rampitec force-pushed the users/rampitec/08-15-_amdgpu_update_gcnhazardrecognizer_s_understanding_of_gfx12_waitcount_instructions branch from 2f96c40 to df0ab0a Compare August 15, 2025 22:25
@rampitec rampitec force-pushed the users/rampitec/08-15-_amdgpu_use_encodefieldvavdst_in_hazard_recognizer._nfci branch from 0c71fc2 to 4ee7e8b Compare August 15, 2025 22:25
Base automatically changed from users/rampitec/08-15-_amdgpu_update_gcnhazardrecognizer_s_understanding_of_gfx12_waitcount_instructions to main August 16, 2025 00:18
@rampitec rampitec merged commit 4198649 into main Aug 16, 2025
9 checks passed
@rampitec rampitec deleted the users/rampitec/08-15-_amdgpu_use_encodefieldvavdst_in_hazard_recognizer._nfci branch August 16, 2025 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants