Skip to content

Commit a7139a0

Browse files
pratikasharigcbot
authored andcommitted
Allow extra RA iterations before enabling fail safe RA
Allow extra RA iterations before enabling fail safe RA.
1 parent 9051b20 commit a7139a0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

visa/GraphColor.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11613,6 +11613,17 @@ bool GlobalRA::rerunGRAIter(bool rerunGRA)
1161311613
return false;
1161411614
}
1161511615

11616+
bool GlobalRA::kernelUsesDpas() const {
11617+
// Return true if kernel uses dpas
11618+
for (auto *bb : kernel.fg) {
11619+
for (auto *inst : *bb) {
11620+
if (inst->isDpas())
11621+
return true;
11622+
}
11623+
}
11624+
return false;
11625+
}
11626+
1161611627
//
1161711628
// graph coloring entry point. returns nonzero if RA fails
1161811629
//
@@ -11748,6 +11759,14 @@ int GlobalRA::coloringRegAlloc() {
1174811759
(builder.getOption(vISA_FastSpill) || fastCompile)
1174911760
? fastCompileIter
1175011761
: builder.getuint32Option(vISA_FailSafeRALimit);
11762+
if (kernelUsesDpas()) {
11763+
// Push out enabling fail safe by 2 iterations if kernel uses
11764+
// dpas. That's because with dpas, we need to reserve lots of
11765+
// GRFs and this causes us to generate significant spill/fill.
11766+
// It might be better to try few more iterations before
11767+
// finally enabling fail safe RA.
11768+
failSafeRAIteration = std::min(failSafeRAIteration + 2, maxRAIterations);
11769+
}
1175111770

1175211771
if (failSafeRAIteration == 0) { // Fail safe RA directly in iteration 0, used
1175311772
// for hybrid RA with spill

visa/GraphColor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,7 @@ class GlobalRA {
21532153
unsigned computeSpillSize(std::list<LSLiveRange *> &spilledLRs);
21542154
bool spillSpaceCompression(int spillSize,
21552155
const int globalScratchOffset);
2156+
bool kernelUsesDpas() const;
21562157

21572158
public:
21582159
// Store new variables created when inserting scalar imm

0 commit comments

Comments
 (0)