Skip to content

Commit 773b349

Browse files
committed
[Autobackout][FuncReg]Revert of change: 8cf7866
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: I528b3e19515cf7ae96770c0f7a8bf55150be4d18
1 parent c207898 commit 773b349

File tree

13 files changed

+46
-311
lines changed

13 files changed

+46
-311
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
@@ -353,7 +353,7 @@ void CShader::CreateImplicitArgs()
353353

354354
// Push Args are only for entry function
355355
unsigned numPushArgsEntry = m_ModuleMetadata->pushInfo.pushAnalysisWIInfos.size();
356-
unsigned numPushArgs = (isEntryFunc(m_pMdUtils, entry) && !isNonEntryMultirateShader(m_pMdUtils, entry) ? numPushArgsEntry : 0);
356+
unsigned numPushArgs = (isEntryFunc(m_pMdUtils, entry) ? numPushArgsEntry : 0);
357357
unsigned numFuncArgs = IGCLLVM::GetFuncArgSize(entry) - numImplicitArgs - numPushArgs;
358358

359359
// Create symbol for every arguments [5/2019]
@@ -2090,7 +2090,7 @@ CVariable* CShader::getOrCreateArgumentSymbol(
20902090
ImplicitArgs implicitArgs(*F, m_pMdUtils);
20912091
unsigned numImplicitArgs = implicitArgs.size();
20922092
unsigned numPushArgsEntry = m_ModuleMetadata->pushInfo.pushAnalysisWIInfos.size();
2093-
unsigned numPushArgs = (isEntryFunc(m_pMdUtils, F) && !isNonEntryMultirateShader(m_pMdUtils, F) ? numPushArgsEntry : 0);
2093+
unsigned numPushArgs = (isEntryFunc(m_pMdUtils, F) ? numPushArgsEntry : 0);
20942094
unsigned numFuncArgs = IGCLLVM::GetFuncArgSize(F) - numImplicitArgs - numPushArgs;
20952095

20962096
CVariable* var = nullptr;
@@ -2125,7 +2125,7 @@ CVariable* CShader::getOrCreateArgumentSymbol(
21252125
uint32_t nIAs = (uint32_t)IAs.size();
21262126
uint32_t iArgIx = IAs.getArgIndex(ArgType);
21272127
uint32_t argIx = (uint32_t)IGCLLVM::GetFuncArgSize(K) - nIAs + iArgIx;
2128-
if (isEntryFunc(m_pMdUtils, &K) && !isNonEntryMultirateShader(m_pMdUtils , &K)) {
2128+
if (isEntryFunc(m_pMdUtils, &K)) {
21292129
argIx = argIx - numPushArgsEntry;
21302130
}
21312131
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);
@@ -13154,7 +13153,7 @@ void EmitPass::emitPhaseInput(llvm::GenIntrinsicInst* inst)
1315413153
assert(psProgram->GetPhase() == PSPHASE_PIXEL);
1315513154

1315613155
unsigned int inputIndex = (unsigned int)cast<llvm::ConstantInt>(inst->getOperand(0))->getZExtValue();
13157-
CVariable* input = psProgram->GetCoarseInput(inputIndex, m_destination->GetType());
13156+
CVariable* input = psProgram->GetCoarseInput(inputIndex);
1315813157

1315913158
// address variable represents register a0
1316013159
CVariable* pDstArrElm = m_currShader->GetNewAddressVariable(
@@ -13166,8 +13165,7 @@ void EmitPass::emitPhaseInput(llvm::GenIntrinsicInst* inst)
1316613165
// we add offsets to the base that is the beginning of the vector variable
1316713166
CVariable* index = psProgram->GetCoarseParentIndex();
1316813167
CVariable* byteAddress = psProgram->GetNewVariable(numLanes(m_SimdMode), ISA_TYPE_UW, EALIGN_OWORD);
13169-
DWORD shiftAmount = iSTD::Log2(CEncoder::GetCISADataTypeSize(input->GetType()));
13170-
m_encoder->Shl(byteAddress, index, psProgram->ImmToVariable(shiftAmount, ISA_TYPE_UW));
13168+
m_encoder->Shl(byteAddress, index, psProgram->ImmToVariable(2, ISA_TYPE_UW));
1317113169
m_encoder->Push();
1317213170

1317313171
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)