[llvm] r298861 - [AMDGPU] SISched: Update colorEndsAccordingToDependencies
Valery Pykhtin via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 27 10:26:40 PDT 2017
Author: vpykhtin
Date: Mon Mar 27 12:26:40 2017
New Revision: 298861
URL: http://llvm.org/viewvc/llvm-project?rev=298861&view=rev
Log:
[AMDGPU] SISched: Update colorEndsAccordingToDependencies
Patch by Axel Davy (axel.davy at normalesup.org)
Differential revision: https://reviews.llvm.org/D30150
Modified:
llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp?rev=298861&r1=298860&r2=298861&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIMachineScheduler.cpp Mon Mar 27 12:26:40 2017
@@ -835,6 +835,17 @@ void SIScheduleBlockCreator::colorEndsAc
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 @@ void SIScheduleBlockCreator::colorEndsAc
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
More information about the llvm-commits
mailing list