Skip to content

Commit 4254dee

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: 1680c57: Fix the bug for SWSB dependence missing on undefined variable
cmp.eq v5444, v5444 v5444 is undefined and will be assigned with any register. As a result there may be RAW dependence in the SIMD control. Current SWSB only track WAR WAW along the SIMD control.
1 parent 6edf2d0 commit 4254dee

File tree

7 files changed

+3
-69
lines changed

7 files changed

+3
-69
lines changed

visa/G4_Declare.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ class G4_Declare {
9393
uint16_t addrSpillFill : 1;
9494
uint16_t forceSpilled : 1;
9595
uint16_t exclusiveLoad : 1;
96-
uint16_t isCmpUseOnly : 1;
9796

9897
unsigned declId; // global decl id for this builder
9998

@@ -331,9 +330,6 @@ class G4_Declare {
331330
void setPreDefinedVar(bool b) { PreDefinedVar = b; }
332331
bool isPreDefinedVar() const { return PreDefinedVar; }
333332

334-
void setIsCmpUseOnly(bool b) { isCmpUseOnly = b; }
335-
bool getIsCmpUseOnly() const { return isCmpUseOnly; }
336-
337333
unsigned getNumRegNeeded() const;
338334

339335
void emit(std::ostream &output) const;

visa/G4_IR.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5154,7 +5154,6 @@ G4_Declare::G4_Declare(const IR_Builder &builder, const char *n,
51545154
addrSpillFill = false;
51555155
forceSpilled = false;
51565156
exclusiveLoad = false;
5157-
isCmpUseOnly = false;
51585157
scopeID = 0;
51595158

51605159
declId = (unsigned)dcllist.size();

visa/GraphColor.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,6 @@ class GlobalRA {
14051405
static const RAVarInfo defaultValues;
14061406
std::vector<RAVarInfo> vars;
14071407
std::vector<G4_Declare *> UndeclaredVars;
1408-
std::vector<G4_Declare *> UndefinedCmpVars;
14091408

14101409
// fake declares for each GRF reg, used by HRA
14111410
// note only GRFs that are used by LRA get a declare
@@ -1618,7 +1617,6 @@ class GlobalRA {
16181617
void addSpillCodeInBB(G4_BB *bb) { BBsWithSpillCode.insert(bb); }
16191618

16201619
void addUndefinedDcl(G4_Declare *dcl) { UndeclaredVars.push_back(dcl); }
1621-
void addUndefinedCmpDcl(G4_Declare *dcl) { UndefinedCmpVars.push_back(dcl); }
16221620

16231621
bool isUndefinedDcl(const G4_Declare *dcl) const {
16241622
return std::find(UndeclaredVars.begin(), UndeclaredVars.end(), dcl) !=
@@ -1691,7 +1689,6 @@ class GlobalRA {
16911689
setBBId(dcl, UINT_MAX);
16921690
resetLocalLR(dcl);
16931691
}
1694-
UndefinedCmpVars.clear();
16951692
}
16961693

16971694
void clearLocalLiveRanges() {
@@ -2053,7 +2050,6 @@ class GlobalRA {
20532050
void addCalleeSavePseudoCode();
20542051
void addStoreRestoreToReturn();
20552052
void storeCEInProlog();
2056-
void setUndefinedVarCmp();
20572053
void markGraphBlockLocalVars();
20582054
void verifyRA(LivenessAnalysis &liveAnalysis);
20592055
void verifySpillFill();

visa/LocalRA.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ class LocalLiveRange {
135135

136136
bool assigned;
137137
bool isSplit;
138-
bool defined;
139138

140139
IR_Builder &builder;
141140

@@ -154,7 +153,6 @@ class LocalLiveRange {
154153
assigned = false;
155154
eot = false;
156155
isSplit = false;
157-
defined = false;
158156

159157
if (!builder.canWriteR0())
160158
addForbidden(0);
@@ -226,9 +224,6 @@ class LocalLiveRange {
226224
void markSplit() { isSplit = true; }
227225
bool getSplit() const { return isSplit; }
228226

229-
void markDefined() { defined = true; }
230-
bool isDefined() const { return defined; }
231-
232227
void addForbidden(unsigned int f) { forbiddenGRFs.insert(f); }
233228
std::unordered_set<unsigned int> &getForbidden() { return forbiddenGRFs; }
234229
};

visa/LocalScheduler/SWSB_G4IR.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,6 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
10431043
GenPrecision precision = GenPrecision::INVALID;
10441044
bool isFcvtByteType = false;
10451045
bool isPrecision = false;
1046-
bool isCmpUseOnly = inst->opcode() == G4_cmp && opnd_num == Opnd_src0 &&
1047-
opnd->getTopDcl()->getIsCmpUseOnly();
10481046

10491047
if (inst->opcode() == G4_fcvt &&
10501048
(IS_BTYPE(type) ||
@@ -1177,7 +1175,7 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
11771175
SBFootprint(GRF_T, precision, LB, RB, inst, isFcvtByteType)
11781176
: new (allocedMem)
11791177
SBFootprint(GRF_T, type, LB, RB, inst, isFcvtByteType);
1180-
footprint->isCmpUseOnly = isCmpUseOnly;
1178+
11811179
return footprint;
11821180
}
11831181

@@ -5602,9 +5600,6 @@ void G4_BB_SB::setSendOpndMayKilled(SBNODE_VECT &SBNodes, PointsToAnalysis &p,
56025600
send_may_kill.src.set(globalID);
56035601
} else if (dep == RAW) {
56045602
send_may_kill.dst.set(globalID);
5605-
if (curFootprint->isCmpUseOnly) {
5606-
send_WAW_may_kill.set(globalID);
5607-
}
56085603
// Exclusive WAW has no overlap
56095604
} else if (dep == WAW && (isSend || !isDclExclusiveLoad(
56105605
nodeInfo.topDeclare, topDcl))) {
@@ -8006,20 +8001,9 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
80068001
unsigned short internalOffset = 0;
80078002
bool hasOverlap =
80088003
curFootprint->hasOverlap(liveFootprint, internalOffset);
8009-
DepType dep = getDepForOpnd(liveOpnd, curOpnd);
80108004

8011-
// Following special dependence checking is to handle following case
8012-
// in SIMD control follow:
8013-
// cmp.eq v5444, v5444
8014-
// where v5444 is undefined and can be assigned with any register. As
8015-
// a result there may be RAW dependence in the SIMD control follow.
8016-
// For this special case, we treat it as a WAW dependence by checking
8017-
// if it's uninitialized declare used in cmp
8018-
if (!afterWrite && liveOpnd == Opnd_dst &&
8019-
curFootprint->isCmpUseOnly) {
8020-
dep = getDepForOpnd(liveOpnd, Opnd_dst);
8021-
}
80228005
// Find DEP type
8006+
DepType dep = getDepForOpnd(liveOpnd, curOpnd);
80238007
if (!hasOverlap && dep == RAW) {
80248008
hasOverlap =
80258009
sb_bb->hasExtraOverlap(liveInst, curInst, liveFootprint,

visa/LocalScheduler/SWSB_G4IR.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ struct SBFootprint {
141141
const unsigned short RightB;
142142
unsigned short offset = 0;
143143
bool isPrecision = false;
144-
bool isFcvtByteType = false;
145-
bool isCmpUseOnly = false;
144+
bool isFcvtByteType = false;;
146145
G4_INST *inst;
147146

148147
// FIXME: The choice of C-style linked list seems suspect given that there are

visa/RegAlloc.cpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,23 +1923,6 @@ void GlobalRA::markBlockLocalVars() {
19231923
it++) {
19241924
G4_INST *inst = *it;
19251925

1926-
// Chjeck if there is undefine variable used in CMP instruction, which is
1927-
// used to detect the execution mask.
1928-
// cmp.eq (M1, 16) P12 V0147(0,0)<0;1,0> V0147(0,0)<0;1,0>
1929-
if (inst->opcode() == G4_cmp) {
1930-
const bool isModEq =
1931-
inst->getCondMod() && inst->getCondMod()->getMod() == Mod_e;
1932-
const bool isNullDst = !inst->getDst() || inst->hasNULLDst();
1933-
const bool isSrc0SameAsSrc1 = inst->getSrc(0)->asSrcRegRegion() &&
1934-
inst->getSrc(1)->asSrcRegRegion() &&
1935-
*inst->getSrc(0)->asSrcRegRegion() ==
1936-
*inst->getSrc(1)->asSrcRegRegion();
1937-
if (isModEq && isNullDst && isSrc0SameAsSrc1) {
1938-
G4_Declare *topdcl = GetTopDclFromRegRegion(inst->getSrc(0));
1939-
addUndefinedCmpDcl(topdcl);
1940-
}
1941-
}
1942-
19431926
// Track direct dst references.
19441927

19451928
G4_DstRegRegion *dst = inst->getDst();
@@ -1962,7 +1945,6 @@ void GlobalRA::markBlockLocalVars() {
19621945
lr->setFirstRef(inst, 0);
19631946
}
19641947
lr->recordRef(bb);
1965-
lr->markDefined();
19661948
recordRef(topdcl);
19671949
}
19681950
}
@@ -2105,20 +2087,6 @@ bool GlobalRA::canSkipFDE() const {
21052087
return !kernel.fg.getHasStackCalls() && kernel.getOption(vISA_skipFDE);
21062088
}
21072089

2108-
void GlobalRA::setUndefinedVarCmp() {
2109-
// Iterate over all dcls and remove those with 0
2110-
// ref count and not addressed. This is done only for
2111-
// GRF dcls.
2112-
2113-
// Propagate top dcl info to aliases
2114-
for (auto dcl : UndefinedCmpVars) {
2115-
LocalLiveRange *lr = getLocalLR(dcl);
2116-
if (!lr->isDefined()) {
2117-
dcl->setIsCmpUseOnly(true);
2118-
}
2119-
}
2120-
}
2121-
21222090
//
21232091
// Mark block local (temporary) variables.
21242092
//
@@ -2129,9 +2097,6 @@ void GlobalRA::markGraphBlockLocalVars() {
21292097
// Create live ranges and record the reference info
21302098
markBlockLocalVars();
21312099

2132-
// Set undefined variable used in cmp
2133-
setUndefinedVarCmp();
2134-
21352100
VISA_DEBUG_VERBOSE({
21362101
std::cout << "\t--LOCAL VARIABLES--\n";
21372102
for (auto dcl : kernel.Declares) {

0 commit comments

Comments
 (0)