Skip to content

Commit 5a82c8e

Browse files
weiyu-chensys_zuul
authored andcommitted
Refactor code for dummy sendc generation for pixel shader.
Change-Id: I98e91fa9ad5077b53cdc6c6b40d374481ebc95b0
1 parent ec21df6 commit 5a82c8e

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

visa/BuildIR.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,8 @@ class IR_Builder {
19171917
G4_INST* createFenceInstruction(
19181918
uint8_t flushParam, bool commitEnable, bool globalMemFence, bool isSendc);
19191919

1920+
G4_INST* createSLMFence();
1921+
19201922
// short hand for creating a dstRegRegion
19211923
G4_DstRegRegion* Create_Dst_Opnd_From_Dcl(G4_Declare* dcl, unsigned short hstride);
19221924
G4_SrcRegRegion* Create_Src_Opnd_From_Dcl(G4_Declare* dcl, const RegionDesc* rd);

visa/FlowGraph.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ void FlowGraph::handleWait()
10021002
G4_INST* nextInst = *nextIter;
10031003
if (nextInst->isSend())
10041004
{
1005-
nextInst->setOpcode(nextInst->isSplitSend() ? G4_sendsc : G4_sendc);
1005+
nextInst->asSendInst()->setSendc();
10061006
sunk = true;
10071007
break;
10081008
}
@@ -1014,8 +1014,8 @@ void FlowGraph::handleWait()
10141014
}
10151015
if (!sunk)
10161016
{
1017-
bool commitEnable = builder->needsFenceCommitEnable();
1018-
G4_INST* fenceInst = builder->createFenceInstruction(0, commitEnable, false, true);
1017+
auto fenceInst = builder->createSLMFence();
1018+
fenceInst->asSendInst()->setSendc();
10191019
bb->insert(iter, fenceInst);
10201020
}
10211021
iter = bb->erase(iter);

visa/Gen4_IR.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,18 @@ class G4_InstSend : public G4_INST
13571357
G4_SendMsgDescriptor* md);
13581358

13591359
bool isSendc() const { return op == G4_sendc || op == G4_sendsc; }
1360+
void setSendc()
1361+
{
1362+
// no effect if op is already G4_sendc/G4_sendsc
1363+
if (op == G4_send)
1364+
{
1365+
op = G4_sendc;
1366+
}
1367+
else if (op == G4_sends)
1368+
{
1369+
op = G4_sendsc;
1370+
}
1371+
}
13601372
bool mayExceedTwoGRF() const override { return true; }
13611373

13621374
G4_Operand* getMsgDescOperand() const

visa/TranslationInterface.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,13 @@ int IR_Builder::translateVISAWaitInst(G4_Operand* mask)
18631863
return VISA_SUCCESS;
18641864
}
18651865

1866+
// create a default SLM fence (no flush)
1867+
G4_INST* IR_Builder::createSLMFence()
1868+
{
1869+
bool commitEnable = needsFenceCommitEnable();
1870+
return createFenceInstruction(0, commitEnable, false, false);
1871+
}
1872+
18661873
void IR_Builder::generateBarrierSend()
18671874
{
18681875

0 commit comments

Comments
 (0)