blob: a0068f55d2d2c1f29b500d3cb4e72b6ab2c35baa [file] [log] [blame]
Tom Stellard0d23ebe2016-08-29 19:42:52 +00001//===-- 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
19namespace llvm {
20
21class 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).
27class GCNMaxOccupancySchedStrategy : public GenericScheduler {
Stanislav Mekhanoshin582a5232017-02-15 17:19:50 +000028 friend class GCNScheduleDAGMILive;
Tom Stellard0d23ebe2016-08-29 19:42:52 +000029
30 SUnit *pickNodeBidirectional(bool &IsTopNode);
31
32 void pickNodeFromQueue(SchedBoundary &Zone, const CandPolicy &ZonePolicy,
33 const RegPressureTracker &RPTracker,
34 SchedCandidate &Cand);
35
36 void initCandidate(SchedCandidate &Cand, SUnit *SU,
37 bool AtTop, const RegPressureTracker &RPTracker,
38 const SIRegisterInfo *SRI,
Stanislav Mekhanoshin582a5232017-02-15 17:19:50 +000039 unsigned SGPRPressure, unsigned VGPRPressure);
Tom Stellard0d23ebe2016-08-29 19:42:52 +000040
Stanislav Mekhanoshin582a5232017-02-15 17:19:50 +000041 unsigned SGPRExcessLimit;
42 unsigned VGPRExcessLimit;
43 unsigned SGPRCriticalLimit;
44 unsigned VGPRCriticalLimit;
Tom Stellard0d23ebe2016-08-29 19:42:52 +000045
46public:
47 GCNMaxOccupancySchedStrategy(const MachineSchedContext *C);
48
49 SUnit *pickNode(bool &IsTopNode) override;
Stanislav Mekhanoshin582a5232017-02-15 17:19:50 +000050
51 void initialize(ScheduleDAGMI *DAG) override;
52};
53
54class GCNScheduleDAGMILive : public ScheduleDAGMILive {
55public:
56 GCNScheduleDAGMILive(MachineSchedContext *C,
57 std::unique_ptr<MachineSchedStrategy> S) :
58 ScheduleDAGMILive(C, std::move(S)) {}
59
60 void schedule() override;
Tom Stellard0d23ebe2016-08-29 19:42:52 +000061};
62
63} // End namespace llvm
64
65#endif // GCNSCHEDSTRATEGY_H