Skip to content

Commit 11e5d22

Browse files
DianaChenfda0
authored andcommitted
vISA: Set iga::SWSB_ENCODE_MODE to ThreeDistPipeDPMath for MTL
IGA doesn't distinguish MTL from other XE_HPG platforms in its models. Set the correct SWSB_ENCODE_MODE from vISA when MTL is used to avoid swsb verifier errors. Add function BinaryEncodingIGA::getIGASWSBEncodeMode to unify SWSBEncodeMode getter (cherry picked from commit 0b4c663)
1 parent e90382b commit 11e5d22

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

visa/BinaryEncodingIGA.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class BinaryEncodingIGA {
9393
static Region::Width getIGAWidth(int width);
9494
static Region::Horz getIGAHorz(int hstride);
9595
static Region getIGARegion(G4_SrcRegRegion *srcRegion, int srcPos);
96+
SWSB_ENCODE_MODE getIGASWSBEncodeMode() const;
9697

9798
MathMacroExt getIGAImplAcc(G4_AccRegSel accSel) const {
9899
switch (accSel) {
@@ -379,6 +380,14 @@ BinaryEncodingIGA::BinaryEncodingIGA(vISA::G4_Kernel &k, std::string fname)
379380
IGAKernel = new Kernel(*platformModel);
380381
}
381382

383+
SWSB_ENCODE_MODE BinaryEncodingIGA::getIGASWSBEncodeMode() const {
384+
385+
if (platform == TARGET_PLATFORM::Xe_MTL)
386+
return SWSB_ENCODE_MODE::ThreeDistPipeDPMath;
387+
388+
return platformModel->getSWSBEncodeMode();
389+
}
390+
382391
InstOptSet BinaryEncodingIGA::getIGAInstOptSet(G4_INST *inst) const {
383392
InstOptSet options;
384393

@@ -982,8 +991,7 @@ void BinaryEncodingIGA::SetSWSB(G4_INST *inst, SWSB &sw) {
982991
// This workaround can be removed once vISA doesn't produce such SWSB.
983992
// Currently this could happen only on EOT send.
984993
if (inst->isSend() && !sw.hasBothDistAndToken() &&
985-
!sw.verify(IGAKernel->getModel().getSWSBEncodeMode(),
986-
SWSB::InstType::SEND)) {
994+
!sw.verify(getIGASWSBEncodeMode(), SWSB::InstType::SEND)) {
987995
sw.tokenType = SWSB::TokenType::SET;
988996
if (sw.hasDist()) {
989997
// if the distance type cannot be combined with SBID.set, force
@@ -1100,6 +1108,9 @@ void BinaryEncodingIGA::Encode() {
11001108
auto platformGen = kernel.getPlatformGeneration();
11011109
std::list<std::pair<Instruction *, G4_INST *>> encodedInsts;
11021110
Block *bbNew = nullptr;
1111+
1112+
SWSB_ENCODE_MODE swsbEncodeMode = getIGASWSBEncodeMode();
1113+
11031114
for (auto bb : this->kernel.fg) {
11041115
for (auto inst : *bb) {
11051116
bbNew = nullptr;
@@ -1136,7 +1147,7 @@ void BinaryEncodingIGA::Encode() {
11361147
instTy = SWSB::InstType::OTHERS;
11371148

11381149
// Verify if swsb is in encode-able dist and token combination
1139-
if (!sw.verify(IGAKernel->getModel().getSWSBEncodeMode(), instTy))
1150+
if (!sw.verify(swsbEncodeMode, instTy))
11401151
IGA_ASSERT_FALSE("Invalid swsb dist and token combination");
11411152
igaInst->setSWSB(sw);
11421153
}
@@ -1176,7 +1187,7 @@ void BinaryEncodingIGA::Encode() {
11761187
autoCompact = false; // PVC-A0 compaction is off (IGA only does B0+)
11771188

11781189
KernelEncoder encoder(IGAKernel, autoCompact);
1179-
encoder.setSWSBEncodingMode(IGAKernel->getModel().getSWSBEncodeMode());
1190+
encoder.setSWSBEncodingMode(swsbEncodeMode);
11801191

11811192
if (kernel.getOption(vISA_EnableIGASWSB)) {
11821193
encoder.enableIGAAutoDeps();

0 commit comments

Comments
 (0)