Skip to content

Commit f330cc5

Browse files
skarczewigcbot
authored andcommitted
Setting correct pushed inputs limit and use right max num GRFs
Basing on HW and vISA limitations
1 parent ae235f0 commit f330cc5

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5967,8 +5967,11 @@ namespace IGC
59675967
void CEncoder::DeclareInput(CVariable* var, uint offset, uint instance)
59685968
{
59695969
// Avoid declaring more inputs/outputs than available registers
5970-
if (offset + var->GetSize() >= vKernel->getNumRegTotal() * getGRFSize())
5970+
if (offset + var->GetSize() >= m_program->m_Platform->getMaxNumGRF(m_program->GetShaderType()) * getGRFSize())
5971+
{
5972+
IGC_ASSERT(0);
59715973
return;
5974+
}
59725975
V(vKernel->CreateVISAInputVar(
59735976
var->visaGenVariable[instance],
59745977
int_cast<unsigned short>(offset),
@@ -5978,8 +5981,11 @@ namespace IGC
59785981
void CEncoder::DeclarePred(CVariable * var, uint offset)
59795982
{
59805983
// Avoid declaring more inputs/outputs than available registers
5981-
if (offset + var->GetSize() >= vKernel->getNumRegTotal() * getGRFSize())
5984+
if (offset + var->GetSize() >= m_program->m_Platform->getMaxNumGRF(m_program->GetShaderType()) * getGRFSize())
5985+
{
5986+
IGC_ASSERT(0);
59825987
return;
5988+
}
59835989
V(vKernel->CreateVISAPredVar(
59845990
var->visaPredVariable,
59855991
"",

IGC/Compiler/CISACodeGen/Platform.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,18 @@ uint32_t getGRFSize() const
12131213
return isCoreChildOf(IGFX_XE_HPC_CORE) ? 64 : 32;
12141214
}
12151215

1216+
uint32_t getMaxNumGRF(ShaderType type) const
1217+
{
1218+
if (supportsVRT())
1219+
{
1220+
return 256;
1221+
}
1222+
else
1223+
{
1224+
return 128;
1225+
}
1226+
}
1227+
12161228
uint32_t getInlineDataSize() const
12171229
{
12181230
if (!supportInlineData()) return 0;

IGC/Compiler/CISACodeGen/PushAnalysis.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,9 +1610,10 @@ namespace IGC
16101610

16111611
if (m_context->platform.isCoreChildOf(IGFX_XE3_CORE))
16121612
{
1613+
// VRT allows us to have 256GRFs, so we can double the number of pushed inputs
16131614
MaxNumOfPushedInputs = 24 * 2;
1614-
m_pMaxNumOfVSPushedInputs = 24 * 2;
1615-
m_pMaxNumOfDSPushedInputs = 24 * 2;
1615+
m_pMaxNumOfVSPushedInputs = 30;
1616+
m_pMaxNumOfDSPushedInputs = 24 * 2; // 48 * vec4 == 192 GRF == 3/4 256 GRF
16161617
}
16171618
else
16181619
{

0 commit comments

Comments
 (0)