Skip to content

Commit 51fd622

Browse files
trbauerigcbot
authored andcommitted
G4_SendDesc encapsulation
More work move encoding details of send descriptors for various platforms behind an abstrct G4_SendDesc with subclasses to handle various platform groups.
1 parent dfafbf2 commit 51fd622

File tree

9 files changed

+278
-162
lines changed

9 files changed

+278
-162
lines changed

visa/FlowGraph.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ void FlowGraph::handleExit(G4_BB* firstSubroutineBB)
11521152
}
11531153
else
11541154
{
1155-
//generate EOT send
1155+
// generate EOT send
11561156
G4_INST* lastInst = bb->back();
11571157
bb->pop_back();
11581158
bool needsEOTSend = true;
@@ -1165,15 +1165,16 @@ void FlowGraph::handleExit(G4_BB* firstSubroutineBB)
11651165
!(secondToLastInst->getMsgDesc()->getSrc1LenRegs() > 2 &&
11661166
VISA_WA_CHECK(builder->getPWaTable(), WaSendsSrc1SizeLimitWhenEOT)))
11671167
{
1168-
G4_SendDescRaw *rawDesc = secondToLastInst->getMsgDescRaw();
1169-
MUST_BE_TRUE(rawDesc, "expected raw descriptor");
1170-
rawDesc->setEOT();
1171-
if (secondToLastInst->isSplitSend())
1168+
G4_SendDesc *desc = secondToLastInst->getMsgDesc();
1169+
desc->setEOT();
1170+
if (secondToLastInst->isSplitSend() && secondToLastInst->getMsgDescRaw())
11721171
{
1173-
if (secondToLastInst->getSrc(3)->isImm())
1172+
bool mustUpdateExDescOperand = true;
1173+
if (mustUpdateExDescOperand && secondToLastInst->getSrc(3)->isImm())
11741174
{
11751175
secondToLastInst->setSrc(
1176-
builder->createImm(rawDesc->getExtendedDesc(), Type_UD), 3);
1176+
builder->createImm(
1177+
secondToLastInst->getMsgDescRaw()->getExtendedDesc(), Type_UD), 3);
11771178
}
11781179
}
11791180
needsEOTSend = false;

visa/G4_IR.cpp

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4001,14 +4001,10 @@ void G4_InstSend::emit_send(std::ostream& output, bool symbol_dst, bool *symbol_
40014001
srcs[3]->emit(output, false);
40024002
output << ' ';
40034003
}
4004-
else
4004+
else if (!isSplitSend() && srcs[2])
40054005
{
4006-
if (getMsgDescRaw()) {
4007-
std::ios::fmtflags outFlags(output.flags());
4008-
output << fmtHex(getMsgDescRaw()->getExtendedDesc());
4009-
output << ' ';
4010-
output.flags(outFlags);
4011-
}
4006+
srcs[2]->emit(output, false); // for old unary send
4007+
output << ' ';
40124008
}
40134009

40144010
// emit msgDesc (2 for sends and 1 for send). Last operand shown in asm.
@@ -4039,14 +4035,27 @@ void G4_InstSend::emit_send_desc(std::ostream& output)
40394035
if (!desc.empty()) {
40404036
output << msgDesc->getDescription();
40414037
}
4042-
if (const auto *rawDesc = sendInst->getMsgDescRaw()) {
4038+
4039+
if (auto immOff = sendInst->getMsgDesc()->getOffset()) {
4040+
int signedOff = immOff->immOff;
4041+
if (immOff->is2d) {
4042+
output << "; ImmOff=(" <<
4043+
fmtHex(immOff->immOffX) << " elems," <<
4044+
fmtHex(immOff->immOffY) << " elems)";
4045+
} else {
4046+
if (signedOff > 0) {
4047+
output << "; ImmOff=+" << fmtHex(signedOff);
4048+
} else if (signedOff < 0) {
4049+
output << "; ImmOff=-" << fmtHex(-signedOff);
4050+
}
4051+
}
40434052
}
40444053

4045-
output << ", resLen=" << msgDesc->getDstLenRegs();
4046-
output << ", msgLen=" << msgDesc->getSrc0LenRegs();
4054+
output << ", dstLen=" << msgDesc->getDstLenRegs();
4055+
output << ", src0Len=" << msgDesc->getSrc0LenRegs();
40474056
if (isSplitSend())
40484057
{
4049-
output << ", extMsgLen=" << msgDesc->getSrc1LenRegs();
4058+
output << ", src1Len=" << msgDesc->getSrc1LenRegs();
40504059
}
40514060

40524061
if (msgDesc->isBarrier())
@@ -8524,8 +8533,9 @@ G4_INST* G4_InstSend::cloneInst()
85248533
auto src1 = nonConstBuilder->duplicateOperand(getSrc(1))->asSrcRegRegion();
85258534
auto desc = nonConstBuilder->duplicateOperand(getSrc(2));
85268535
auto extDesc = nonConstBuilder->duplicateOperand(getSrc(3));
8527-
newInst = nonConstBuilder->createInternalSplitSendInst(getExecSize(), dst, src0, src1, desc,
8528-
getOption(), getMsgDescRaw(), extDesc);
8536+
newInst = nonConstBuilder->createInternalSplitSendInst(
8537+
getExecSize(), dst, src0, src1, desc,
8538+
getOption(), getMsgDesc(), extDesc);
85298539
if (prd)
85308540
{
85318541
newInst->setPredicate(prd);

visa/G4_IR.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -616,12 +616,6 @@ typedef struct _SWSBInfo
616616
return nullptr;
617617
return (G4_SendDescRaw *)msgDesc;
618618
}
619-
const G4_SendDescLdSt * getMsgDescLdSt() const {
620-
const auto *msgDesc = getMsgDesc();
621-
if (msgDesc == nullptr || !getMsgDesc()->isRaw())
622-
return nullptr;
623-
return (const G4_SendDescLdSt *)msgDesc;
624-
}
625619

626620
virtual bool mayExceedTwoGRF() const
627621
{
@@ -1568,8 +1562,6 @@ class G4_InstSend : public G4_INST
15681562
// thread should also terminate with a send to TS.
15691563
bool canBeEOT() const
15701564
{
1571-
if (!msgDesc->isRaw())
1572-
return false;
15731565
bool canEOT = getMsgDesc()->getDstLenRegs() == 0 &&
15741566
(getMsgDesc()->getSFID() != SFID::NULL_SFID &&
15751567
getMsgDesc()->getSFID() != SFID::SAMPLER);

0 commit comments

Comments
 (0)