Skip to content

Commit

Permalink
[AMDGPU] SISched: Update colorEndsAccordingToDependencies
Browse files Browse the repository at this point in the history
Patch by Axel Davy ([email protected])

Differential revision: https://reviews.llvm.org/D30150

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298861 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
vpykhtin committed Mar 27, 2017
1 parent 82ba8a6 commit 96f1d45
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Target/AMDGPU/SIMachineScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,17 @@ void SIScheduleBlockCreator::colorEndsAccordingToDependencies() {
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;
Expand All @@ -856,6 +867,9 @@ void SIScheduleBlockCreator::colorEndsAccordingToDependencies() {
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
Expand Down

0 comments on commit 96f1d45

Please sign in to comment.