[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
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
index 1adf016..6f50fca 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
@@ -36,6 +36,12 @@
bool NoSignedZerosFPMath;
+ // Function may be memory bound.
+ bool MemoryBound;
+
+ // Kernel may need limited waves per EU for better performance.
+ bool WaveLimiter;
+
public:
AMDGPUMachineFunction(const MachineFunction &MF);
@@ -78,6 +84,14 @@
return NoSignedZerosFPMath;
}
+ bool isMemoryBound() const {
+ return MemoryBound;
+ }
+
+ bool needsWaveLimiter() const {
+ return WaveLimiter;
+ }
+
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
};