1 //===- AMDGPUPerfHintAnalysis.h - analysis of functions memory traffic ----===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Analyzes if a function potentially memory bound and if a kernel
12 /// kernel may benefit from limiting number of waves to reduce cache thrashing.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
17 #define LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
18 #include "llvm/IR/ValueMap.h"
19 #include "llvm/Pass.h"
23 struct AMDGPUPerfHintAnalysis
: public FunctionPass
{
27 AMDGPUPerfHintAnalysis() : FunctionPass(ID
) {}
29 bool runOnFunction(Function
&F
) override
;
31 void getAnalysisUsage(AnalysisUsage
&AU
) const override
{
35 bool isMemoryBound(const Function
*F
) const;
37 bool needsWaveLimiter(const Function
*F
) const;
40 unsigned MemInstCount
;
42 unsigned IAMInstCount
; // Indirect access memory instruction count
43 unsigned LSMInstCount
; // Large stride memory instruction count
44 FuncInfo() : MemInstCount(0), InstCount(0), IAMInstCount(0),
48 typedef ValueMap
<const Function
*, FuncInfo
> FuncInfoMap
;
55 #endif // LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H