[PATCH] D108022: [AMDGPU] Skip pseudo MIs in hazard recognizer
Christudasan Devadasan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 13 02:12:10 PDT 2021
cdevadas created this revision.
cdevadas added reviewers: rampitec, arsenm.
Herald added subscribers: foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
cdevadas requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Instructions like WAVE_BARRIER and SI_MASKED_UNREACHABLE
are only placeholders to prevent certain unwanted
transformations and will get discarded during assembly emission.
They should not be counted during nop insertion.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108022
Files:
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/test/CodeGen/AMDGPU/hazard.mir
Index: llvm/test/CodeGen/AMDGPU/hazard.mir
===================================================================
--- llvm/test/CodeGen/AMDGPU/hazard.mir
+++ llvm/test/CodeGen/AMDGPU/hazard.mir
@@ -125,3 +125,49 @@
S_SENDMSG 3, implicit $exec, implicit $m0
S_ENDPGM 0
...
+# GCN-LABEL: name: hazard-lookahead-wave-barrier
+# GCN: S_WAITCNT 0
+# GCN-NEXT: S_NOP 0
+# GCN-NEXT: V_ADD_F16_dpp
+---
+name: hazard-lookahead-wave-barrier
+body: |
+ bb.0:
+ liveins: $vgpr0, $vgpr1, $vgpr3
+
+ renamable $vgpr1 = contract nofpexcept V_ADD_F16_e32 killed $vgpr1, $vgpr0, implicit $mode, implicit $exec
+ WAVE_BARRIER
+ S_WAITCNT 0
+ renamable $vgpr2 = contract nofpexcept V_ADD_F16_dpp undef $vgpr2, 0, $vgpr1, 0, $vgpr3, 273, 15, 15, 1, implicit $mode, implicit $exec
+...
+# GCN-LABEL: name: hazard-lookahead-masked-unreachable
+# GCN: SI_MASKED_UNREACHABLE
+# GCN-NEXT: S_NOP 0
+# GCN-NEXT: S_SENDMSG
+---
+name: hazard-lookahead-masked-unreachable
+body: |
+ bb.0:
+ $m0 = S_MOV_B32 -1
+ SI_MASKED_UNREACHABLE
+ S_SENDMSG 3, implicit $exec, implicit $m0
+
+ bb.1:
+ S_ENDPGM 0
+...
+# GCN-LABEL: name: fallthrough-hazard-lookahead-masked-unreachable
+# GCN: SI_MASKED_UNREACHABLE
+# GCN-LABEL: bb.1:
+# GCN-NEXT: S_NOP 0
+# GCN-NEXT: S_SENDMSG
+---
+name: fallthrough-hazard-lookahead-masked-unreachable
+body: |
+ bb.0:
+ $m0 = S_MOV_B32 -1
+ SI_MASKED_UNREACHABLE
+
+ bb.1:
+ S_SENDMSG 3, implicit $exec, implicit $m0
+ S_ENDPGM 0
+...
Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -1641,6 +1641,11 @@
case AMDGPU::S_NOP:
return MI.getOperand(0).getImm() + 1;
+
+ // FIXME: Any other pseudo instruction?
+ case AMDGPU::SI_MASKED_UNREACHABLE:
+ case AMDGPU::WAVE_BARRIER:
+ return 0;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108022.366222.patch
Type: text/x-patch
Size: 1916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210813/7938c109/attachment.bin>
More information about the llvm-commits
mailing list