Tom Stellard | 0d23ebe | 2016-08-29 19:42:52 +0000 | [diff] [blame] | 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 { |
Stanislav Mekhanoshin | 582a523 | 2017-02-15 17:19:50 +0000 | [diff] [blame] | 28 | friend class GCNScheduleDAGMILive; |
Tom Stellard | 0d23ebe | 2016-08-29 19:42:52 +0000 | [diff] [blame] | 29 | |
| 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 Mekhanoshin | 582a523 | 2017-02-15 17:19:50 +0000 | [diff] [blame] | 39 | unsigned SGPRPressure, unsigned VGPRPressure); |
Tom Stellard | 0d23ebe | 2016-08-29 19:42:52 +0000 | [diff] [blame] | 40 | |
Stanislav Mekhanoshin | 582a523 | 2017-02-15 17:19:50 +0000 | [diff] [blame] | 41 | unsigned SGPRExcessLimit; |
| 42 | unsigned VGPRExcessLimit; |
| 43 | unsigned SGPRCriticalLimit; |
| 44 | unsigned VGPRCriticalLimit; |
Tom Stellard | 0d23ebe | 2016-08-29 19:42:52 +0000 | [diff] [blame] | 45 | |
| 46 | public: |
| 47 | GCNMaxOccupancySchedStrategy(const MachineSchedContext *C); |
| 48 | |
| 49 | SUnit *pickNode(bool &IsTopNode) override; |
Stanislav Mekhanoshin | 582a523 | 2017-02-15 17:19:50 +0000 | [diff] [blame] | 50 | |
| 51 | void initialize(ScheduleDAGMI *DAG) override; |
| 52 | }; |
| 53 | |
| 54 | class GCNScheduleDAGMILive : public ScheduleDAGMILive { |
| 55 | public: |
| 56 | GCNScheduleDAGMILive(MachineSchedContext *C, |
| 57 | std::unique_ptr<MachineSchedStrategy> S) : |
| 58 | ScheduleDAGMILive(C, std::move(S)) {} |
| 59 | |
| 60 | void schedule() override; |
Tom Stellard | 0d23ebe | 2016-08-29 19:42:52 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // End namespace llvm |
| 64 | |
| 65 | #endif // GCNSCHEDSTRATEGY_H |