Skip to content

Commit ea46b3b

Browse files
houjenkoigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: 75a2018
Cleanup unnecessary R1Lo Remove workaround from the code patching
1 parent 89c3931 commit ea46b3b

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7852,12 +7852,18 @@ void EmitPass::getCoarsePixelSize(CVariable* destination, const uint component,
78527852

78537853
CPixelShader* const psProgram = static_cast<CPixelShader*>(m_currShader);
78547854
CVariable* r;
7855+
bool isR1Lo = false;
78557856
// Coarse pixel sizes are in R1 for both simd32 halves.
78567857
{
78577858
r = psProgram->GetPhase() == PSPHASE_PIXEL ? psProgram->GetCoarseR1() : psProgram->GetR1();
7859+
isR1Lo = true;
78587860
}
78597861
r = m_currShader->GetVarHalf(r, 0);
78607862
CVariable* const coarsePixelSize = m_currShader->BitCast(r, ISA_TYPE_UB);
7863+
if (isR1Lo && isCodePatchCandidate)
7864+
{
7865+
psProgram->AppendR1Lo(coarsePixelSize);
7866+
}
78617867
m_encoder->SetSrcRegion(0, 0, 1, 0);
78627868
uint subReg;
78637869
{
@@ -7908,6 +7914,10 @@ void EmitPass::emitPSSGV(GenIntrinsicInst* inst)
79087914
CVariable* floatR1 = nullptr;
79097915
{
79107916
floatR1 = psProgram->BitCast(psProgram->GetR1(), ISA_TYPE_F);
7917+
if (m_encoder->IsCodePatchCandidate())
7918+
{
7919+
psProgram->AppendR1Lo(floatR1);
7920+
}
79117921
}
79127922

79137923
// Returns (x - xstart) or (y - ystart) in float.
@@ -8117,6 +8127,10 @@ void EmitPass::emitPSSGV(GenIntrinsicInst* inst)
81178127
m_encoder->SetSimdSize(simdSize);
81188128
m_encoder->SetMask(i == 0 ? EMASK_Q1 : EMASK_Q2);
81198129
m_encoder->SetDstSubVar(i);
8130+
if (m_encoder->IsCodePatchCandidate())
8131+
{
8132+
psProgram->AppendR1Lo(src);
8133+
}
81208134
m_encoder->Cast(dst, src);
81218135
m_encoder->Push();
81228136
}
@@ -8287,10 +8301,16 @@ void EmitPass::getPixelPosition(CVariable* destination, const uint component, bo
82878301
{
82888302
// Coarse pixel sizes are in R1 for both simd32 halves.
82898303
CVariable* r;
8304+
bool isR1Lo = false;
82908305
{
82918306
r = m_currShader->GetVarHalf(psProgram->GetR1(), 0);
8307+
isR1Lo = true;
82928308
}
82938309
CVariable* CPSize = m_currShader->BitCast(r, ISA_TYPE_UB);
8310+
if (isR1Lo && isCodePatchCandidate)
8311+
{
8312+
psProgram->AppendR1Lo(CPSize);
8313+
}
82948314
pixelSize =
82958315
m_currShader->GetNewVariable(
82968316
numLanes(m_currShader->m_SIMDSize), ISA_TYPE_UW, EALIGN_GRF, CName::NONE);
@@ -8325,6 +8345,7 @@ void EmitPass::getPixelPosition(CVariable* destination, const uint component, bo
83258345
if (isCodePatchCandidate)
83268346
{
83278347
m_encoder->SetPayloadSectionAsPrimary();
8348+
psProgram->AppendR1Lo(position);
83288349
m_currShader->AddPatchTempSetup(destination);
83298350
}
83308351
m_encoder->Add(destination, position, pixelSize);

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ CVariable* CPixelShader::GetR1()
3333
return m_R1;
3434
}
3535

36+
std::vector<CVariable*>& CPixelShader::GetR1Lo()
37+
{
38+
return m_R1Lo;
39+
}
40+
41+
void CPixelShader::AppendR1Lo(CVariable* var)
42+
{
43+
m_R1Lo.push_back(var);
44+
}
45+
3646
CVariable* CPixelShader::GetCoarseR1()
3747
{
3848
IGC_ASSERT(m_phase == PSPHASE_PIXEL);
@@ -135,6 +145,10 @@ void CPixelShader::AllocatePSPayload()
135145
for (uint i = 0; i < GetR1()->GetNumberInstance(); i++)
136146
{
137147
AllocateInput(GetR1(), offset, i, forceLiveOut);
148+
for (auto R1Lo: GetR1Lo()) {
149+
AllocateInput(R1Lo, offset, i, forceLiveOut);
150+
}
151+
138152
offset += getGRFSize();
139153
}
140154
}

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class CPixelShader : public CShader
3636
CPixelShader(llvm::Function* pFunc, CShaderProgram* pProgram);
3737
~CPixelShader();
3838
CVariable* GetR1();
39+
std::vector<CVariable*>& GetR1Lo();
40+
void AppendR1Lo(CVariable* var);
3941
CVariable* GetCoarseR1();
4042
CVariable* GetBaryReg(e_interpolation mode);
4143
CVariable* GetBaryRegLoweredHalf(e_interpolation mode);
@@ -128,6 +130,7 @@ class CPixelShader : public CShader
128130
USC::GFX3DSTATE_SF_ATTRIBUTE_ACTIVE_COMPONENT GetActiveComponents(uint attribute) const;
129131

130132
CVariable* m_R1;
133+
std::vector<CVariable*> m_R1Lo;
131134
CVariable* m_PerspectiveBaryPlanes;
132135
CVariable* m_NonPerspectiveBaryPlanes;
133136
CVariable* m_CoarseR1;

0 commit comments

Comments
 (0)