Skip to content

Commit 9dda44d

Browse files
mmereckiigcbot
authored andcommitted
Add possibility to disable ShrinkArrayAlloca
Add a registry key and a compilation option to disable ShrinkArrayAlloca pass.
1 parent 773ccee commit 9dda44d

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,11 @@ void OptimizeIR(CodeGenContext* const pContext)
16611661
mpm.add(llvm::createEarlyCSEPass());
16621662
if (pContext->m_instrTypes.hasNonPrimitiveAlloca)
16631663
{
1664-
mpm.add(new ShrinkArrayAllocaPass());
1664+
if( pContext->getModuleMetaData()->compOpt.DisableShrinkArrayAllocaPass == false &&
1665+
IGC_IS_FLAG_DISABLED(DisableShrinkArrayAllocaPass))
1666+
{
1667+
mpm.add(new ShrinkArrayAllocaPass());
1668+
}
16651669
// run custom safe opts to potentially get rid of indirect
16661670
// addressing of private arrays, see visitLoadInst
16671671
mpm.add(new CustomSafeOptPass());

IGC/common/MDFrameWork.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ namespace IGC
455455
bool ForceLinearWalkOnLinearUAV = false;
456456
bool DisableLscSamplerRouting = false;
457457
bool UseBarrierControlFlowOptimization = false;
458+
bool DisableShrinkArrayAllocaPass = false;
458459
};
459460

460461
enum class ThreadIDLayout

IGC/common/igc_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ DECLARE_IGC_REGKEY(DWORD, EnableMeshSLMCache, 0, "Enables caching
534534
bit3 - mirror mode, if this bit is set bits 0, 1 and 2 are ignored, \
535535
enable caching of outputs that are read in the shader\
536536
data is only mirrored in SLM", true)
537+
DECLARE_IGC_REGKEY(bool, DisableShrinkArrayAllocaPass, false, "Disables ShrinkArrayAllocaPass", true)
537538
DECLARE_IGC_REGKEY(bool, EnableL3FlushForGlobal, false, "Enable/disable flushing L3 cache for globals", false)
538539
DECLARE_IGC_REGKEY(bool, EnableCPSOmaskWA, true, "Enable workaround for oMask with CPS", false)
539540
DECLARE_IGC_REGKEY(bool, EnableCPSMSAAOMaskWA, false, "Enable WA which forces rt writes to happen at pixel rate when cps, msaa, and omask are present.", true)

0 commit comments

Comments
 (0)