LLVM  14.0.0git
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 
21 namespace llvm {
22 
24  static char ID;
25 
26 public:
28 
29  bool runOnSCC(CallGraphSCC &SCC) 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 MemInstCost;
41  unsigned InstCost;
42  unsigned IAMInstCost; // Indirect access memory instruction count
43  unsigned LSMInstCost; // Large stride memory instruction count
45  };
46 
48 
49 private:
50 
51  FuncInfoMap FIM;
52 };
53 } // namespace llvm
54 #endif // LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
llvm::AMDGPUPerfHintAnalysis::isMemoryBound
bool isMemoryBound(const Function *F) const
Definition: AMDGPUPerfHintAnalysis.cpp:389
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::AMDGPUPerfHintAnalysis::runOnSCC
bool runOnSCC(CallGraphSCC &SCC) override
runOnSCC - This method should be implemented by the subclass to perform whatever action is necessary ...
Definition: AMDGPUPerfHintAnalysis.cpp:366
llvm::Function
Definition: Function.h:62
llvm::AMDGPUPerfHintAnalysis::FuncInfoMap
ValueMap< const Function *, FuncInfo > FuncInfoMap
Definition: AMDGPUPerfHintAnalysis.h:47
llvm::AMDGPUPerfHintAnalysis::getAnalysisUsage
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - For this class, we declare that we require and preserve the call graph.
Definition: AMDGPUPerfHintAnalysis.h:31
llvm::AMDGPUPerfHintAnalysis::needsWaveLimiter
bool needsWaveLimiter(const Function *F) const
Definition: AMDGPUPerfHintAnalysis.cpp:397
llvm::AMDGPUPerfHintAnalysis::AMDGPUPerfHintAnalysis
AMDGPUPerfHintAnalysis()
Definition: AMDGPUPerfHintAnalysis.h:27
llvm::AMDGPUPerfHintAnalysis::FuncInfo::FuncInfo
FuncInfo()
Definition: AMDGPUPerfHintAnalysis.h:44
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::AMDGPUPerfHintAnalysis::FuncInfo
Definition: AMDGPUPerfHintAnalysis.h:39
llvm::AMDGPUPerfHintAnalysis::FuncInfo::InstCost
unsigned InstCost
Definition: AMDGPUPerfHintAnalysis.h:41
llvm::CallGraphSCC
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
Definition: CallGraphSCCPass.h:87
llvm::AMDGPUPerfHintAnalysis::ID
static char ID
Definition: AMDGPUPerfHintAnalysis.h:24
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition: PassAnalysisSupport.h:47
llvm::AMDGPUPerfHintAnalysis::FuncInfo::MemInstCost
unsigned MemInstCost
Definition: AMDGPUPerfHintAnalysis.h:40
llvm::AMDGPUPerfHintAnalysis::FuncInfo::LSMInstCost
unsigned LSMInstCost
Definition: AMDGPUPerfHintAnalysis.h:43
llvm::AMDGPUPerfHintAnalysis::FuncInfo::IAMInstCost
unsigned IAMInstCost
Definition: AMDGPUPerfHintAnalysis.h:42
llvm::AMDGPU::CPol::SCC
@ SCC
Definition: SIDefines.h:295
CallGraphSCCPass.h
llvm::ValueMap< const Function *, FuncInfo >
ValueMap.h
llvm::AnalysisUsage::setPreservesAll
void setPreservesAll()
Set by analyses that do not transform their input at all.
Definition: PassAnalysisSupport.h:130
llvm::CallGraphSCCPass
Definition: CallGraphSCCPass.h:34
llvm::AMDGPUPerfHintAnalysis
Definition: AMDGPUPerfHintAnalysis.h:23