Skip to content

Commit 58f28ac

Browse files
dlei6gArtem Gindinson
authored andcommitted
Reset sub_group_size when using CallWA
Stackcalls now supports SIMD32 by default, but if the EUFusion Call WA is required, we still need to default stackcall compilation to SIMD16. However, when the Call WA is enabled and sub_group_size(32) is set, we need to also reset to sub_group_size(16) so that SIMD16 compilation will succeed.
1 parent 22d0333 commit 58f28ac

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3817,15 +3817,6 @@ namespace IGC
38173817
}
38183818
}
38193819

3820-
{
3821-
// If stack calls are present, disable simd32 in order to do wa in visa
3822-
bool needCallWA = (IGC_IS_FLAG_ENABLED(EnableCallWA) && m_Context->platform.hasFusedEU());
3823-
if (needCallWA && simdMode == SIMDMode::SIMD32 && HasStackCalls())
3824-
{
3825-
return false;
3826-
}
3827-
}
3828-
38293820
if (!m_Context->m_retryManager.IsFirstTry())
38303821
{
38313822
m_Context->ClearSIMDInfo(simdMode, ShaderDispatchMode::NOT_APPLICABLE);
@@ -4093,6 +4084,24 @@ namespace IGC
40934084
bool isIndirectGroup = m_FGA && m_FGA->getGroup(&F) && IGC::isIntelSymbolTableVoidProgram(m_FGA->getGroupHead(&F));
40944085
bool hasSubroutine = m_FGA && m_FGA->getGroup(&F) && !m_FGA->getGroup(&F)->isSingle() && !hasStackCall && !isIndirectGroup;
40954086

4087+
// If stack calls are present, disable simd32 in order to do CallWA in visa
4088+
if (IGC_IS_FLAG_ENABLED(EnableCallWA) &&
4089+
pCtx->platform.hasFusedEU() &&
4090+
pCtx->platform.getWATable().Wa_14016243945 == false &&
4091+
simdMode == SIMDMode::SIMD32 &&
4092+
(hasStackCall || isIndirectGroup))
4093+
{
4094+
// If sub_group_size is set to 32, resize it to 16 so SIMD16 compilation will still succeed
4095+
if (simd_size == 32)
4096+
{
4097+
llvm::Function* Kernel = m_FGA->getGroup(&F)->getHead();
4098+
funcInfoMD = pMdUtils->getFunctionsInfoItem(Kernel);
4099+
funcInfoMD->getSubGroupSize()->setSIMD_size(16);
4100+
}
4101+
pCtx->SetSIMDInfo(SIMD_SKIP_HW, simdMode, ShaderDispatchMode::NOT_APPLICABLE);
4102+
return SIMDStatus::SIMD_FUNC_FAIL;
4103+
}
4104+
40964105
if (simd_size == 0)
40974106
{
40984107
// Default to lowest SIMD mode for stack calls/indirect calls

0 commit comments

Comments
 (0)