LLVM  10.0.0svn
AMDGPUPerfHintAnalysis.h
Go to the documentation of this file.
1 //===- AMDGPUPerfHintAnalysis.h ---- analysis of memory traffic -*- C++ -*-===//
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 
19 #include "llvm/IR/ValueMap.h"
20 #include "llvm/Pass.h"
21 
22 namespace llvm {
23 
25  static char ID;
26 
27 public:
29 
30  bool runOnSCC(CallGraphSCC &SCC) override;
31 
32  void getAnalysisUsage(AnalysisUsage &AU) const override {
33  AU.setPreservesAll();
34  }
35 
36  bool isMemoryBound(const Function *F) const;
37 
38  bool needsWaveLimiter(const Function *F) const;
39 
40  struct FuncInfo {
41  unsigned MemInstCount;
42  unsigned InstCount;
43  unsigned IAMInstCount; // Indirect access memory instruction count
44  unsigned LSMInstCount; // Large stride memory instruction count
45  FuncInfo() : MemInstCount(0), InstCount(0), IAMInstCount(0),
46  LSMInstCount(0) {}
47  };
48 
50 
51 private:
52 
53  FuncInfoMap FIM;
54 };
55 } // namespace llvm
56 #endif // LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool needsWaveLimiter(const Function *F) const
F(f)
ValueMap< const Function *, FuncInfo > FuncInfoMap
bool runOnSCC(CallGraphSCC &SCC) override
runOnSCC - This method should be implemented by the subclass to perform whatever action is necessary ...
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - For this class, we declare that we require and preserve the call graph...
bool isMemoryBound(const Function *F) const
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.