LLVM  8.0.1
AMDGPUPerfHintAnalysis.h
Go to the documentation of this file.
1 //===- AMDGPUPerfHintAnalysis.h - analysis of functions memory traffic ----===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file
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.
13 ///
14 //===----------------------------------------------------------------------===//
15 
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"
20 
21 namespace llvm {
22 
24  static char ID;
25 
26 public:
28 
29  bool runOnFunction(Function &F) override;
30 
31  void getAnalysisUsage(AnalysisUsage &AU) const override {
32  AU.setPreservesAll();
33  }
34 
35  bool isMemoryBound(const Function *F) const;
36 
37  bool needsWaveLimiter(const Function *F) const;
38 
39  struct FuncInfo {
40  unsigned MemInstCount;
41  unsigned InstCount;
42  unsigned IAMInstCount; // Indirect access memory instruction count
43  unsigned LSMInstCount; // Large stride memory instruction count
44  FuncInfo() : MemInstCount(0), InstCount(0), IAMInstCount(0),
45  LSMInstCount(0) {}
46  };
47 
49 
50 private:
51 
52  FuncInfoMap FIM;
53 };
54 } // namespace llvm
55 #endif // LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
bool needsWaveLimiter(const Function *F) const
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
F(f)
ValueMap< const Function *, FuncInfo > FuncInfoMap
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:285
void setPreservesAll()
Set by analyses that do not transform their input at all.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool isMemoryBound(const Function *F) const