diff options
author | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2017-02-28 17:22:39 +0000 |
---|---|---|
committer | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2017-02-28 17:22:39 +0000 |
commit | 282e8e4a726599257ae88a1a03b6444db8067dbb (patch) | |
tree | cb754006608ffb257563f4bbd20e0534d57730ec /llvm/lib/Target/AMDGPU/GCNSchedStrategy.h | |
parent | fb834a8278e628a04a84daa9f4ceb61c2dd84248 (diff) | |
download | bcm5719-llvm-282e8e4a726599257ae88a1a03b6444db8067dbb.tar.gz bcm5719-llvm-282e8e4a726599257ae88a1a03b6444db8067dbb.zip |
[AMDGPU] New method to estimate register pressure
This change introduces new method to estimate register pressure in
GCNScheduler. Standard RPTracker gives huge error due to the following
reasons:
1. It does not account for live-ins or live-outs if value is not used
in the region itself. That creates a huge error in a very common case
if there are a lot of live-thu registers.
2. It does not properly count subregs.
3. It assumes a register used as an input operand can be reused as an
output. This is not always possible by itself, this is not what RA
will finally do in many cases for various reasons not limited to RA's
inability to do so, and this is not so if the value is actually a
live-thu.
In addition we can now see clear separation between live-in pressure
which we cannot change with the scheduling and tentative pressure
which we can change.
Differential Revision: https://reviews.llvm.org/D30439
llvm-svn: 296491
Diffstat (limited to 'llvm/lib/Target/AMDGPU/GCNSchedStrategy.h')
-rw-r--r-- | llvm/lib/Target/AMDGPU/GCNSchedStrategy.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.h b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.h index a0068f55d2d..c84ea4b203d 100644 --- a/llvm/lib/Target/AMDGPU/GCNSchedStrategy.h +++ b/llvm/lib/Target/AMDGPU/GCNSchedStrategy.h @@ -52,12 +52,27 @@ public: }; class GCNScheduleDAGMILive : public ScheduleDAGMILive { + + // Region live-ins. + DenseMap<unsigned, LaneBitmask> LiveIns; + + // Number of live-ins to the current region, first SGPR then VGPR. + std::pair<unsigned, unsigned> LiveInPressure; + + // Collect current region live-ins. + void discoverLiveIns(); + + // Return current region pressure. First value is SGPR number, second is VGPR. + std::pair<unsigned, unsigned> getRealRegPressure() const; + public: GCNScheduleDAGMILive(MachineSchedContext *C, std::unique_ptr<MachineSchedStrategy> S) : ScheduleDAGMILive(C, std::move(S)) {} void schedule() override; + + void finalizeSchedule() override; }; } // End namespace llvm |