Skip to content

Commit 4afa8c0

Browse files
pratikasharigcbot
authored andcommitted
Enable reg chart dump for > 128 GRFs
This PR enables reg chart dump for large GRF config. It now prints only as many GRFs as are available in current VRT config. It also skips printing busy/free for label as that can be misleading, especially for entry label.
1 parent 61b96b3 commit 4afa8c0

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

visa/RADebug.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,8 @@ bool Interference::dumpIntf(const char *s) const {
10521052
// use temp allocations from lrs. Doesnt handle sub-routines yet.
10531053
void RegChartDump::dumpRegChart(std::ostream &os, const LiveRangeVec &lrs,
10541054
unsigned numLRs) {
1055-
constexpr unsigned N = 128;
1055+
constexpr unsigned N = 1024;
1056+
vISA_ASSERT(N >= gra.kernel.getNumRegTotal(), "more GRFs than N");
10561057
std::unordered_map<G4_INST *, std::bitset<N>> busyGRFPerInst;
10571058
bool dumpHex = false;
10581059

@@ -1091,7 +1092,15 @@ void RegChartDump::dumpRegChart(std::ostream &os, const LiveRangeVec &lrs,
10911092
auto startInst = startEnd[dcl].first;
10921093
auto endInst = startEnd[dcl].second;
10931094

1094-
bool start = (dcl->getRegFile() == G4_RegFileKind::G4_INPUT);
1095+
bool start = false;
1096+
if (gra.kernel.fg.getIsStackCallFunc()) {
1097+
start = (dcl->getRegFile() & G4_RegFileKind::G4_INPUT);
1098+
} else {
1099+
// Pre-defined %arg dcl uses G4_INPUT RegFileKind but it isn't live-in
1100+
// to a kernel. So make an exception.
1101+
if (!gra.kernel.fg.builder->isPreDefArg(dcl))
1102+
start = (dcl->getRegFile() & G4_RegFileKind::G4_INPUT);
1103+
}
10951104
bool done = false;
10961105
for (auto bb : gra.kernel.fg) {
10971106
for (auto inst : *bb) {
@@ -1127,6 +1136,11 @@ void RegChartDump::dumpRegChart(std::ostream &os, const LiveRangeVec &lrs,
11271136
inst->emit(ss);
11281137
auto len = ss.str().length();
11291138

1139+
if (inst->isLabel()) {
1140+
os << ss.str() << "\n";
1141+
continue;
1142+
}
1143+
11301144
if (len <= maxInstLen) {
11311145
os << ss.str();
11321146
for (unsigned i = 0; i != maxInstLen - ss.str().length(); i++)
@@ -1141,7 +1155,7 @@ void RegChartDump::dumpRegChart(std::ostream &os, const LiveRangeVec &lrs,
11411155

11421156
if (!dumpHex) {
11431157
// dump GRFs | - busy, * - free
1144-
for (unsigned i = 0; i != N; i++) {
1158+
for (unsigned i = 0; i != gra.kernel.getNumRegTotal(); i++) {
11451159
// emit in groups of 10 GRFs
11461160
if (i > 0 && (i % 10) == 0)
11471161
os << " ";

0 commit comments

Comments
 (0)