Skip to content

Commit 476925c

Browse files
jfuentesigcbot
authored andcommitted
Add option to set spill threshold for 256GRF.
1 parent ffcd29a commit 476925c

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

visa/G4_Kernel.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,3 +2216,12 @@ bool GRFMode::hasLargerGRFSameThreads() const {
22162216

22172217
return configs[currentMode].numThreads == configs[largerGrfIdx].numThreads;
22182218
}
2219+
2220+
// Get spill threshold for current GRF mode
2221+
unsigned GRFMode::getSpillThreshold() const {
2222+
if (configs[currentMode].numGRF == 256 &&
2223+
options->getuInt32Option(vISA_SpillAllowed256GRF) > 0)
2224+
return options->getuInt32Option(vISA_SpillAllowed256GRF);
2225+
2226+
return options->getuInt32Option(vISA_SpillAllowed);
2227+
}

visa/G4_Kernel.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class GRFMode {
155155
unsigned setModeByRegPressure(unsigned maxRP, unsigned largestInputReg,
156156
bool forceGRFModedUp = false);
157157
bool hasLargerGRFSameThreads() const;
158+
unsigned getSpillThreshold() const;
158159

159160
unsigned getNumGRF() const { return configs[currentMode].numGRF; }
160161
unsigned getDefaultGRF() const { return configs[defaultMode].numGRF; }

visa/GraphColor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,7 @@ bool GlobalRA::canIncreaseGRF(unsigned spillSize, bool infCostSpilled) {
21522152
// - #GRFs selected and next larger one has same number of threads, or
21532153
// - Spill size is above threshold
21542154
if ((infCostSpilled || kernel.grfMode.hasLargerGRFSameThreads() ||
2155-
spillSize >= kernel.getuInt32Option(vISA_SpillAllowed)) &&
2155+
spillSize >= kernel.grfMode.getSpillThreshold()) &&
21562156
!didGRFIncrease) {
21572157
if (kernel.updateKernelToLargerGRF()) {
21582158
// GRF successfully increased

visa/include/VISAOptionsDefs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ DEF_VISA_OPTION(
168168
"Spill size allowed without increasing GRF number in VRT."
169169
"0 means VRT will always bump up the GRF number to avoid spills",
170170
256)
171+
DEF_VISA_OPTION(vISA_SpillAllowed256GRF, ET_INT32, "-spillAllowed256GRF",
172+
"USAGE: -spillAllowed256GRF <spillSize>.\n"
173+
"Override spill threshold for 256GRF config. If shader has "
174+
"spills < <spillSize>, #GRF is not bumped up. "
175+
"0 means no override",
176+
0)
171177
DEF_VISA_OPTION(vISA_ForceGRFModeUp, ET_INT32, "-forceGRFModeUp",
172178
"USAGE: -forceGRFModeUp <k>.\n"
173179
"Set the GRF mode k higher than the one selected by default"

0 commit comments

Comments
 (0)