Skip to content

Commit d96abfc

Browse files
weiyu-chensys_zuul
authored andcommitted
Avoid hard-coding R0 and R1 size in payload.
Change-Id: I179d747a59cd96c7d48f0b1b7b0275a5a42229c9
1 parent cea7ad8 commit d96abfc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

IGC/Compiler/CISACodeGen/PayloadMapping.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ int PayloadMapping::GetLeftReservedOffset_RTWrite(const Instruction* inst, SIMDM
161161

162162
if (rtwi->hasMask())
163163
{
164-
//Output mask is always fixed size (32 bytes, UW)
165-
offset += 32; //256bits=1grf
164+
//Output mask is always fixed size regardless of SIMD mode.
165+
offset += m_CodeGenContext->platform.getGRFSize();
166166
}
167167

168168
if (RTWriteHasSource0Alpha(rtwi, m_CodeGenContext->getModuleMetaData()))

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ namespace IGC
131131
uint offset = 0;
132132
//R0 is always allocated as a predefined variable. Increase offset for R0
133133
IGC_ASSERT(m_R0);
134-
offset += 32; //R0 is always 32 byte regardless of register size
134+
offset += getGRFSize();
135135

136136
IGC_ASSERT(m_R1);
137137
if (m_Signature)
@@ -141,7 +141,7 @@ namespace IGC
141141
for (uint i = 0; i < m_R1->GetNumberInstance(); i++)
142142
{
143143
AllocateInput(m_R1, offset, i);
144-
offset += (i == 0 && m_R1->GetNumberInstance() > 1) ? getGRFSize() : 32;
144+
offset += getGRFSize();
145145
}
146146

147147
for (uint i = 0; i < m_numberInstance; i++)
@@ -814,7 +814,7 @@ namespace IGC
814814
void CPixelShader::PreCompile()
815815
{
816816
CreateImplicitArgs();
817-
m_R1 = GetNewVariable(8, ISA_TYPE_D, EALIGN_HWORD, false, m_numberInstance);
817+
m_R1 = GetNewVariable(getGRFSize() / SIZE_DWORD, ISA_TYPE_D, EALIGN_HWORD, false, m_numberInstance);
818818
CodeGenContext* ctx = GetContext();
819819

820820
// make sure the return block is properly set
@@ -998,7 +998,7 @@ namespace IGC
998998
m_PixelPhasePayload = GetNewVariable(responseLength * (getGRFSize() >> 2), ISA_TYPE_D, EALIGN_GRF);
999999
m_PixelPhaseCounter = GetNewAlias(m_PixelPhasePayload, ISA_TYPE_UW, 0, 1);
10001000
m_CoarseParentIndex = GetNewAlias(m_PixelPhasePayload, ISA_TYPE_UW, getGRFSize(), numLanes(m_SIMDSize));
1001-
m_R1 = GetNewAlias(m_PixelPhasePayload, ISA_TYPE_D, 0, 8);
1001+
m_R1 = GetNewAlias(m_PixelPhasePayload, ISA_TYPE_D, 0, getGRFSize() / SIZE_DWORD);
10021002
encoder.SetNoMask();
10031003
encoder.SetSimdSize(SIMDMode::SIMD1);
10041004
encoder.Copy(m_PixelPhaseCounter, ImmToVariable(0, ISA_TYPE_UW));

0 commit comments

Comments
 (0)