Skip to content

Commit

Permalink
_Remove the fct byte type change
Browse files Browse the repository at this point in the history
In the old impmentation, UB was treated as float type.
It looks like it's updated to BF later. But SWSB part is not changed
back.
  • Loading branch information
bcheng0127 authored and igcbot committed Dec 5, 2024
1 parent f19dacf commit 7d8e178
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
17 changes: 13 additions & 4 deletions visa/LocalScheduler/SWSB_G4IR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,13 @@ bool SBFootprint::hasOverlap(const SBFootprint *liveFootprint,
if (curFootprintPtr->LeftB <= curFootprint2Ptr->RightB &&
curFootprintPtr->RightB >= curFootprint2Ptr->LeftB) {
internalOffset = curFootprint2Ptr->offset;
if (curFType == GRF_T && !isPrecision && IS_BTYPE(curType)) {
if (curFType == GRF_T && !isPrecision &&
(IS_BTYPE(curType) || isFcvtByteType)) {
isRMWOverlap = true;
}
return true;
} else if (curFType == GRF_T && !isPrecision && IS_BTYPE(curType)) {
} else if (curFType == GRF_T && !isPrecision &&
(IS_BTYPE(curType) || isFcvtByteType)) {
unsigned short w_LeftB = curFootprintPtr->LeftB / 2;
unsigned short w_RightB = curFootprintPtr->RightB / 2;
unsigned short w_curLeftB = curFootprint2Ptr->LeftB / 2;
Expand Down Expand Up @@ -1006,11 +1008,15 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
int aregOffset = totalGRFNum;
G4_Type type = opnd->getType();
GenPrecision precision = GenPrecision::INVALID;
bool isFcvtByteType = false;
bool isPrecision = false;

if (inst->opcode() == G4_fcvt &&
(IS_BTYPE(type) ||
(type == Type_UD && builder.hasPartialInt64Support()))) {
if (IS_BTYPE(type)) {
isFcvtByteType = true;
}
type = Type_F;
}
if (inst->opcode() == G4_srnd) { // srnd ub hf hf | srnd hf f f
Expand Down Expand Up @@ -1131,8 +1137,11 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
}

SBFootprint *footprint =
isPrecision ? new (allocedMem) SBFootprint(GRF_T, precision, LB, RB, inst) :
new (allocedMem) SBFootprint(GRF_T, type, LB, RB, inst);
isPrecision
? new (allocedMem)
SBFootprint(GRF_T, precision, LB, RB, inst, isFcvtByteType)
: new (allocedMem)
SBFootprint(GRF_T, type, LB, RB, inst, isFcvtByteType);

return footprint;
}
Expand Down
10 changes: 6 additions & 4 deletions visa/LocalScheduler/SWSB_G4IR.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ struct SBFootprint {
const unsigned short RightB;
unsigned short offset = 0;
bool isPrecision = false;
bool isFcvtByteType = false;;
G4_INST *inst;

// FIXME: The choice of C-style linked list seems suspect given that there are
Expand All @@ -153,13 +154,14 @@ struct SBFootprint {
isPrecision = false;
}
SBFootprint(FOOTPRINT_TYPE ft, G4_Type t, unsigned short LB,
unsigned short RB, G4_INST *i)
: fType(ft), type((unsigned short)t), LeftB(LB), RightB(RB), inst(i) {
unsigned short RB, G4_INST *i, bool isByteType = false)
: fType(ft), type((unsigned short)t), LeftB(LB), RightB(RB), inst(i), isFcvtByteType(isByteType) {
isPrecision = false;
}
SBFootprint(FOOTPRINT_TYPE ft, GenPrecision p, unsigned short LB,
unsigned short RB, G4_INST *i)
: fType(ft), type((unsigned short)p), LeftB(LB), RightB(RB), inst(i), isPrecision(true) {
unsigned short RB, G4_INST *i, bool isByteType = false)
: fType(ft), type((unsigned short)p), LeftB(LB), RightB(RB), inst(i),
isPrecision(true), isFcvtByteType(isByteType) {
}

void setOffset(unsigned short o) { offset = o; }
Expand Down

0 comments on commit 7d8e178

Please sign in to comment.