Skip to content

Commit 2edd583

Browse files
ashwinikardileigcbot
authored andcommitted
Change the Spill Threshold (based on API)for SLM heuristic for better SIMD selection.
Change the Spill Threshold per API for SLM heuristic for better SIMD selection.
1 parent 9896d24 commit 2edd583

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

IGC/Compiler/CISACodeGen/DriverInfo.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ namespace IGC
304304
// Determines whether the PAYLOAD_HEADER implicit arg must be present
305305
virtual bool RequirePayloadHeader() const { return true; }
306306

307+
virtual float getCSSpillThresholdSLM() const { return 12; }
308+
307309

308310

309311
};

IGC/Compiler/CodeGenContext.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,13 @@ namespace IGC
506506

507507
float ComputeShaderContext::GetSpillThreshold() const
508508
{
509-
float spillThresholdSLM =
510-
float(IGC_GET_FLAG_VALUE(CSSpillThresholdSLM)) / 100.0f;
509+
//CSSpillThresholdSLM is initialized as 0. If CSSpillThresholdSLM = 0, it is set to 12 as its default value, otherwise it is set to 9 for Dx12 API.
510+
511+
float spillThresholdSLM = 0;
512+
spillThresholdSLM = m_DriverInfo.getCSSpillThresholdSLM();
513+
514+
if(IGC_IS_FLAG_ENABLED(CSSpillThresholdSLMOverride))
515+
spillThresholdSLM = float(IGC_GET_FLAG_VALUE(CSSpillThresholdSLM)) / 100.0f;
511516
float spillThresholdNoSLM =
512517
float(IGC_GET_FLAG_VALUE(CSSpillThresholdNoSLM)) / 100.0f;
513518
return m_slmSize ? spillThresholdSLM : spillThresholdNoSLM;

IGC/common/igc_flags.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ DECLARE_IGC_REGKEY(bool, EnableSelectiveScalarizer, false, "enable selectiv
319319
DECLARE_IGC_REGKEY(bool, HoistPSConstBufferValues, true, "Hoists up down converts for contant buffer accesses, so they an be vectorized more easily.", false)
320320
DECLARE_IGC_REGKEY(bool, EnableSingleVertexDispatch, false, "Vertex Shader Single Patch Dispatch Regkey", false)
321321
DECLARE_IGC_REGKEY(bool, allowLICM, true, "Enable LICM in IGC.", false)
322-
DECLARE_IGC_REGKEY(DWORD, CSSpillThresholdSLM, 12, "Spill Threshold for CS SIMD16 with SLM", false)
322+
DECLARE_IGC_REGKEY(bool, CSSpillThresholdSLMOverride, false, "Override for CSSpillThresholdSLM", false)
323+
DECLARE_IGC_REGKEY(DWORD, CSSpillThresholdSLM, 0, "Spill Threshold for CS SIMD16 with SLM, use CSSpillThresholdSLMOverride along with this", false)
323324
DECLARE_IGC_REGKEY(DWORD, CSSpillThresholdNoSLM, 5, "Spill Threshold for CS SIMD16 without SLM", false)
324325
DECLARE_IGC_REGKEY(DWORD, AllowedSpillRegCount, 0, "Max allowed spill size without recompile", false)
325326
DECLARE_IGC_REGKEY(DWORD, LICMStatThreshold, 70, "LICM stat threshold to avoid retry SIMD16 for CS", false)

0 commit comments

Comments
 (0)