[PATCH] D154438: [AMDGPU] Fix incorrect hazard mitigation
Stephen Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 4 05:51:03 PDT 2023
stepthomas created this revision.
Herald added subscribers: foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl, arsenm.
Herald added a project: All.
stepthomas requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
GCNHazardRecognizer::fixVcmpxExecWARHazard() mitigates a specific hazard
by inserting a wait on sa_sdst==0 if such a wait isn't already present.
Unfortunately, the check for an existing wait incorrectly checks for one
that doesn't actually care about sa_sdst itself, but requires that no
other counters are waited for.
Once the check is performed correctly, a lit test needs to be updated,
since it is currently testing for the incorrect behaviour.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154438
Files:
llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
llvm/test/CodeGen/AMDGPU/vcmpx-exec-war-hazard.mir
Index: llvm/test/CodeGen/AMDGPU/vcmpx-exec-war-hazard.mir
===================================================================
--- llvm/test/CodeGen/AMDGPU/vcmpx-exec-war-hazard.mir
+++ llvm/test/CodeGen/AMDGPU/vcmpx-exec-war-hazard.mir
@@ -126,12 +126,13 @@
S_ENDPGM 0
...
-# GCN-LABEL: name: no_hazard_vcmpx_smov_exec_lo_depctr_ffff
-# GCN: $sgpr0 = S_MOV_B32 $exec_lo
-# GCN-NEXT: S_WAITCNT_DEPCTR 65535
-# GCN-NEXT: V_CMPX_LE_F32_nosdst_e32
+# GCN-LABEL: name: hazard_vcmpx_smov_exec_lo_depctr_ffff
+# GCN: $sgpr0 = S_MOV_B32 $exec_lo
+# GCN-NEXT: S_WAITCNT_DEPCTR 65535
+# GFX10-NEXT: S_WAITCNT_DEPCTR 65534
+# GCN-NEXT: V_CMPX_LE_F32_nosdst_e32
---
-name: no_hazard_vcmpx_smov_exec_lo_depctr_ffff
+name: hazard_vcmpx_smov_exec_lo_depctr_ffff
body: |
bb.0:
successors: %bb.1
@@ -148,7 +149,6 @@
# GCN-LABEL: name: hazard_vcmpx_smov_exec_lo_depctr_effe
# GCN: $sgpr0 = S_MOV_B32 $exec_lo
# GCN-NEXT: S_WAITCNT_DEPCTR 61438
-# GFX10-NEXT: S_WAITCNT_DEPCTR 65534
# GCN-NEXT: V_CMPX_LE_F32_nosdst_e32
---
name: hazard_vcmpx_smov_exec_lo_depctr_effe
Index: llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
+++ llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
@@ -1293,8 +1293,7 @@
return true;
}
if (MI.getOpcode() == AMDGPU::S_WAITCNT_DEPCTR &&
- AMDGPU::DepCtr::encodeFieldSaSdst(MI.getOperand(0).getImm(), 0) ==
- 0xfffe)
+ AMDGPU::DepCtr::decodeFieldSaSdst(MI.getOperand(0).getImm()) == 0)
return true;
return false;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154438.537069.patch
Type: text/x-patch
Size: 1694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230704/9fca2b65/attachment.bin>
More information about the llvm-commits
mailing list