[llvm] de51867 - [AMDGPU] Add Reset function to GCNHazardRecognizer
Austin Kerbow via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 28 16:33:15 PDT 2020
Author: Austin Kerbow
Date: 2020-10-28T16:32:32-07:00
New Revision: de518673436ecea229076827ee1f3131482d8f41
URL: https://github.com/llvm/llvm-project/commit/de518673436ecea229076827ee1f3131482d8f41
DIFF: https://github.com/llvm/llvm-project/commit/de518673436ecea229076827ee1f3131482d8f41.diff
LOG: [AMDGPU] Add Reset function to GCNHazardRecognizer
Reset the tracked emitted instructions when starting scheduling on a new
region.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D90347
Added:
llvm/test/CodeGen/AMDGPU/post-ra-sched-reset.mir
Modified:
llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.mov.dpp.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
index 8153056b783f..59fca1617c22 100644
--- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
@@ -50,6 +50,10 @@ GCNHazardRecognizer::GCNHazardRecognizer(const MachineFunction &MF) :
TSchedModel.init(&ST);
}
+void GCNHazardRecognizer::Reset() {
+ EmittedInstrs.clear();
+}
+
void GCNHazardRecognizer::EmitInstruction(SUnit *SU) {
EmitInstruction(SU->getInstr());
}
diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h
index 629fae92e005..447ca828ae64 100644
--- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h
+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h
@@ -109,6 +109,7 @@ class GCNHazardRecognizer final : public ScheduleHazardRecognizer {
void AdvanceCycle() override;
void RecedeCycle() override;
bool ShouldPreferAnother(SUnit *SU) override;
+ void Reset() override;
};
} // end namespace llvm
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.mov.dpp.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.mov.dpp.ll
index 1420b513b034..049deb68d450 100644
--- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.mov.dpp.ll
+++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.mov.dpp.ll
@@ -34,12 +34,11 @@ define amdgpu_kernel void @dpp_wait_states(i32 addrspace(1)* %out, i32 %in) {
; VI-LABEL: {{^}}dpp_first_in_bb:
; VI: ; %endif
-; PREGFX10-OPT: s_mov_b32
-; PREGFX10-OPT: s_mov_b32
; PREGFX10-NOOPT: s_waitcnt
; PREGFX10-NOOPT: v_mov_b32_e32
; VI: v_mov_b32_dpp [[VGPR0:v[0-9]+]], v{{[0-9]+}} quad_perm:[1,0,0,0] row_mask:0x1 bank_mask:0x1 bound_ctrl:0
-; PREGFX10: s_nop 1
+; PREGFX10-OPT: s_mov_b32
+; PREGFX10-OPT: s_mov_b32
; VI: v_mov_b32_dpp [[VGPR1:v[0-9]+]], [[VGPR0]] quad_perm:[1,0,0,0] row_mask:0x1 bank_mask:0x1 bound_ctrl:0
; PREGFX10: s_nop 1
; VI: v_mov_b32_dpp v{{[0-9]+}}, [[VGPR1]] quad_perm:[1,0,0,0] row_mask:0x1 bank_mask:0x1 bound_ctrl:0
diff --git a/llvm/test/CodeGen/AMDGPU/post-ra-sched-reset.mir b/llvm/test/CodeGen/AMDGPU/post-ra-sched-reset.mir
new file mode 100644
index 000000000000..9aaf558caa9e
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/post-ra-sched-reset.mir
@@ -0,0 +1,22 @@
+# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=post-RA-sched -verify-machineinstrs -debug-only=post-RA-sched -o - %s 2>&1 | FileCheck %s
+
+# REQUIRES: asserts
+
+# CHECK-NOT: Stall in cycle
+---
+name: hazard_rec_reset
+tracksRegLiveness: true
+body: |
+ bb.0:
+ successors: %bb.1
+
+ $m0 = S_MOV_B32 0
+
+ bb.1:
+ liveins: $vgpr4
+
+ S_SETREG_IMM32_B32 0, 1, implicit-def $mode, implicit $mode
+ $vgpr0 = V_INTERP_P1_F32 killed $vgpr4, 0, 0, implicit $mode, implicit $m0, implicit $exec
+ S_ENDPGM 0
+
+...
More information about the llvm-commits
mailing list