Skip to content

Commit 6a9d8ec

Browse files
krystian-andrzejewskiZuul
authored andcommitted
Insert HDC fence before EOT when sparse aliased resources may be present.
Change-Id: Ia177317ed91e0058e16d227d7f2a1019f9eeb74d
1 parent 9560122 commit 6a9d8ec

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3812,7 +3812,13 @@ namespace IGC
38123812
SaveOption(vISA_clearScratchWritesBeforeEOT, true);
38133813
}
38143814

3815-
if (context->type == ShaderType::PIXEL_SHADER)
3815+
bool clearHDCWritesBeforeEOT = m_program->m_DriverInfo->UsesSparseAliasedResidency() &&
3816+
context->platform.WaInsertHDCFenceBeforeEOTWhenSparseAliasedResources();
3817+
clearHDCWritesBeforeEOT |= context->type == ShaderType::PIXEL_SHADER &&
3818+
context->platform.NeedsHDCFenceBeforeEOTInPixelShader();
3819+
clearHDCWritesBeforeEOT |= IGC_IS_FLAG_ENABLED(ForceMemoryFenceBeforeEOT);
3820+
3821+
if (clearHDCWritesBeforeEOT)
38163822
{
38173823
SaveOption(vISA_clearHDCWritesBeforeEOT, true);
38183824
}

IGC/Compiler/CISACodeGen/DriverInfo.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ namespace IGC
8080
/// The driver uses typed or untyped constant buffers (for ld_raw vs sampler)
8181
virtual bool UsesTypedConstantBuffersGPGPU() const { return true; }
8282

83+
/// The driver uses sparse aliased residency
84+
virtual bool UsesSparseAliasedResidency() const { return false; }
85+
8386
/// The driver doesn't clear the vertex header so it needs to be done in the compiler
8487
virtual bool NeedClearVertexHeader() const { return false; }
8588

IGC/Compiler/CISACodeGen/Platform.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ namespace IGC
373373
return true;
374374
}
375375

376+
bool NeedsHDCFenceBeforeEOTInPixelShader() const
377+
{
378+
return false;
379+
}
376380
// ***** Below go accessor methods for testing WA data from WA_TABLE *****
377381

378382
bool WaDoNotPushConstantsForAllPulledGSTopologies() const
@@ -475,6 +479,11 @@ namespace IGC
475479

476480
}
477481

482+
bool WaInsertHDCFenceBeforeEOTWhenSparseAliasedResources() const
483+
{
484+
return IGFX_GEN11_CORE >= m_platformInfo.eRenderCoreFamily;
485+
}
486+
478487
const SCompilerHwCaps& GetCaps() { return m_caps; }
479488
};
480489

IGC/common/igc_flags.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ DECLARE_IGC_REGKEY(DWORD, RetryManagerFirstStateId, 0, "For debugging pu
201201
DECLARE_IGC_REGKEY(bool, DisableSendSrcDstOverlapWA, false, "Disable Send Source/destination overlap WA which is enabled for GEN10/GEN11 and whenever Wddm2Svm is set in WATable", false)
202202
DECLARE_IGC_REGKEY(debugString, DisablePassToggles, 0, "Disable each IGC pass by setting the bit. HEXADECIMAL ONLY!. Ex: C0 is to disable pass 6 and pass 7.", false)
203203
DECLARE_IGC_REGKEY(bool, ForceStatelessForQueueT, true, "In OCL, force to use stateless memory to hold queue_t*. This is a legacy feature to be removed.", false)
204+
DECLARE_IGC_REGKEY(bool, ForceMemoryFenceBeforeEOT, false, "Forces inserting SLM or gloabal memory fence before EOT if shader writes to SLM or goblam memory respectively.", false)
204205

205206
DECLARE_IGC_GROUP("Shader dumping")
206207
DECLARE_IGC_REGKEY(bool, EnableCosDump, false, "Enable cos dump", true)

visa/Optimizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8058,7 +8058,7 @@ void genBucket(G4_INST *send, Bucket *bucket, RW rwType) {
80588058
// ToDo: add fence only when the writes can reach EOT without a fence in between
80598059
void Optimizer::insertFenceBeforeEOT()
80608060
{
8061-
if (!builder.needFenceBeforeEOT() || !builder.getOption(vISA_clearHDCWritesBeforeEOT))
8061+
if (!builder.getOption(vISA_clearHDCWritesBeforeEOT))
80628062
{
80638063
return;
80648064
}

0 commit comments

Comments
 (0)