LLVM  9.0.0svn
AMDGPUPerfHintAnalysis.h
Go to the documentation of this file.
1 //===- AMDGPUPerfHintAnalysis.h - analysis of functions memory traffic ----===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// \brief Analyzes if a function potentially memory bound and if a kernel
11 /// kernel may benefit from limiting number of waves to reduce cache thrashing.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
16 #define LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
17 #include "llvm/IR/ValueMap.h"
18 #include "llvm/Pass.h"
19 
20 namespace llvm {
21 
23  static char ID;
24 
25 public:
27 
28  bool runOnFunction(Function &F) override;
29 
30  void getAnalysisUsage(AnalysisUsage &AU) const override {
31  AU.setPreservesAll();
32  }
33 
34  bool isMemoryBound(const Function *F) const;
35 
36  bool needsWaveLimiter(const Function *F) const;
37 
38  struct FuncInfo {
39  unsigned MemInstCount;
40  unsigned InstCount;
41  unsigned IAMInstCount; // Indirect access memory instruction count
42  unsigned LSMInstCount; // Large stride memory instruction count
43  FuncInfo() : MemInstCount(0), InstCount(0), IAMInstCount(0),
44  LSMInstCount(0) {}
45  };
46 
48 
49 private:
50 
51  FuncInfoMap FIM;
52 };
53 } // namespace llvm
54 #endif // LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
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:284
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