Skip to content

Commit a50d048

Browse files
esukhovigcbot
authored andcommitted
High Spilling Kernels are treated differently when deciding
whether to use previous kernel High Spilling Kernels are treated differently when deciding whether to use previous kernel. If it's a high spilling kernel, threshold is set as an igc flag, and we have less instructions and less spills in previous kernel (before retry) we take it instead.
1 parent 888d855 commit a50d048

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

IGC/Compiler/CodeGenContext.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,19 @@ namespace IGC
288288
IGC_ASSERT(currentShader);
289289
IGC_ASSERT(previousShader);
290290

291+
// basically a small work around, if we have high spilling kernel on our hands, we are not afraid to use
292+
// pre-retry shader, when we have less spills than retry one has
293+
bool IsExcessiveSpillKernel = currentShader->m_spillSize >= IGC_GET_FLAG_VALUE(RetryRevertExcessiveSpillingKernelThreshold);
294+
if (IsExcessiveSpillKernel) threshold = 1.02f;
295+
291296
// Check if current shader spill is larger than previous shader spill
292297
// Threshold flag controls comparison tolerance - i.e. A threshold of 2.0 means that the
293298
// current shader spill must be 2x larger than previous spill to be considered "better".
294299
bool spillSizeBigger =
295300
currentShader->m_spillSize > (unsigned int)(previousShader->m_spillSize * threshold);
296301

302+
llvm::errs() << " spill size: " << currentShader->m_spillSize << "\n";
303+
297304
if (spillSizeBigger)
298305
{
299306
// The previous shader was better, ignore any future retry compilation

IGC/common/igc_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,7 @@ DECLARE_IGC_REGKEY(debugString, DumpRegPressureEstimateFilter, 0, "Only dump Reg
784784
DECLARE_IGC_REGKEY(bool, EnableReusingXYZWStoreConstPayload, true, "Enable reusing XYZW stores const payload", false)
785785
DECLARE_IGC_REGKEY(bool, EnableReusingLSCStoreConstPayload, false, "Enable reusing LSC stores const payload", false)
786786
DECLARE_IGC_REGKEY(DWORD, RegPressureVerbocity, 0, "Different printing types", false)
787+
DECLARE_IGC_REGKEY(DWORD, RetryRevertExcessiveSpillingKernelThreshold, 10000, "Sets the threshold for Retry Manager to know which kernel is considered as Excessive Spilling and applies different set of rules", false)
787788
DECLARE_IGC_REGKEY(bool, ForceNoFP64bRegioning, false, "force regioning rules for FP and 64b FPU instructions", false)
788789
DECLARE_IGC_REGKEY(bool, EnableA64WA, true, "Guarantee A64 load/store addres-hi is uniform", true)
789790
DECLARE_IGC_REGKEY(bool, EnableSamplerSplit, false, "Split Sampler 3d message to odd and even", false)

0 commit comments

Comments
 (0)