[PATCH] D30150: AMDGPU/SI: Update colorEndsAccordingToDependencies

Axel Davy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 15:28:08 PDT 2017


axeldavy updated this revision to Diff 92874.
axeldavy added a comment.
Herald added a subscriber: dstuttard.

Add assert over the initialization of Current*ReservedDependencyColoring and DAGSIZE


Repository:
  rL LLVM

https://reviews.llvm.org/D30150

Files:
  lib/Target/AMDGPU/SIMachineScheduler.cpp


Index: lib/Target/AMDGPU/SIMachineScheduler.cpp
===================================================================
--- lib/Target/AMDGPU/SIMachineScheduler.cpp
+++ lib/Target/AMDGPU/SIMachineScheduler.cpp
@@ -835,6 +835,17 @@
   unsigned DAGSize = DAG->SUnits.size();
   std::vector<int> PendingColoring = CurrentColoring;
 
+  assert(DAGSize >= 1 &&
+         CurrentBottomUpReservedDependencyColoring.size() == DAGSize &&
+         CurrentTopDownReservedDependencyColoring.size() == DAGSize);
+  // If there is no reserved block at all, do nothing. We don't want
+  // everything in one block.
+  if (*std::max_element(CurrentBottomUpReservedDependencyColoring.begin(),
+                        CurrentBottomUpReservedDependencyColoring.end()) == 0 &&
+      *std::max_element(CurrentTopDownReservedDependencyColoring.begin(),
+                        CurrentTopDownReservedDependencyColoring.end()) == 0)
+    return;
+
   for (unsigned SUNum : DAG->BottomUpIndex2SU) {
     SUnit *SU = &DAG->SUnits[SUNum];
     std::set<unsigned> SUColors;
@@ -856,6 +867,9 @@
         SUColors.insert(CurrentColoring[Succ->NodeNum]);
       SUColorsPending.insert(PendingColoring[Succ->NodeNum]);
     }
+    // If there is only one child/parent block, and that block
+    // is not among the ones we are removing in this path, then
+    // merge the instruction to that block
     if (SUColors.size() == 1 && SUColorsPending.size() == 1)
       PendingColoring[SU->NodeNum] = *SUColors.begin();
     else // TODO: Attribute new colors depending on color


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30150.92874.patch
Type: text/x-patch
Size: 1545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170323/eb37e518/attachment.bin>


More information about the llvm-commits mailing list