Skip to content

Commit

Permalink
XE2 compiles to SIMD16 in case of spilling
Browse files Browse the repository at this point in the history
XE2 compilation goes to SIMD16 route if we have spills during SIMD32
compilation. Test added & previous one that covered for kernels that
exhaust PTSS changed.
  • Loading branch information
esukhov authored and igcbot committed Nov 15, 2024
1 parent a7165ef commit 62b917c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
21 changes: 18 additions & 3 deletions IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3446,7 +3446,8 @@ namespace IGC

if (ctx->platform.getMinDispatchMode() == SIMDMode::SIMD16)
{
AddCodeGenPasses(*ctx, shaders, Passes, SIMDMode::SIMD32, false);
bool abortOnSpills = ctx->platform.isCoreXE2() && (ctx->getModuleMetaData()->csInfo.forcedSIMDSize != 32);
AddCodeGenPasses(*ctx, shaders, Passes, SIMDMode::SIMD32, abortOnSpills);
AddCodeGenPasses(*ctx, shaders, Passes, SIMDMode::SIMD16, false);

ctx->SetSIMDInfo(SIMD_SKIP_HW, SIMDMode::SIMD8, ShaderDispatchMode::NOT_APPLICABLE);
Expand Down Expand Up @@ -3751,9 +3752,23 @@ namespace IGC
return SIMDStatus::SIMD_FUNC_FAIL;
}

EP.m_canAbortOnSpill = false; // spill is always allowed since we don't do SIMD size lowering
// Next we check if there is a required sub group size specified
CodeGenContext* pCtx = GetContext();

CShader* simd16Program = m_parent->GetShader(SIMDMode::SIMD16);
CShader* simd32Program = m_parent->GetShader(SIMDMode::SIMD32);

bool compileFunctionVariants = pCtx->m_enableSimdVariantCompilation &&
(m_FGA && IGC::isIntelSymbolTableVoidProgram(m_FGA->getGroupHead(&F)));

if((simd16Program && simd16Program->ProgramOutput()->m_programSize > 0) ||
(simd32Program && simd32Program->ProgramOutput()->m_programSize > 0))
{
bool canCompileMultipleSIMD = compileFunctionVariants;
if (!(canCompileMultipleSIMD && (pCtx->getModuleMetaData()->csInfo.forcedSIMDSize == 0)))
return SIMDStatus::SIMD_FUNC_FAIL;
}

MetaDataUtils* pMdUtils = EP.getAnalysis<MetaDataUtilsWrapper>().getMetaDataUtils();
FunctionInfoMetaDataHandle funcInfoMD = pMdUtils->getFunctionsInfoItem(&F);
uint32_t simd_size = getReqdSubGroupSize(F, pMdUtils);
Expand Down Expand Up @@ -3856,7 +3871,7 @@ namespace IGC
return SIMDStatus::SIMD_PASS;
}

if (simdMode == SIMDMode::SIMD16 && !hasSubGroupForce && !forceLowestSIMDForStackCalls && !hasSubroutine)
if (simdMode == SIMDMode::SIMD16 && !pCtx->platform.isCoreXE2() && !hasSubGroupForce && !forceLowestSIMDForStackCalls && !hasSubroutine)
{
pCtx->SetSIMDInfo(SIMD_SKIP_PERF, simdMode, ShaderDispatchMode::NOT_APPLICABLE);
return SIMDStatus::SIMD_FUNC_FAIL;
Expand Down
4 changes: 4 additions & 0 deletions IGC/Compiler/CISACodeGen/Platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ bool isProductChildOf(PRODUCT_FAMILY product) const
return m_platformInfo.eProductFamily >= product;
}

bool isCoreXE2() const {
return ( m_platformInfo.eRenderCoreFamily == IGFX_XE2_HPG_CORE );
}

// This function checks if core is child of another core
bool isCoreChildOf(GFXCORE_FAMILY core) const
{
Expand Down

0 comments on commit 62b917c

Please sign in to comment.