[PATCH] D34967: AMDGPU/SI: Fix Depth and Height computation for SI scheduler

Axel Davy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 16:18:37 PDT 2017


axeldavy created this revision.
axeldavy added a project: AMDGPU.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, kzhuravl, arsenm, MatzeB.

Fix Depth and Height to use the block cost, instead of 1.
Fix the Height computation (max instead of min).


Repository:
  rL LLVM

https://reviews.llvm.org/D34967

Files:
  lib/Target/AMDGPU/SIMachineScheduler.cpp


Index: lib/Target/AMDGPU/SIMachineScheduler.cpp
===================================================================
--- lib/Target/AMDGPU/SIMachineScheduler.cpp
+++ lib/Target/AMDGPU/SIMachineScheduler.cpp
@@ -1422,8 +1422,8 @@
     else {
       unsigned Depth = 0;
       for (SIScheduleBlock *Pred : Block->getPreds()) {
-        if (Depth < Pred->Depth + 1)
-          Depth = Pred->Depth + 1;
+        if (Depth < Pred->Depth + Pred->getCost())
+          Depth = Pred->Depth + Pred->getCost();
       }
       Block->Depth = Depth;
     }
@@ -1437,7 +1437,7 @@
     else {
       unsigned Height = 0;
       for (const auto &Succ : Block->getSuccs())
-        Height = std::min(Height, Succ.first->Height + 1);
+        Height = std::max(Height, Succ.first->Height + Succ.first->getCost());
       Block->Height = Height;
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34967.105123.patch
Type: text/x-patch
Size: 840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170703/9f80d52a/attachment.bin>


More information about the llvm-commits mailing list