LLVM  9.0.0svn
Macros | Functions | Variables
AMDGPUPerfHintAnalysis.cpp File Reference

Analyzes if a function potentially memory bound and if a kernel kernel may benefit from limiting number of waves to reduce cache thrashing. More...

#include "AMDGPU.h"
#include "AMDGPUPerfHintAnalysis.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ValueMap.h"
#include "llvm/Support/CommandLine.h"
Include dependency graph for AMDGPUPerfHintAnalysis.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "amdgpu-perf-hint"
 

Functions

 STATISTIC (NumMemBound, "Number of functions marked as memory bound")
 
 STATISTIC (NumLimitWave, "Number of functions marked as needing limit wave")
 
 INITIALIZE_PASS (AMDGPUPerfHintAnalysis, DEBUG_TYPE, "Analysis if a function is memory bound", true, true) namespace
 

Variables

static cl::opt< unsignedMemBoundThresh ("amdgpu-membound-threshold", cl::init(50), cl::Hidden, cl::desc("Function mem bound threshold in %"))
 
static cl::opt< unsignedLimitWaveThresh ("amdgpu-limit-wave-threshold", cl::init(50), cl::Hidden, cl::desc("Kernel limit wave threshold in %"))
 
static cl::opt< unsignedIAWeight ("amdgpu-indirect-access-weight", cl::init(1000), cl::Hidden, cl::desc("Indirect access memory instruction weight"))
 
static cl::opt< unsignedLSWeight ("amdgpu-large-stride-weight", cl::init(1000), cl::Hidden, cl::desc("Large stride memory access weight"))
 
static cl::opt< unsignedLargeStrideThresh ("amdgpu-large-stride-threshold", cl::init(64), cl::Hidden, cl::desc("Large stride memory access threshold"))
 

Detailed Description

Analyzes if a function potentially memory bound and if a kernel kernel may benefit from limiting number of waves to reduce cache thrashing.

Definition in file AMDGPUPerfHintAnalysis.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "amdgpu-perf-hint"

Definition at line 34 of file AMDGPUPerfHintAnalysis.cpp.

Function Documentation

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( AMDGPUPerfHintAnalysis  ,
DEBUG_TYPE  ,
"Analysis if a function is memory bound"  ,
true  ,
true   
)

Check if the instruction is large stride. The purpose is to identify memory access pattern like: x = a[i]; y = a[i+1000]; z = a[i+2000]; In the above example, the second and third memory access will be marked large stride memory access.

Definition at line 62 of file AMDGPUPerfHintAnalysis.cpp.

References llvm::Function::addFnAttr(), B, llvm::TargetLoweringBase::AddrMode::BaseGV, llvm::TargetLoweringBase::AddrMode::BaseOffs, llvm::SmallSet< T, N, C >::begin(), Callee, AMDGPUAS::CONSTANT_ADDRESS, AMDGPUAS::CONSTANT_ADDRESS_32BIT, llvm::dbgs(), E, llvm::SmallSet< T, N, C >::empty(), llvm::SmallSet< T, N, C >::erase(), F(), AMDGPUAS::FLAT_ADDRESS, GEP, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, CallBrTy, IterTy >::getCalledFunction(), llvm::Function::getCallingConv(), llvm::Module::getDataLayout(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::GetPointerBaseWithConstantOffset(), llvm::Value::getType(), AMDGPUAS::GLOBAL_ADDRESS, llvm::TargetLoweringBase::AddrMode::HasBaseReg, llvm::Function::hasFnAttribute(), I, llvm::AMDGPUPerfHintAnalysis::FuncInfo::IAMInstCount, IAWeight, Info, llvm::SmallSet< T, N, C >::insert(), llvm::AMDGPUPerfHintAnalysis::FuncInfo::InstCount, llvm::GlobalValue::isDeclaration(), llvm::AMDGPU::isEntryFunctionCC(), LargeStrideThresh, llvm::ARM_MB::LD, LimitWaveThresh, LLVM_DEBUG, AMDGPUAS::LOCAL_ADDRESS, llvm::AMDGPUPerfHintAnalysis::FuncInfo::LSMInstCount, LSWeight, MemBoundThresh, llvm::AMDGPUPerfHintAnalysis::FuncInfo::MemInstCount, MI, P, print(), runOnFunction(), and SI.

◆ STATISTIC() [1/2]

STATISTIC ( NumMemBound  ,
"Number of functions marked as memory bound"   
)

◆ STATISTIC() [2/2]

STATISTIC ( NumLimitWave  ,
"Number of functions marked as needing limit wave"   
)

Variable Documentation

◆ IAWeight

cl::opt<unsigned> IAWeight("amdgpu-indirect-access-weight", cl::init(1000), cl::Hidden, cl::desc("Indirect access memory instruction weight"))
static

Referenced by INITIALIZE_PASS().

◆ LargeStrideThresh

cl::opt<unsigned> LargeStrideThresh("amdgpu-large-stride-threshold", cl::init(64), cl::Hidden, cl::desc("Large stride memory access threshold"))
static

Referenced by INITIALIZE_PASS().

◆ LimitWaveThresh

cl::opt<unsigned> LimitWaveThresh("amdgpu-limit-wave-threshold", cl::init(50), cl::Hidden, cl::desc("Kernel limit wave threshold in %"))
static

Referenced by INITIALIZE_PASS().

◆ LSWeight

cl::opt<unsigned> LSWeight("amdgpu-large-stride-weight", cl::init(1000), cl::Hidden, cl::desc("Large stride memory access weight"))
static

Referenced by INITIALIZE_PASS().

◆ MemBoundThresh

cl::opt<unsigned> MemBoundThresh("amdgpu-membound-threshold", cl::init(50), cl::Hidden, cl::desc("Function mem bound threshold in %"))
static

Referenced by INITIALIZE_PASS().