LLVM  8.0.1
GCNSchedStrategy.h
Go to the documentation of this file.
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 "GCNRegPressure.h"
19 
20 namespace llvm {
21 
22 class SIMachineFunctionInfo;
23 class SIRegisterInfo;
24 class GCNSubtarget;
25 
26 /// This is a minimal scheduler strategy. The main difference between this
27 /// and the GenericScheduler is that GCNSchedStrategy uses different
28 /// heuristics to determine excess/critical pressure sets. Its goal is to
29 /// maximize kernel occupancy (i.e. maximum number of waves per simd).
31  friend class GCNScheduleDAGMILive;
32 
33  SUnit *pickNodeBidirectional(bool &IsTopNode);
34 
35  void pickNodeFromQueue(SchedBoundary &Zone, const CandPolicy &ZonePolicy,
36  const RegPressureTracker &RPTracker,
37  SchedCandidate &Cand);
38 
39  void initCandidate(SchedCandidate &Cand, SUnit *SU,
40  bool AtTop, const RegPressureTracker &RPTracker,
41  const SIRegisterInfo *SRI,
42  unsigned SGPRPressure, unsigned VGPRPressure);
43 
44  unsigned SGPRExcessLimit;
45  unsigned VGPRExcessLimit;
46  unsigned SGPRCriticalLimit;
47  unsigned VGPRCriticalLimit;
48 
49  unsigned TargetOccupancy;
50 
51  MachineFunction *MF;
52 
53 public:
55 
56  SUnit *pickNode(bool &IsTopNode) override;
57 
58  void initialize(ScheduleDAGMI *DAG) override;
59 
60  void setTargetOccupancy(unsigned Occ) { TargetOccupancy = Occ; }
61 };
62 
64 
65  const GCNSubtarget &ST;
66 
68 
69  // Occupancy target at the beginning of function scheduling cycle.
70  unsigned StartingOccupancy;
71 
72  // Minimal real occupancy recorder for the function.
73  unsigned MinOccupancy;
74 
75  // Scheduling stage number.
76  unsigned Stage;
77 
78  // Current region index.
79  size_t RegionIdx;
80 
81  // Vecor of regions recorder for later rescheduling
83  MachineBasicBlock::iterator>, 32> Regions;
84 
85  // Region live-in cache.
87 
88  // Region pressure cache.
90 
91  // Temporary basic block live-in cache.
93 
94  // Return current region pressure.
95  GCNRegPressure getRealRegPressure() const;
96 
97  // Compute and cache live-ins and pressure for all regions in block.
98  void computeBlockPressure(const MachineBasicBlock *MBB);
99 
100 
101 public:
103  std::unique_ptr<MachineSchedStrategy> S);
104 
105  void schedule() override;
106 
107  void finalizeSchedule() override;
108 };
109 
110 } // End namespace llvm
111 
112 #endif // GCNSCHEDSTRATEGY_H
uint64_t CallInst * C
SUnit * pickNode(bool &IsTopNode) override
Pick the best node to balance the schedule. Implements MachineSchedStrategy.
Each Scheduling boundary is associated with ready queues.
This class represents lattice values for constants.
Definition: AllocatorList.h:24
This is a minimal scheduler strategy.
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while...
MachineInstrBundleIterator< MachineInstr > iterator
Store the state used by GenericScheduler heuristics, required for the lifetime of one invocation of p...
Track the current register pressure at some position in the instruction stream, and remember the high...
Policy for scheduling the next instruction in the candidate&#39;s zone.
ScheduleDAGMILive * DAG
GenericScheduler shrinks the unscheduled zone using heuristics to balance the schedule.
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:847
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
GCNMaxOccupancySchedStrategy(const MachineSchedContext *C)
void initialize(ScheduleDAGMI *DAG) override
Initialize the strategy after building the DAG for a new region.
Scheduling unit. This is a node in the scheduling DAG.
Definition: ScheduleDAG.h:246