[PATCH] D19349: MachineScheduler: Limit the size of the ready list.
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 18:21:14 PDT 2016
MatzeB created this revision.
MatzeB added a reviewer: atrick.
MatzeB added a subscriber: llvm-commits.
MatzeB set the repository for this revision to rL LLVM.
Herald added subscribers: mcrosier, MatzeB, aemerson.
Avoid quadratic complexity in unusually large basic blocks by limiting
the size of the ready lists.
Measuring llvm test-suite for SPEC2000 shows that the ready queue size never exceed 200 on X86 and only exceeds the 256 limit 3 times on AArch64 (with benign/no changes).
Repository:
rL LLVM
http://reviews.llvm.org/D19349
Files:
lib/CodeGen/MachineScheduler.cpp
test/CodeGen/AArch64/arm64-misched-basic-A53.ll
test/CodeGen/X86/misched-matmul.ll
Index: test/CodeGen/X86/misched-matmul.ll
===================================================================
--- test/CodeGen/X86/misched-matmul.ll
+++ test/CodeGen/X86/misched-matmul.ll
@@ -1,5 +1,6 @@
; REQUIRES: asserts
; RUN: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched -stats 2>&1 | FileCheck %s
+; RUN: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched -stats -misched-limit=8 2>&1 | FileCheck %s
;
; Verify that register pressure heuristics are working in MachineScheduler.
;
Index: test/CodeGen/AArch64/arm64-misched-basic-A53.ll
===================================================================
--- test/CodeGen/AArch64/arm64-misched-basic-A53.ll
+++ test/CodeGen/AArch64/arm64-misched-basic-A53.ll
@@ -1,5 +1,6 @@
; REQUIRES: asserts
; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=cortex-a53 -pre-RA-sched=source -enable-misched -verify-misched -debug-only=misched -o - 2>&1 > /dev/null | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=cortex-a53 -pre-RA-sched=source -enable-misched -verify-misched -debug-only=misched -o - -misched-limit=2 2>&1 > /dev/null | FileCheck %s
;
; The Cortex-A53 machine model will cause the MADD instruction to be scheduled
; much higher than the ADD instructions in order to hide latency. When not
Index: lib/CodeGen/MachineScheduler.cpp
===================================================================
--- lib/CodeGen/MachineScheduler.cpp
+++ lib/CodeGen/MachineScheduler.cpp
@@ -64,6 +64,11 @@
static bool ViewMISchedDAGs = false;
#endif // NDEBUG
+/// Avoid quadratic complexity in unusually large basic blocks by limiting the
+/// size of the ready lists.
+static cl::opt<unsigned> ReadyListLimit("misched-limit", cl::Hidden,
+ cl::desc("Limit ready list to N instructions"), cl::init(256));
+
static cl::opt<bool> EnableRegPressure("misched-regpressure", cl::Hidden,
cl::desc("Enable register pressure scheduling."), cl::init(true));
@@ -1956,7 +1961,8 @@
// Check for interlocks first. For the purpose of other heuristics, an
// instruction that cannot issue appears as if it's not in the ReadyQueue.
bool IsBuffered = SchedModel->getMicroOpBufferSize() != 0;
- if ((!IsBuffered && ReadyCycle > CurrCycle) || checkHazard(SU))
+ if ((!IsBuffered && ReadyCycle > CurrCycle) || checkHazard(SU) ||
+ Available.size() >= ReadyListLimit)
Pending.push(SU);
else
Available.push(SU);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19349.54449.patch
Type: text/x-patch
Size: 2443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160421/c8ff52f0/attachment.bin>
More information about the llvm-commits
mailing list