Skip to content

Commit 2e9a3f6

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 167795e commit 2e9a3f6

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
@@ -5777,8 +5777,12 @@ void HWConformity::conformBB(G4_BB *bb) {
57775777
fixVxHFloat64b(i, bb);
57785778
}
57795779

5780-
if (fix64bInst(i, bb)) {
5781-
continue;
5780+
if (builder.supportFloatOr64bRegioning()) {
5781+
// This function is for pre-Xe_XeHPSDV platforms. Xe_XeHPSDV+ platforms
5782+
// should be fixed in fixUnalignedRegions() later.
5783+
if (fix64bInst(i, bb)) {
5784+
continue;
5785+
}
57825786
}
57835787

57845788
#ifdef _DEBUG
@@ -5841,6 +5845,15 @@ void HWConformity::conformBB(G4_BB *bb) {
58415845
}
58425846
}
58435847

5848+
// Do immdiate Address offset OOB check as previous fixes may generate
5849+
// invalid ImmAddrOffset.
5850+
for (auto iter = bb->begin(), iterEnd = bb->end(); iter != iterEnd; ++iter) {
5851+
fixImmAddrOffsetOOB(iter, bb);
5852+
#ifdef _DEBUG
5853+
verifyG4Kernel(kernel, Optimizer::PI_HWConformityChk, false);
5854+
#endif
5855+
}
5856+
58445857
if (builder.getNativeExecSize() <= g4::SIMD8) {
58455858
return;
58465859
}
@@ -5934,15 +5947,6 @@ void HWConformity::conformBB(G4_BB *bb) {
59345947
#endif
59355948
}
59365949
}
5937-
5938-
// Immdiate Address offset OOB check should be put at the end of conformBB
5939-
// as previous fixes may generate invalid ImmAddrOffset.
5940-
for (auto iter = bb->begin(), iterEnd = bb->end(); iter != iterEnd; ++iter) {
5941-
fixImmAddrOffsetOOB(iter, bb);
5942-
#ifdef _DEBUG
5943-
verifyG4Kernel(kernel, Optimizer::PI_HWConformityChk, false);
5944-
#endif
5945-
}
59465950
}
59475951

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

0 commit comments

Comments
 (0)