[PATCH] D97342: [AMDGPU] Skip unclusterd rescheduling w/o ld/st

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 15:37:29 PST 2021


rampitec created this revision.
rampitec added reviewers: arsenm, kerbowa, vpykhtin, alex-t.
Herald added subscribers: hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
rampitec requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

We are attempting rescheduling without load store clustering
if occupancy limits were not met with clustering. Skip this
for regions which do not have any loads or stores at all.

In a set of kernels I am experimenting with this improves
scheduling time by ~30%.


https://reviews.llvm.org/D97342

Files:
  llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp


Index: llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
+++ llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
@@ -304,7 +304,9 @@
 
   std::vector<MachineInstr*> Unsched;
   Unsched.reserve(NumRegionInstrs);
+  bool SeenLdSt = false;
   for (auto &I : *this) {
+    SeenLdSt |= I.mayLoadOrStore();
     Unsched.push_back(&I);
   }
 
@@ -379,6 +381,8 @@
         PressureAfter.less(ST, PressureBefore) ||
         !RescheduleRegions[RegionIdx]) {
       Pressure[RegionIdx] = PressureAfter;
+      if (!SeenLdSt && (Stage + 1) == UnclusteredReschedule)
+        RescheduleRegions[RegionIdx] = false;
       return;
     } else {
       LLVM_DEBUG(dbgs() << "New pressure will result in more spilling.\n");
@@ -386,7 +390,8 @@
   }
 
   LLVM_DEBUG(dbgs() << "Attempting to revert scheduling.\n");
-  RescheduleRegions[RegionIdx] = true;
+  RescheduleRegions[RegionIdx] = SeenLdSt ||
+                                 (Stage + 1) != UnclusteredReschedule;
   RegionEnd = RegionBegin;
   for (MachineInstr *MI : Unsched) {
     if (MI->isDebugInstr())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97342.325917.patch
Type: text/x-patch
Size: 1153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210223/1735eaf7/attachment.bin>


More information about the llvm-commits mailing list