mirror of
https://github.com/intel/intel-graphics-compiler.git
synced 2025-10-30 08:18:26 +08:00
Add attr disallowing kernel to spill
Add handling of attribute disallowing kernel to spill
when -fail-on-spill option is present:
__attribute__((annotate("igc-do-not-spill")))
This commit is contained in:
@ -617,22 +617,32 @@ namespace IGC
|
||||
{
|
||||
return;
|
||||
}
|
||||
// If there is fail-on-spill option provided
|
||||
// and __attribute__((annotate("igc-do-not-spill"))) is present for a kernel,
|
||||
// we fail compilation
|
||||
auto& programList = m_programOutput.m_ShaderProgramList;
|
||||
for (auto& kernel : programList)
|
||||
{
|
||||
for (auto mode : { SIMDMode::SIMD8, SIMDMode::SIMD16, SIMDMode::SIMD32 })
|
||||
{
|
||||
COpenCLKernel* shader = static_cast<COpenCLKernel*>(kernel->GetShader(mode));
|
||||
if (shader)
|
||||
|
||||
if (!COpenCLKernel::IsValidShader(shader))
|
||||
{
|
||||
auto output = shader->ProgramOutput();
|
||||
if (output->m_scratchSpaceUsedBySpills > 0)
|
||||
{
|
||||
std::string msg =
|
||||
"Spills detected in kernel: "
|
||||
+ shader->m_kernelInfo.m_kernelName;
|
||||
EmitError(msg.c_str(), nullptr);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
auto& funcMD = modMD->FuncMD[shader->entry];
|
||||
auto& annotatnions = funcMD.UserAnnotations;
|
||||
auto output = shader->ProgramOutput();
|
||||
|
||||
if (output->m_scratchSpaceUsedBySpills > 0 &&
|
||||
std::find(annotatnions.begin(), annotatnions.end(), "igc-do-not-spill") != annotatnions.end())
|
||||
{
|
||||
std::string msg =
|
||||
"Spills detected in kernel: "
|
||||
+ shader->m_kernelInfo.m_kernelName;
|
||||
EmitError(msg.c_str(), nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user