From 35c81de2c1a1bc6df3965e75e4df7e3279f504a7 Mon Sep 17 00:00:00 2001 From: David Woo Date: Mon, 18 Sep 2023 23:27:17 +0000 Subject: [PATCH] CS SIMD mode flag priority Flags like ForceCSSIMD32 should have priority over all other methods of forcing simd modes in compute shaders. --- IGC/AdaptorCommon/DivergentBarrierPass.cpp | 16 ++++++++++------ .../RayTracing/TraceRayInlineLoweringPass.cpp | 14 ++++++++++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/IGC/AdaptorCommon/DivergentBarrierPass.cpp b/IGC/AdaptorCommon/DivergentBarrierPass.cpp index 21d99c4198cd..f4f6c6702cc2 100644 --- a/IGC/AdaptorCommon/DivergentBarrierPass.cpp +++ b/IGC/AdaptorCommon/DivergentBarrierPass.cpp @@ -493,18 +493,22 @@ bool DivergentBarrierPass::processShader(Function* F) // so no need to add the divergent barrier WA. bool skipTGbarriers = false; unsigned forcedSimdSize = 0; - if (IGC_IS_FLAG_ENABLED(ForceCSSIMD32) || - m_CGCtx->getModuleMetaData()->csInfo.waveSize == 32 || - m_CGCtx->getModuleMetaData()->csInfo.forcedSIMDSize == 32) + if (IGC_IS_FLAG_ENABLED(ForceCSSIMD32)) { forcedSimdSize = 32; } - else if (IGC_IS_FLAG_ENABLED(ForceCSSIMD16) || - m_CGCtx->getModuleMetaData()->csInfo.waveSize == 16 || - m_CGCtx->getModuleMetaData()->csInfo.forcedSIMDSize == 16) + else if (IGC_IS_FLAG_ENABLED(ForceCSSIMD16)) { forcedSimdSize = 16; } + else if (m_CGCtx->getModuleMetaData()->csInfo.forcedSIMDSize >= 16) + { + forcedSimdSize = m_CGCtx->getModuleMetaData()->csInfo.forcedSIMDSize; + } + else if (m_CGCtx->getModuleMetaData()->csInfo.waveSize >= 16) + { + forcedSimdSize = m_CGCtx->getModuleMetaData()->csInfo.waveSize; + } ConstantInt* groupSize = dyn_cast(getGroupSize(*F)); if (groupSize && forcedSimdSize >= groupSize->getValue().getZExtValue()) diff --git a/IGC/AdaptorCommon/RayTracing/TraceRayInlineLoweringPass.cpp b/IGC/AdaptorCommon/RayTracing/TraceRayInlineLoweringPass.cpp index d7f050645720..f94c299fa000 100644 --- a/IGC/AdaptorCommon/RayTracing/TraceRayInlineLoweringPass.cpp +++ b/IGC/AdaptorCommon/RayTracing/TraceRayInlineLoweringPass.cpp @@ -967,10 +967,16 @@ bool RTGlobalsPointerLoweringPass::needsSplitting(const CodeGenContext* Ctx) auto& csInfo = Ctx->getModuleMetaData()->csInfo; - if (IGC_IS_FLAG_ENABLED(ForceCSSIMD32) || - IGC_GET_FLAG_VALUE(ForceCSSimdSize4RQ) == 32 || - csInfo.waveSize == 32 || - csInfo.forcedSIMDSize == 32) + if (IGC_IS_FLAG_ENABLED(ForceCSSIMD32) || + IGC_GET_FLAG_VALUE(ForceCSSimdSize4RQ) == 32) + return true; + if (IGC_IS_FLAG_ENABLED(ForceCSSIMD16)) + return false; + if (csInfo.forcedSIMDSize == 32) + return true; + if (csInfo.forcedSIMDSize == 16) + return false; + if (csInfo.waveSize == 32) return true; return false;