1 //===-- GCNSchedStrategy.h - GCN Scheduler Strategy -*- C++ -*-------------===//
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 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_AMDGPU_GCNSCHEDSTRATEGY_H
15 #define LLVM_LIB_TARGET_AMDGPU_GCNSCHEDSTRATEGY_H
16 
17 #include "llvm/CodeGen/MachineScheduler.h"
18 
19 namespace llvm {
20 
21 class SIRegisterInfo;
22 
23 /// This is a minimal scheduler strategy.  The main difference between this
24 /// and the GenericScheduler is that GCNSchedStrategy uses different
25 /// heuristics to determine excess/critical pressure sets.  Its goal is to
26 /// maximize kernel occupancy (i.e. maximum number of waves per simd).
27 class GCNMaxOccupancySchedStrategy : public GenericScheduler {
28 
29   SUnit *pickNodeBidirectional(bool &IsTopNode);
30 
31   void pickNodeFromQueue(SchedBoundary &Zone, const CandPolicy &ZonePolicy,
32                          const RegPressureTracker &RPTracker,
33                          SchedCandidate &Cand);
34 
35   void initCandidate(SchedCandidate &Cand, SUnit *SU,
36                      bool AtTop, const RegPressureTracker &RPTracker,
37                      const SIRegisterInfo *SRI,
38                      int SGPRPressure, int VGPRPressure,
39                      int SGPRExcessLimit, int VGPRExcessLimit,
40                      int SGPRCriticalLimit, int VGPRCriticalLimit);
41 
42   void tryCandidate(SchedCandidate &Cand, SchedCandidate &TryCand,
43                     SchedBoundary *Zone, const SIRegisterInfo *SRI,
44                     unsigned SGPRPressure, unsigned VGPRPressure);
45 
46 public:
47   GCNMaxOccupancySchedStrategy(const MachineSchedContext *C);
48 
49   SUnit *pickNode(bool &IsTopNode) override;
50 };
51 
52 } // End namespace llvm
53 
54 #endif // GCNSCHEDSTRATEGY_H
55