Skip to content

Commit 2ae43a7

Browse files
fangliu2020fda0
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 620c74c)
1 parent 35623dd commit 2ae43a7

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

visa/HWConformity.cpp

+18-12
Original file line numberDiff line numberDiff line change
@@ -5776,8 +5776,12 @@ void HWConformity::conformBB(G4_BB *bb) {
57765776
fixVxHFloat64b(i, bb);
57775777
}
57785778

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

57835787
#ifdef _DEBUG
@@ -5840,6 +5844,15 @@ void HWConformity::conformBB(G4_BB *bb) {
58405844
}
58415845
}
58425846

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

59475951
//
@@ -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)