1 //===- AMDGPUPerfHintAnalysis.h ---- analysis of memory traffic -*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
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.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
16 #define LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
18 #include "llvm/Analysis/CallGraphSCCPass.h"
19 #include "llvm/IR/ValueMap.h"
23 struct AMDGPUPerfHintAnalysis
: public CallGraphSCCPass
{
27 AMDGPUPerfHintAnalysis() : CallGraphSCCPass(ID
) {}
29 bool runOnSCC(CallGraphSCC
&SCC
) override
;
31 void getAnalysisUsage(AnalysisUsage
&AU
) const override
{
35 bool isMemoryBound(const Function
*F
) const;
37 bool needsWaveLimiter(const Function
*F
) const;
42 unsigned IAMInstCost
; // Indirect access memory instruction count
43 unsigned LSMInstCost
; // Large stride memory instruction count
44 bool HasDenseGlobalMemAcc
; // Set if at least 1 basic block has relatively
45 // high global memory access
47 : MemInstCost(0), InstCost(0), IAMInstCost(0), LSMInstCost(0),
48 HasDenseGlobalMemAcc(false) {}
51 typedef ValueMap
<const Function
*, FuncInfo
> FuncInfoMap
;
58 #endif // LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H