summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2020-01-03 13:19:51 -0800
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2020-01-03 15:20:21 -0800
commit4aa7fb77527bee74e93e7cd8242f016c0f229236 (patch)
treee50300add5ba657fb60cc92e2353958aa774e058 /llvm/lib/Target
parentd2b19d455de22fe3c8aa192320e1ff9a4eb1a365 (diff)
downloadbcm5719-llvm-4aa7fb77527bee74e93e7cd8242f016c0f229236.tar.gz
bcm5719-llvm-4aa7fb77527bee74e93e7cd8242f016c0f229236.zip
[AMDGPU] Revert scheduling to reduce spilling
We can revert region schedule if new schedule decreases occupancy. However, if we already have only one wave we would accept any new schedule even if it blows up register pressure. Such schedule may result in quite heavy spilling which can be avoided if we reject this new schedule. Differential Revision: https://reviews.llvm.org/D72181
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
index 973491a70d3..e109eed5f60 100644
--- a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
@@ -16,6 +16,7 @@
#include "SIInstrInfo.h"
#include "SIMachineFunctionInfo.h"
#include "SIRegisterInfo.h"
+#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/Support/MathExtras.h"
@@ -389,8 +390,16 @@ void GCNScheduleDAGMILive::schedule() {
}
if (WavesAfter >= MinOccupancy) {
- Pressure[RegionIdx] = PressureAfter;
- return;
+ unsigned TotalVGPRs = AMDGPU::IsaInfo::getAddressableNumVGPRs(&ST);
+ unsigned TotalSGPRs = AMDGPU::IsaInfo::getAddressableNumSGPRs(&ST);
+ if (WavesAfter > MFI.getMinWavesPerEU() ||
+ PressureAfter.less(ST, PressureBefore) ||
+ (TotalVGPRs >= PressureAfter.getVGPRNum() &&
+ TotalSGPRs >= PressureAfter.getSGPRNum())) {
+ Pressure[RegionIdx] = PressureAfter;
+ return;
+ }
+ LLVM_DEBUG(dbgs() << "New pressure will result in more spilling.\n");
}
LLVM_DEBUG(dbgs() << "Attempting to revert scheduling.\n");
OpenPOWER on IntegriCloud