Skip to content

Commit e20fddf

Browse files
jaladreipsigcbot
authored andcommitted
Internal raytracing changes
Internal raytracing changes
1 parent 42d98f4 commit e20fddf

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

IGC/Compiler/CISACodeGen/CShaderProgram.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ CShader*& CShaderProgram::GetShaderPtr(SIMDMode simd, ShaderDispatchMode mode)
4747
return m_SIMDshaders[0];
4848
}
4949

50+
CShader* CShaderProgram::GetShaderIfAny(ShaderDispatchMode mode)
51+
{
52+
auto simdToAnalysis = { SIMDMode::SIMD32, SIMDMode::SIMD16, SIMDMode::SIMD8 };
53+
54+
for (auto simd : simdToAnalysis)
55+
{
56+
if (auto* shader = GetShader(simd, mode); shader && shader->ProgramOutput()->m_programSize > 0)
57+
return shader;
58+
}
59+
60+
return nullptr;
61+
}
62+
5063
void CShaderProgram::ClearShaderPtr(SIMDMode simd)
5164
{
5265
switch (simd)

IGC/Compiler/CISACodeGen/CShaderProgram.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace IGC
3232
CShaderProgram& operator=(const CShaderProgram&) = delete;
3333
CShader* GetOrCreateShader(SIMDMode simd, ShaderDispatchMode mode = ShaderDispatchMode::NOT_APPLICABLE);
3434
CShader* GetShader(SIMDMode simd, ShaderDispatchMode mode = ShaderDispatchMode::NOT_APPLICABLE);
35+
CShader* GetShaderIfAny(ShaderDispatchMode mode = ShaderDispatchMode::NOT_APPLICABLE);
3536
void DeleteShader(SIMDMode simd, ShaderDispatchMode mode = ShaderDispatchMode::NOT_APPLICABLE);
3637
CodeGenContext* GetContext() { return m_context; }
3738

IGC/Compiler/CodeGenContext.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -279,23 +279,8 @@ namespace IGC
279279
{
280280
auto simdToAnalysis = { SIMDMode::SIMD32, SIMDMode::SIMD16, SIMDMode::SIMD8 };
281281

282-
CShader* previousShader = nullptr;
283-
CShader* currentShader = nullptr;
284-
285-
// Get shaders
286-
for (auto simd : simdToAnalysis)
287-
{
288-
if (!previousShader && pPrevious->GetShader(simd) &&
289-
(pPrevious->GetShader(simd)->ProgramOutput()->m_programSize > 0))
290-
{
291-
previousShader = pPrevious->GetShader(simd);
292-
}
293-
if (!currentShader && pCurrent->GetShader(simd) &&
294-
(pCurrent->GetShader(simd)->ProgramOutput()->m_programSize > 0))
295-
{
296-
currentShader = pCurrent->GetShader(simd);
297-
}
298-
}
282+
CShader* previousShader = pPrevious->GetShaderIfAny();
283+
CShader* currentShader = pCurrent->GetShaderIfAny();
299284

300285
IGC_ASSERT(currentShader);
301286
IGC_ASSERT(previousShader);

IGC/common/igc_flags.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,11 +1122,11 @@ DECLARE_IGC_GROUP("Raytracing Options")
11221122
DECLARE_IGC_REGKEY(bool, DisablePredicatedStackIDRelease, false, "Emit a single stack ID release at the end of the shader", true)
11231123
DECLARE_IGC_REGKEY(bool, DisableCrossFillRemat, false, "Rematerialize values if they use already spilled values", true)
11241124
DECLARE_IGC_REGKEY(bool, EnableSyncDispatchRays, false, "Enable sync DispatchRays implementation", false)
1125-
DECLARE_IGC_REGKEY(bool, ForceRTRetry, false, "Raytracing is compiled in the second retry state", false)
1126-
DECLARE_IGC_REGKEY(bool, DisableRTRetryPickBetter, false, "Disables raytracing retry to pick the best compilation instead of always using the retry compilation.", false)
1127-
DECLARE_IGC_REGKEY(DWORD, RetryRTSpillMemThreshold, 200, "Only retry if spill mem used is more than this value", false)
1128-
DECLARE_IGC_REGKEY(DWORD, RetryRTSpillCostThreshold, 5, "Only retry if the percentage of spills (over total instructions) is more than this value", false)
1129-
DECLARE_IGC_REGKEY(DWORD, RetryRTPickBetterThreshold, 10, "Only pick the retry shader if the spill cost of the 2nd compilation is at least this percentage better than the previous compilation", false)
1125+
DECLARE_IGC_REGKEY(bool, ForceRTRetry, false, "Raytracing is compiled in the second retry state", false)
1126+
DECLARE_IGC_REGKEY(bool, DisableRTRetryPickBetter, false, "Disables raytracing retry to pick the best compilation instead of always using the retry compilation.", false)
1127+
DECLARE_IGC_REGKEY(DWORD, RetryRTSpillMemThreshold, 200, "Only retry if spill mem used is more than this value", false)
1128+
DECLARE_IGC_REGKEY(DWORD, RetryRTSpillCostThreshold, 5, "Only retry if the percentage of spills (over total instructions) is more than this value", false)
1129+
DECLARE_IGC_REGKEY(DWORD, RetryRTPickBetterThreshold, 10, "Only pick the retry shader if the spill cost of the 2nd compilation is at least this percentage better than the previous compilation", false)
11301130
DECLARE_IGC_REGKEY(bool, EnableFillScheduling, false, "Schedule fills for reduced register pressure", false)
11311131
DECLARE_IGC_REGKEY(bool, DisableSWStackOffsetElision, false, "Avoid loading offseting when known at compile-time", false)
11321132
DECLARE_IGC_REGKEY(DWORD, OverrideTMax, 0, "Force TMax to the given value. When 0, do nothing.", false)

0 commit comments

Comments
 (0)