Skip to content

Commit 7cd6dfd

Browse files
esukhovfda0
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. (cherry picked from commit a50d048)
1 parent b12ccbc commit 7cd6dfd

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
@@ -779,6 +779,7 @@ DECLARE_IGC_REGKEY(debugString, DumpRegPressureEstimateFilter, 0, "Only dump Reg
779779
DECLARE_IGC_REGKEY(bool, EnableReusingXYZWStoreConstPayload, true, "Enable reusing XYZW stores const payload", false)
780780
DECLARE_IGC_REGKEY(bool, EnableReusingLSCStoreConstPayload, false, "Enable reusing LSC stores const payload", false)
781781
DECLARE_IGC_REGKEY(DWORD, RegPressureVerbocity, 0, "Different printing types", false)
782+
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)
782783
DECLARE_IGC_REGKEY(bool, ForceNoFP64bRegioning, false, "force regioning rules for FP and 64b FPU instructions", false)
783784
DECLARE_IGC_REGKEY(bool, EnableA64WA, true, "Guarantee A64 load/store addres-hi is uniform", true)
784785
DECLARE_IGC_REGKEY(bool, EnableSamplerSplit, false, "Split Sampler 3d message to odd and even", false)

0 commit comments

Comments
 (0)