From ac886fd3e329a9599ed1ac7a6d8b26ca5821046c Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 4 Oct 2023 11:20:35 -0700 Subject: SPIRV compiler performance fixes. (#3258) * SPIRV compiler performance fixes. * Cleanup. * update project files * Cleanup debug code. * Make redundancy removal non-recursive. --------- Co-authored-by: Yong He --- source/slang/slang-ir-inline.cpp | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'source/slang/slang-ir-inline.cpp') diff --git a/source/slang/slang-ir-inline.cpp b/source/slang/slang-ir-inline.cpp index 8412a1912..3b01d7dde 100644 --- a/source/slang/slang-ir-inline.cpp +++ b/source/slang/slang-ir-inline.cpp @@ -252,9 +252,6 @@ struct InliningPassBase { case kIROp_IntrinsicOpDecoration: return true; - case kIROp_RequireSPIRVCapabilityDecoration: - // Don't inline a function with spirv capability decoration to avoid losing it. - return false; } } @@ -947,7 +944,7 @@ void performGLSLResourceReturnFunctionInlining(IRModule* module) while (changed) { changed = pass.considerAllCallSites(); - simplifyIR(module); + simplifyIR(module, IRSimplificationOptions::getFast()); } } @@ -964,8 +961,6 @@ struct IntrinsicFunctionInliningPass : InliningPassBase auto func = as(getResolvedInstForDecorations(info.callee)); if (!func) return false; - if (func->findDecorationImpl(kIROp_RequireSPIRVCapabilityDecoration)) - return false; auto returnInst = as(func->getFirstBlock()->getTerminator()); if (!returnInst) return false; @@ -1025,4 +1020,32 @@ bool inlineCall(IRCall* call) } +struct SpirvInliningPass : InliningPassBase +{ + typedef InliningPassBase Super; + + SpirvInliningPass(IRModule* module) + : Super(module) + {} + + bool shouldInline(CallSiteInfo const& info) + { + if (!info.callee->findDecoration()) + return true; + return false; + } +}; + +void performSpirvInlining(IRModule* module) +{ + SLANG_PROFILE; + while (true) + { + SpirvInliningPass pass(module); + if (pass.considerAllCallSites()) + continue; + break; + } +} + } // namespace Slang -- cgit v1.2.3