Skip to content

Commit 29f5d8b

Browse files
committed
[Autobackout][FuncReg]Revert of change: c2f1928
Multirate shading improvements and fixes Fixed bug where r1 would be overwritten in the perpixel phase of a multirate shader Fixed bug where the perpixel phase of a multirate shader was treated as the entry function Fixed bug where the PixelShaderAddMask pass would be run on the perpixel phase of a multirate shader more than once Fixed bug where phi nodes were added to a basic block with only one predecessor Fixed bug where PurgeMetaDataUtils deleted the coarse phase when compiling the perpixel phase. Allowed phase inputs and outputs to use all floating point types Change-Id: I1ac94a98b309d0a69183d6dceed4e93fd194d473
1 parent ee9f4e1 commit 29f5d8b

13 files changed

+46
-297
lines changed

IGC/Compiler/CISACodeGen/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ set(IGC_BUILD__SRC__CISACodeGen_Common
8383
"${CMAKE_CURRENT_SOURCE_DIR}/WIAnalysis.cpp"
8484
"${CMAKE_CURRENT_SOURCE_DIR}/SLMConstProp.cpp"
8585
"${CMAKE_CURRENT_SOURCE_DIR}/POSH_RemoveNonPositionOutput.cpp"
86-
"${CMAKE_CURRENT_SOURCE_DIR}/CrossPhaseConstProp.cpp"
8786
)
8887

8988

@@ -174,7 +173,6 @@ set(IGC_BUILD__HDR__CISACodeGen_Common
174173
"${CMAKE_CURRENT_SOURCE_DIR}/WIAnalysis.hpp"
175174
"${CMAKE_CURRENT_SOURCE_DIR}/SLMConstProp.hpp"
176175
"${CMAKE_CURRENT_SOURCE_DIR}/POSH_RemoveNonPositionOutput.h"
177-
"${CMAKE_CURRENT_SOURCE_DIR}/CrossPhaseConstProp.hpp"
178176
)
179177

180178

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ void CShader::CreateImplicitArgs()
335335

336336
// Push Args are only for entry function
337337
unsigned numPushArgsEntry = m_ModuleMetadata->pushInfo.pushAnalysisWIInfos.size();
338-
unsigned numPushArgs = (isEntryFunc(m_pMdUtils, entry) && !isPixelPhaseFunction(entry) ? numPushArgsEntry : 0);
338+
unsigned numPushArgs = (isEntryFunc(m_pMdUtils, entry) ? numPushArgsEntry : 0);
339339
unsigned numFuncArgs = IGCLLVM::GetFuncArgSize(entry) - numImplicitArgs - numPushArgs;
340340

