@@ -181,29 +181,6 @@ static bool operandOverlap(G4_Operand *opnd1, G4_Operand *opnd2) {
181
181
opnd2->getLinearizedEnd () > opnd1->getLinearizedStart ());
182
182
}
183
183
184
- static G4_Type getDPASDataType (GenPrecision p) {
185
- switch (p) {
186
- case GenPrecision::U1:
187
- case GenPrecision::U2:
188
- case GenPrecision::U4:
189
- case GenPrecision::U8:
190
- return Type_UB;
191
- case GenPrecision::S2:
192
- case GenPrecision::S4:
193
- case GenPrecision::S8:
194
- return Type_B;
195
- case GenPrecision::FP16:
196
- return Type_HF;
197
- case GenPrecision::BF16:
198
- return Type_BF;
199
- case GenPrecision::TF32:
200
- return Type_UNDEF;
201
- default :
202
- vISA_ASSERT_UNREACHABLE (" illegal Operand Precision" );
203
- return Type_UD;
204
- }
205
- }
206
-
207
184
bool SBFootprint::hasOverlap (const SBFootprint *liveFootprint,
208
185
unsigned short &internalOffset) const {
209
186
for (const SBFootprint *curFootprintPtr = this ; curFootprintPtr;
@@ -232,7 +209,8 @@ bool SBFootprint::hasOverlap(const SBFootprint *liveFootprint,
232
209
for (const SBFootprint *curFootprintPtr = this ; curFootprintPtr;
233
210
curFootprintPtr = curFootprintPtr->next ) {
234
211
FOOTPRINT_TYPE curFType = curFootprintPtr->fType ;
235
- G4_Type curType = curFootprintPtr->type ;
212
+ const unsigned short curType = curFootprintPtr->type ;
213
+ bool isPrecision = curFootprintPtr->isPrecision ;
236
214
for (const SBFootprint *curFootprint2Ptr = liveFootprint; curFootprint2Ptr;
237
215
curFootprint2Ptr = curFootprint2Ptr->next ) {
238
216
// Negative of no overlap: !(LeftB > curFootprint2Ptr->RightB || RightB
@@ -241,11 +219,11 @@ bool SBFootprint::hasOverlap(const SBFootprint *liveFootprint,
241
219
if (curFootprintPtr->LeftB <= curFootprint2Ptr->RightB &&
242
220
curFootprintPtr->RightB >= curFootprint2Ptr->LeftB ) {
243
221
internalOffset = curFootprint2Ptr->offset ;
244
- if (curFType == GRF_T && IS_BTYPE (curType)) {
222
+ if (curFType == GRF_T && !isPrecision && IS_BTYPE (curType)) {
245
223
isRMWOverlap = true ;
246
224
}
247
225
return true ;
248
- } else if (curFType == GRF_T && IS_BTYPE (curType)) {
226
+ } else if (curFType == GRF_T && !isPrecision && IS_BTYPE (curType)) {
249
227
unsigned short w_LeftB = curFootprintPtr->LeftB / 2 ;
250
228
unsigned short w_RightB = curFootprintPtr->RightB / 2 ;
251
229
unsigned short w_curLeftB = curFootprint2Ptr->LeftB / 2 ;
@@ -318,6 +296,17 @@ bool SBFootprint::isWholeOverlap(const SBFootprint *liveFootprint) const {
318
296
return findOverlap;
319
297
}
320
298
299
+ bool SBFootprint::hasSameType (const SBFootprint *liveFootprint) const {
300
+ if (isPrecision != liveFootprint->isPrecision ) {
301
+ return false ;
302
+ }
303
+ if (isPrecision) {
304
+ return G4_InstDpas::hasSamePrecision ((GenPrecision)type,
305
+ (GenPrecision)liveFootprint->type );
306
+ }
307
+ return type == liveFootprint->type ;
308
+ }
309
+
321
310
// check if the current footprint has the same range with given one, or they
322
311
// are not overlapped at all
323
312
bool SBFootprint::isSameOrNoOverlap (const SBFootprint *liveFootprint) const {
@@ -1013,6 +1002,9 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
1013
1002
unsigned short RB = 0 ;
1014
1003
int aregOffset = totalGRFNum;
1015
1004
G4_Type type = opnd->getType ();
1005
+ GenPrecision precision = GenPrecision::INVALID;
1006
+ bool isPrecision = false ;
1007
+
1016
1008
if (inst->opcode () == G4_fcvt &&
1017
1009
(IS_BTYPE (type) ||
1018
1010
(type == Type_UD && builder.hasPartialInt64Support ()))) {
@@ -1023,11 +1015,12 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
1023
1015
}
1024
1016
1025
1017
if (inst->isDpas () && (opnd_num == Opnd_src1 || opnd_num == Opnd_src2)) {
1018
+ isPrecision = true ;
1026
1019
if (opnd_num == Opnd_src1) {
1027
- type = getDPASDataType ( inst->asDpasInst ()->getSrc1Precision () );
1020
+ precision = inst->asDpasInst ()->getSrc1Precision ();
1028
1021
}
1029
1022
if (opnd_num == Opnd_src2) {
1030
- type = getDPASDataType ( inst->asDpasInst ()->getSrc2Precision () );
1023
+ precision = inst->asDpasInst ()->getSrc2Precision ();
1031
1024
}
1032
1025
}
1033
1026
@@ -1119,6 +1112,7 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
1119
1112
}
1120
1113
1121
1114
SBFootprint *footprint =
1115
+ isPrecision ? new (allocedMem) SBFootprint (GRF_T, precision, LB, RB, inst) :
1122
1116
new (allocedMem) SBFootprint (GRF_T, type, LB, RB, inst);
1123
1117
1124
1118
return footprint;
@@ -5551,10 +5545,14 @@ void G4_BB_SB::setDistance(const SBFootprint *footprint, SBNode *node,
5551
5545
SBDISTDEP_ITEM depItem;
5552
5546
depItem.liveNodePipe = liveNode->ALUPipe ;
5553
5547
depItem.nodePipe = node->ALUPipe ;
5554
- depItem.operandType = getDataTypePipeXe (builder, footprint->type );
5555
5548
depItem.dstDep = dstDep;
5556
5549
if (node->GetInstruction ()->isSend ()) {
5557
5550
depItem.operandType = PIPE_SEND;
5551
+ } else if (node->GetInstruction ()->isDpas ()) {
5552
+ depItem.operandType = PIPE_DPAS;
5553
+ } else { // Precision is only used in DPAS
5554
+ depItem.operandType =
5555
+ getDataTypePipeXe (builder, (G4_Type)footprint->type );
5558
5556
}
5559
5557
vISA_ASSERT (currentID > prevID, " Wrong node ALU ID" );
5560
5558
unsigned distance = node->setDistance (currentID - prevID);
@@ -5696,20 +5694,21 @@ bool G4_BB_SB::src2SameFootPrintDiffType(SBNode *curNode,
5696
5694
fp = fp->next ) {
5697
5695
unsigned short leftB = fp->LeftB / builder.numEltPerGRF <Type_UB>();
5698
5696
unsigned short rightB = fp->RightB / builder.numEltPerGRF <Type_UB>();
5699
- G4_Type type = fp->type ;
5697
+ vASSERT (fp->isPrecision );
5698
+ GenPrecision p = (GenPrecision)fp->type ;
5700
5699
5701
5700
for (const SBFootprint *nextfp = nextNode->getFirstFootprint (Opnd_src2);
5702
5701
nextfp; nextfp = nextfp->next ) {
5703
5702
unsigned short nextLeftB =
5704
5703
nextfp->LeftB / builder.numEltPerGRF <Type_UB>();
5705
5704
unsigned short nextRightB =
5706
5705
nextfp->RightB / builder.numEltPerGRF <Type_UB>();
5707
- G4_Type nextType = nextfp->type ;
5706
+ vASSERT (nextfp->isPrecision );
5707
+ GenPrecision nextP = (GenPrecision)nextfp->type ;
5708
5708
5709
5709
if (!(nextLeftB > rightB || nextRightB < leftB)) {
5710
- if (type != nextType) {
5711
- return true ;
5712
- }
5710
+ return !G4_InstDpas::hasSamePrecision ((GenPrecision)p,
5711
+ (GenPrecision)nextP);
5713
5712
}
5714
5713
}
5715
5714
}
@@ -5766,8 +5765,8 @@ bool G4_BB_SB::isLastDpas(SBNode *curNode, SBNode *nextNode)
5766
5765
{Opnd_src0, Opnd_src1, Opnd_src2, Opnd_dst}) {
5767
5766
if (curNode->getFirstFootprint (opndNum) &&
5768
5767
nextNode->getFirstFootprint (opndNum) &&
5769
- curNode->getFirstFootprint (opndNum)->type !=
5770
- nextNode->getFirstFootprint (opndNum)-> type ) {
5768
+ ! curNode->getFirstFootprint (opndNum)->hasSameType (
5769
+ nextNode->getFirstFootprint (opndNum)) ) {
5771
5770
return true ;
5772
5771
}
5773
5772
}
@@ -5790,13 +5789,16 @@ bool G4_BB_SB::isLastDpas(SBNode *curNode, SBNode *nextNode)
5790
5789
}
5791
5790
5792
5791
if (VISA_WA_CHECK (builder.getPWaTable (), Wa_16011859583) ||
5793
- VISA_WA_CHECK (builder.getPWaTable (), Wa_14012420496) ||
5794
- builder.getOption (vISA_NoDPASMacro)) {
5792
+ VISA_WA_CHECK (builder.getPWaTable (), Wa_14012420496)) {
5795
5793
if (curC != 8 || nextC != 8 ) {
5796
5794
return true ;
5797
5795
}
5798
5796
}
5799
5797
5798
+ if (builder.getOption (vISA_NoDPASMacro)) {
5799
+ return true ;
5800
+ }
5801
+
5800
5802
if (builder.hasDpasSrc2ReadSupression () &&
5801
5803
builder.hasDpasSrc2ReadSupressionSameRegSameType () &&
5802
5804
src2SameFootPrintDiffType (curNode, nextNode)) {
0 commit comments