[PATCH] D67242: AMDGPU: Avoid constructing new std::vector in initCandidate
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 15:37:06 PDT 2019
arsenm created this revision.
arsenm added reviewers: vpykhtin, rampitec.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.
Approximately 30% of the time was spent in the std::vector
constructor. In one testcase this pushes the scheduler to being the
second slowest pass.
I'm not sure I understand why these vector are necessary. The default
scheduler initCandidate seems to use some pre-existing vectors for the
pressure.
https://reviews.llvm.org/D67242
Files:
lib/Target/AMDGPU/GCNSchedStrategy.cpp
lib/Target/AMDGPU/GCNSchedStrategy.h
Index: lib/Target/AMDGPU/GCNSchedStrategy.h
===================================================================
--- lib/Target/AMDGPU/GCNSchedStrategy.h
+++ lib/Target/AMDGPU/GCNSchedStrategy.h
@@ -40,6 +40,9 @@
const SIRegisterInfo *SRI,
unsigned SGPRPressure, unsigned VGPRPressure);
+ std::vector<unsigned> Pressure;
+ std::vector<unsigned> MaxPressure;
+
unsigned SGPRExcessLimit;
unsigned VGPRExcessLimit;
unsigned SGPRCriticalLimit;
Index: lib/Target/AMDGPU/GCNSchedStrategy.cpp
===================================================================
--- lib/Target/AMDGPU/GCNSchedStrategy.cpp
+++ lib/Target/AMDGPU/GCNSchedStrategy.cpp
@@ -71,8 +71,8 @@
// the tracker, so we need to pass those function a non-const copy.
RegPressureTracker &TempTracker = const_cast<RegPressureTracker&>(RPTracker);
- std::vector<unsigned> Pressure;
- std::vector<unsigned> MaxPressure;
+ Pressure.clear();
+ MaxPressure.clear();
if (AtTop)
TempTracker.getDownwardPressure(SU->getInstr(), Pressure, MaxPressure);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67242.218996.patch
Type: text/x-patch
Size: 1079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190905/7de1eeb3/attachment.bin>
More information about the llvm-commits
mailing list