Skip to content

Commit

Permalink
[ResourceScoreboard] Hide power-of-two size detail
Browse files Browse the repository at this point in the history
The original dumper is more readable for short scoreboards
  • Loading branch information
Martien de Jong authored and andcarminati committed Aug 21, 2024
1 parent 28a4904 commit b906925
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
25 changes: 22 additions & 3 deletions llvm/include/llvm/CodeGen/ResourceScoreboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ template <typename RC> class ResourceScoreboard {
RC &operator[](int Cycle) { return Cycles[(Head + Cycle) & (Size - 1)]; }

void reset(int D = 1) {
// Implementation relies on masking to wrap-around, so round up
// to a power of two.
int Pow2 = 1;
while (Pow2 < D) {
Pow2 += Pow2;
}
if (Cycles.empty()) {
Depth = D;
Depth = Pow2;
Size = 2 * Depth;
}
// Check for a power of two
assert((Size & (Size - 1)) == 0);
Cycles.clear();
Cycles.resize(Size);
Head = 0;
Expand Down Expand Up @@ -151,6 +155,21 @@ template <typename RC> class ResourceScoreboard {
dbgs() << "+ " << Repeats << " more\n";
}
}

// Print the full scoreboard .
void dumpFull() const {
int First = firstOccupied();
int Last = lastOccupied();
for (int C = First; C <= Last; C++) {
const RC &Cycle = (*this)[C];
if (C == 0) {
dbgs() << ">";
}
dbgs() << "\t";
Cycle.dump();
dbgs() << "\n";
}
}
};

} // end namespace llvm
Expand Down
9 changes: 1 addition & 8 deletions llvm/lib/Target/AIE/AIEHazardRecognizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,14 +599,7 @@ unsigned AIEHazardRecognizer::computeScoreboardDepth() const {
return 0;
}

Depth = std::max(Depth, UserScoreboardDepth.getValue());

// Find the next power-of-2 >= Depth
unsigned ScoreboardDepth = 1;
while (ScoreboardDepth < Depth) {
ScoreboardDepth *= 2;
}
return ScoreboardDepth;
return std::max(Depth, UserScoreboardDepth.getValue());
}

std::optional<unsigned>
Expand Down

0 comments on commit b906925

Please sign in to comment.