aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
diff options
context:
space:
mode:
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2018-05-25 17:25:12 +0000
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2018-05-25 17:25:12 +0000
commit1c538423dc2482c475a00b0895dffde5a9ff9bd3 (patch)
tree6f8d4b4618804dc091a1878ff5a454bbb54286b5 /llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
parent6a3199238371e86d8251502c001fe9b0e8ba5795 (diff)
downloadllvm-1c538423dc2482c475a00b0895dffde5a9ff9bd3.zip
llvm-1c538423dc2482c475a00b0895dffde5a9ff9bd3.tar.gz
llvm-1c538423dc2482c475a00b0895dffde5a9ff9bd3.tar.bz2
[AMDGPU] Add perf hints to functions
This is adoption of HSAIL perfhint pass. Two types of hints are produced: 1. Function is memory bound. 2. Kernel can use wave limiter. Currently these hints are used in the scheduler. If a function is suspected to be memory bound we allow occupancy to decrease to 4 waves in the course of scheduling. Differential Revision: https://reviews.llvm.org/D46992 llvm-svn: 333289
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
index b7c8c12..73c073b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
@@ -9,6 +9,8 @@
#include "AMDGPUMachineFunction.h"
#include "AMDGPUSubtarget.h"
+#include "AMDGPUPerfHintAnalysis.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
using namespace llvm;
@@ -20,9 +22,19 @@ AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
LDSSize(0),
ABIArgOffset(0),
IsEntryFunction(AMDGPU::isEntryFunctionCC(MF.getFunction().getCallingConv())),
- NoSignedZerosFPMath(MF.getTarget().Options.NoSignedZerosFPMath) {
+ NoSignedZerosFPMath(MF.getTarget().Options.NoSignedZerosFPMath),
+ MemoryBound(false),
+ WaveLimiter(false) {
// FIXME: Should initialize KernArgSize based on ExplicitKernelArgOffset,
// except reserved size is not correctly aligned.
+
+ if (auto *Resolver = MF.getMMI().getResolver()) {
+ if (AMDGPUPerfHintAnalysis *PHA = static_cast<AMDGPUPerfHintAnalysis*>(
+ Resolver->getAnalysisIfAvailable(&AMDGPUPerfHintAnalysisID, true))) {
+ MemoryBound = PHA->isMemoryBound(&MF.getFunction());
+ WaveLimiter = PHA->needsWaveLimiter(&MF.getFunction());
+ }
+ }
}
unsigned AMDGPUMachineFunction::allocateLDSGlobal(const DataLayout &DL,