Skip to content

Commit d360c48

Browse files
fangliu2020pszymich
authored andcommitted
Fix a few register regioning issues for 64b instructions on MTL platform
There are a few bug in fix64bInst() which will generate invalid instructions: Bug #1: (P09.0) mov (4) r[A00(0,1), 0]<1>:df conv96(0,1)<0;1,0>:df After HWConformity => (W&P09.0) mov (1) TV(0,0)<1>:df conv96(0,1)<0;1,0>:df // do anything as only 2nd channel enabled (W) mov (2) r[A00(0,1), 0]<1>:ud TV(0,0)<0;2,1>:ud // do all as it's noMask Bug #2: mov (8|M8) reduceSrc_0(2,0)<1>:df V0210(0,8)<1;1,0>:w After HWConformity => mov (8|M8) TV56(0,0)<4>:w V0210(0,8)<1;1,0>:w mov (8|M8) TV57(0,0)<1>:df TV56(0,0)<16;4,4>:w (W) mov (16) reduceSrc_0(2,0)<1>:ud TV57(0,0)<1;1,0>:ud // noMask is incorrect here There are two functions which are fix64bInst() and fixUnalignedRegions() to check the register regioning issue for 64b instructions. fix64bInst() is for all platforms which have no 64b regioning(CHV, BXT, ICLLP, XeLP, DG2, MTL, ARL). And fixUnalignedRegions() is for Xe_XeHPSDV+ platforms. So, there are duplicated fixes for some platforms like DG2, MTL and ARL. We should avoid invoking fix64bInst() for Xe_XeHPSDV+ platforms, and let fixUnalignedRegions() to fix it later. With this change, above bugs can be fixed. (cherry picked from commit 43681f8)
1 parent 2ca1252 commit d360c48

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

visa/HWConformity.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5773,8 +5773,12 @@ void HWConformity::conformBB(G4_BB *bb) {
57735773
fixVxHFloat64b(i, bb);
57745774
}
57755775

5776-
if (fix64bInst(i, bb)) {
5777-
continue;
5776+
if (builder.supportFloatOr64bRegioning()) {
5777+
// This function is for pre-Xe_XeHPSDV platforms. Xe_XeHPSDV+ platforms
5778+
// should be fixed in fixUnalignedRegions() later.
5779+
if (fix64bInst(i, bb)) {
5780+
continue;
5781+
}
57785782
}
57795783

57805784
#ifdef _DEBUG
@@ -5837,6 +5841,15 @@ void HWConformity::conformBB(G4_BB *bb) {
58375841
}
58385842
}
58395843

5844+
// Do immdiate Address offset OOB check as previous fixes may generate
5845+
// invalid ImmAddrOffset.
5846+
for (auto iter = bb->begin(), iterEnd = bb->end(); iter != iterEnd; ++iter) {
5847+
fixImmAddrOffsetOOB(iter, bb);
5848+
#ifdef _DEBUG
5849+
verifyG4Kernel(kernel, Optimizer::PI_HWConformityChk, false);
5850+
#endif
5851+
}
5852+
58405853
if (builder.getNativeExecSize() <= g4::SIMD8) {
58415854
return;
58425855
}
@@ -5930,15 +5943,6 @@ void HWConformity::conformBB(G4_BB *bb) {
59305943
#endif
59315944
}
59325945
}
5933-
5934-
// Immdiate Address offset OOB check should be put at the end of conformBB
5935-
// as previous fixes may generate invalid ImmAddrOffset.
5936-
for (auto iter = bb->begin(), iterEnd = bb->end(); iter != iterEnd; ++iter) {
5937-
fixImmAddrOffsetOOB(iter, bb);
5938-
#ifdef _DEBUG
5939-
verifyG4Kernel(kernel, Optimizer::PI_HWConformityChk, false);
5940-
#endif
5941-
}
59425946
}
59435947

59445948
//
@@ -9842,7 +9846,9 @@ void HWConformity::fixImmAddrOffsetOOB(INST_LIST_ITER it, G4_BB *bb) {
98429846
// add(execSize) A(0,0)<1>:uw A(0,0)<1;1,0>:uw imm:w
98439847
auto addrDst = builder.createDst(var->getBase(), 0, sregOff, 1, Type_UW);
98449848
auto addrSrc = builder.createSrc(var->getBase(), 0, sregOff,
9845-
builder.getRegionStride1(), Type_UW);
9849+
execSize == 1 ? builder.getRegionScalar()
9850+
: builder.getRegionStride1(),
9851+
Type_UW);
98469852
auto immSrc = builder.createImm(imm, Type_W);
98479853
auto addrAddInst = builder.createInternalInst(
98489854
nullptr, G4_add, nullptr, g4::NOSAT, G4_ExecSize(execSize), addrDst,

0 commit comments

Comments
 (0)