341341
// Create symbol for every arguments [5/2019]
@@ -2072,7 +2072,7 @@ CVariable* CShader::getOrCreateArgumentSymbol(
20722072
ImplicitArgs implicitArgs(*F, m_pMdUtils);
20732073
unsigned numImplicitArgs = implicitArgs.size();
20742074
unsigned numPushArgsEntry = m_ModuleMetadata->pushInfo.pushAnalysisWIInfos.size();
2075-
unsigned numPushArgs = (isEntryFunc(m_pMdUtils, F) && !isPixelPhaseFunction(F) ? numPushArgsEntry : 0);
2075+
unsigned numPushArgs = (isEntryFunc(m_pMdUtils, F) ? numPushArgsEntry : 0);
20762076
unsigned numFuncArgs = IGCLLVM::GetFuncArgSize(F) - numImplicitArgs - numPushArgs;
20772077

20782078
CVariable* var = nullptr;
@@ -2107,7 +2107,7 @@ CVariable* CShader::getOrCreateArgumentSymbol(
21072107
uint32_t nIAs = (uint32_t)IAs.size();
21082108
uint32_t iArgIx = IAs.getArgIndex(ArgType);
21092109
uint32_t argIx = (uint32_t)IGCLLVM::GetFuncArgSize(K) - nIAs + iArgIx;
2110-
if (isEntryFunc(m_pMdUtils, &K) && !isPixelPhaseFunction(&K)) {
2110+
if (isEntryFunc(m_pMdUtils, &K)) {
21112111
argIx = argIx - numPushArgsEntry;
21122112
}
21132113
Function::arg_iterator arg = K.arg_begin();

IGC/Compiler/CISACodeGen/CrossPhaseConstProp.cpp

Lines changed: 0 additions & 129 deletions
This file was deleted.

IGC/Compiler/CISACodeGen/CrossPhaseConstProp.hpp

Lines changed: 0 additions & 38 deletions
This file was deleted.

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7017,8 +7017,7 @@ void EmitPass::getCoarsePixelSize(CVariable* destination, const uint component)
70177017
assert(component < 2);
70187018

70197019
CPixelShader* const psProgram = static_cast<CPixelShader*>(m_currShader);
7020-
CVariable* r1 = psProgram->GetPhase() == PSPHASE_PIXEL ? psProgram->GetCoarseR1() : psProgram->GetR1();
7021-
CVariable* const coarsePixelSize = m_currShader->BitCast(r1, ISA_TYPE_UB);
7020+
CVariable* const coarsePixelSize = m_currShader->BitCast(psProgram->GetR1(), ISA_TYPE_UB);
70227021
m_encoder->SetSrcRegion(0, 0, 1, 0);
70237022
m_encoder->SetSrcSubReg(0, (component == 0) ? 0 : 1);
70247023
m_encoder->Cast(destination, coarsePixelSize);
@@ -13104,7 +13103,7 @@ void EmitPass::emitPhaseInput(llvm::GenIntrinsicInst* inst)
1310413103
assert(psProgram->GetPhase() == PSPHASE_PIXEL);
1310513104

1310613105
unsigned int inputIndex = (unsigned int)cast<llvm::ConstantInt>(inst->getOperand(0))->getZExtValue();
13107-
CVariable* input = psProgram->GetCoarseInput(inputIndex, m_destination->GetType());
13106+
CVariable* input = psProgram->GetCoarseInput(inputIndex);
1310813107

1310913108
// address variable represents register a0
1311013109
CVariable* pDstArrElm = m_currShader->GetNewAddressVariable(
@@ -13116,8 +13115,7 @@ void EmitPass::emitPhaseInput(llvm::GenIntrinsicInst* inst)
1311613115
// we add offsets to the base that is the beginning of the vector variable
1311713116
CVariable* index = psProgram->GetCoarseParentIndex();
1311813117
CVariable* byteAddress = psProgram->GetNewVariable(numLanes(m_SimdMode), ISA_TYPE_UW, EALIGN_OWORD);
13119-
DWORD shiftAmount = iSTD::Log2(CEncoder::GetCISADataTypeSize(input->GetType()));
13120-
m_encoder->Shl(byteAddress, index, psProgram->ImmToVariable(shiftAmount, ISA_TYPE_UW));
13118+
m_encoder->Shl(byteAddress, index, psProgram->ImmToVariable(2, ISA_TYPE_UW));
1312113119
m_encoder->Push();
1312213120

1312313121
m_encoder->AddrAdd(pDstArrElm, input, byteAddress);

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ namespace IGC
5252
return m_R1;
5353
}
5454

55-
CVariable* CPixelShader::GetCoarseR1()
56-
{
57-
assert(m_phase == PSPHASE_PIXEL);
58-
return m_CoarseR1;
59-
}
60-
6155
void CPixelShader::AllocatePayload()
6256
{
6357
if (m_phase == PSPHASE_COARSE)
@@ -80,8 +74,6 @@ namespace IGC
8074

8175
void CPixelShader::AllocatePixelPhasePayload()
8276
{
83-
unsigned int r1Offset = GetDispatchSignature().r1;
84-
AllocateInput(m_CoarseR1, r1Offset);
8577
for (uint i = 0; i < setup.size(); i++)
8678
{
8779
if (setup[i])
@@ -134,10 +126,6 @@ namespace IGC
134126
offset += getGRFSize();
135127

136128
assert(m_R1);
137-
if (m_Signature)
138-
{
139-
GetDispatchSignature().r1 = offset;
140-
}
141129
for (uint i = 0; i < m_R1->GetNumberInstance(); i++)
142130
{
143131
AllocateInput(m_R1, offset, i);
@@ -663,7 +651,6 @@ namespace IGC
663651
m_NeedPSSync = false;
664652
m_CoarseoMask = nullptr;
665653
m_CoarseMaskInput = nullptr;
666-
m_CoarseR1 = nullptr;
667654

668655
m_CoarseOutput.clear();
669656
m_CoarseInput.clear();
@@ -993,7 +980,6 @@ namespace IGC
993980
if (m_phase == PSPHASE_PIXEL)
994981
{
995982
uint responseLength = 2;
996-
m_CoarseR1 = m_R1;
997983
m_PixelPhasePayload = GetNewVariable(responseLength * (getGRFSize() >> 2), ISA_TYPE_D, EALIGN_GRF);
998984
m_PixelPhaseCounter = GetNewAlias(m_PixelPhasePayload, ISA_TYPE_UW, 0, 1);
999985
m_CoarseParentIndex = GetNewAlias(m_PixelPhasePayload, ISA_TYPE_UW, getGRFSize(), numLanes(m_SIMDSize));
@@ -1029,6 +1015,7 @@ namespace IGC
10291015
encoder.Push();
10301016
}
10311017
encoder.SetPredicate(m_KillPixelMask);
1018+
encoder.SetInversePredicate(true);
10321019
encoder.Copy(m_CoarseoMask, ImmToVariable(0x0, ISA_TYPE_UD));
10331020
encoder.Push();
10341021
}
@@ -1057,13 +1044,13 @@ namespace IGC
10571044
m_CoarseOutput[index] = output;
10581045
}
10591046

1060-
CVariable* CPixelShader::GetCoarseInput(unsigned int index, VISA_Type type)
1047+
CVariable* CPixelShader::GetCoarseInput(unsigned int index)
10611048
{
10621049
auto it = m_CoarseInput.find(index);
10631050
CVariable* coarseInput = nullptr;
10641051
if (it == m_CoarseInput.end())
10651052
{
1066-
coarseInput = GetNewVariable(numLanes(m_SIMDSize), type, EALIGN_GRF);
1053+
coarseInput = GetNewVariable(numLanes(m_SIMDSize), ISA_TYPE_F, EALIGN_GRF);
10671054
m_CoarseInput[index] = coarseInput;
10681055
}
10691056
else
@@ -1375,7 +1362,6 @@ namespace IGC
13751362
// if there is no pixel phase we have nothing to do
13761363
return;
13771364
}
1378-
encoder.MarkAsOutput(m_R1);
13791365
Function* pixelPhase = mdconst::dyn_extract<Function>(pixelNode->getOperand(0)->getOperand(0));
13801366
for (auto BB = pixelPhase->begin(), BE = pixelPhase->end(); BB != BE; ++BB)
13811367
{

IGC/Compiler/CISACodeGen/PixelShaderCodeGen.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ namespace IGC
3939
unsigned int pixelOffset;
4040
unsigned int ZWDelta;
4141
unsigned int oMaskOffset;
42-
unsigned int r1;
4342
bool CoarseMask;
4443
DispatchSignature() : CoarseMask(false) {}
4544
};
4645
DispatchSignature dispatchSign[3];
47-
std::map<unsigned int, uint64_t> PSConstantOutput;
4846
};
4947

5048

@@ -54,7 +52,6 @@ namespace IGC
5452
CPixelShader(llvm::Function* pFunc, CShaderProgram* pProgram);
5553
~CPixelShader();
5654
CVariable* GetR1();
57-
CVariable* GetCoarseR1();
5855
CVariable* GetBaryReg(e_interpolation mode);
5956
CVariable* GetBaryRegLowered(e_interpolation mode);
6057
CVariable* GetInputDelta(uint index, bool loweredInput = false);
@@ -94,7 +91,7 @@ namespace IGC
9491
void PullPixelPhasePayload();
9592

9693
void AddCoarseOutput(CVariable* var, unsigned int index);
97-
CVariable* GetCoarseInput(unsigned int index, VISA_Type type);
94+
CVariable* GetCoarseInput(unsigned int index);
9895
void SetCoarseoMask(CVariable* var);
9996
CVariable* GetCoarseMask();
10097
void OutputDepth() { m_HasoDepth = true; };
@@ -131,7 +128,6 @@ namespace IGC
131128

132129
PSSignature::DispatchSignature& GetDispatchSignature();
133130
CVariable* m_R1;
134-
CVariable* m_CoarseR1;
135131
CVariable* m_PerspectivePixel;
136132
CVariable* m_PerspectiveCentroid;
137133
CVariable* m_PerspectiveSample;

0 commit comments

Comments
 (0)