Skip to content

Commit b245009

Browse files
esukhovfda0
authored andcommitted
Additional flags and test added for picking kernel after
This commit adds additional flags and one test, for feature that selects a kernel, between the original and the retried one. (cherry picked from commit 480f8b6)
1 parent 3aff825 commit b245009

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

IGC/Compiler/CodeGenContext.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,17 +290,17 @@ namespace IGC
290290

291291
// basically a small work around, if we have high spilling kernel on our hands, we are not afraid to use
292292
// 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;
293+
unsigned int Threshold = IGC_GET_FLAG_VALUE(RetryRevertExcessiveSpillingKernelThreshold);
294+
bool IsExcessiveSpillKernel = currentShader->m_spillSize >= Threshold;
295+
float SpillCoefficient = float(IGC_GET_FLAG_VALUE(RetryRevertExcessiveSpillingKernelCoefficient)) / 100.0f;
296+
if (IsExcessiveSpillKernel) threshold = SpillCoefficient;
295297

296298
// Check if current shader spill is larger than previous shader spill
297299
// Threshold flag controls comparison tolerance - i.e. A threshold of 2.0 means that the
298300
// current shader spill must be 2x larger than previous spill to be considered "better".
299301
bool spillSizeBigger =
300302
currentShader->m_spillSize > (unsigned int)(previousShader->m_spillSize * threshold);
301303

302-
llvm::errs() << " spill size: " << currentShader->m_spillSize << "\n";
303-
304304
if (spillSizeBigger)
305305
{
306306
// 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
@@ -780,6 +780,7 @@ DECLARE_IGC_REGKEY(bool, EnableReusingXYZWStoreConstPayload, true, "Enable reusi
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)
782782
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)
783+
DECLARE_IGC_REGKEY(DWORD, RetryRevertExcessiveSpillingKernelCoefficient, 102, "Sets the coefficient for Retry Manager to know whether we should revert back to a previously compiled kernel", false)
783784
DECLARE_IGC_REGKEY(bool, ForceNoFP64bRegioning, false, "force regioning rules for FP and 64b FPU instructions", false)
784785
DECLARE_IGC_REGKEY(bool, EnableA64WA, true, "Guarantee A64 load/store addres-hi is uniform", true)
785786
DECLARE_IGC_REGKEY(bool, EnableSamplerSplit, false, "Split Sampler 3d message to odd and even", false)

0 commit comments

Comments
 (0)