1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/lib/Target/AMDGPU/AMDGPUMachineFunction.h
Stanislav Mekhanoshin c29c4efaa7 [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
2018-05-25 17:25:12 +00:00

100 lines
2.3 KiB
C++

//===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/MachineFunction.h"
namespace llvm {
class AMDGPUMachineFunction : public MachineFunctionInfo {
/// A map to keep track of local memory objects and their offsets within the
/// local memory space.
SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects;
uint64_t KernArgSize;
unsigned MaxKernArgAlign;
/// Number of bytes in the LDS that are being used.
unsigned LDSSize;
// FIXME: This should probably be removed.
/// Start of implicit kernel args
unsigned ABIArgOffset;
// Kernels + shaders. i.e. functions called by the driver and not called
// by other functions.
bool IsEntryFunction;
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);
uint64_t allocateKernArg(uint64_t Size, unsigned Align) {
assert(isPowerOf2_32(Align));
KernArgSize = alignTo(KernArgSize, Align);
uint64_t Result = KernArgSize;
KernArgSize += Size;
MaxKernArgAlign = std::max(Align, MaxKernArgAlign);
return Result;
}
uint64_t getKernArgSize() const {
return KernArgSize;
}
unsigned getMaxKernArgAlign() const {
return MaxKernArgAlign;
}
void setABIArgOffset(unsigned NewOffset) {
ABIArgOffset = NewOffset;
}
unsigned getABIArgOffset() const {
return ABIArgOffset;
}
unsigned getLDSSize() const {
return LDSSize;
}
bool isEntryFunction() const {
return IsEntryFunction;
}
bool hasNoSignedZerosFPMath() const {
return NoSignedZerosFPMath;
}
bool isMemoryBound() const {
return MemoryBound;
}
bool needsWaveLimiter() const {
return WaveLimiter;
}
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
};
}
#endif