Skip to content

Commit ea8c9f6

Browse files
KorovinVladigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: 65480d4
Introduce surface commoning .
1 parent 546c9e0 commit ea8c9f6

File tree

2 files changed

+0
-109
lines changed

2 files changed

+0
-109
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXCategory.cpp

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ namespace {
201201
private:
202202
using ConvListT = std::array<llvm::Instruction *, vc::numRegCategories()>;
203203

204-
bool commonUpSurface(BasicBlock *BB);
205204
bool processFunction(Function *F);
206205
bool fixCircularPhis(Function *F);
207206
bool processValue(Value *V);
@@ -506,50 +505,6 @@ static bool commonUpPredicate(BasicBlock *BB) {
506505
return Changed;
507506
}
508507

509-
/***********************************************************************
510-
* isToSurfaceConversion : returns true if the input instruction is a
511-
* surface conversion intrinsic.
512-
*/
513-
static bool isToSurfaceConversion(Instruction *I,
514-
const GenXLiveness *Liveness) {
515-
if (IntrinsicInst *IC = dyn_cast<IntrinsicInst>(I)) {
516-
unsigned IntrinsicID = vc::getAnyIntrinsicID(IC);
517-
if (IntrinsicID != GenXIntrinsic::genx_convert)
518-
return false;
519-
if (auto LR = Liveness->getLiveRangeOrNull(I)) {
520-
auto Cat = LR->getCategory();
521-
if (Cat == vc::RegCategory::Surface)
522-
return true;
523-
}
524-
}
525-
return false;
526-
}
527-
528-
/***********************************************************************
529-
* commonUpSurface : perform surface commoning to reduce number of
530-
* instructions to stop the surface conversion falling outside of the
531-
* register into which it points to avoid going out of spec (256). The
532-
* logic is applied within a basic block to avoid dramatic live ranges
533-
* increase.
534-
*/
535-
bool GenXCategory::commonUpSurface(BasicBlock *BB) {
536-
bool Modified = false;
537-
// Maps the original value to after-conversion value.
538-
SmallDenseMap<Value *, Value *> ConvMap;
539-
for (auto bi = BB->begin(), be = BB->end(); bi != be; ++bi) {
540-
Instruction *I = &*bi;
541-
if (!isToSurfaceConversion(I, Liveness))
542-
continue;
543-
IGC_ASSERT(I->hasOneUse());
544-
if (!ConvMap.insert({I->getOperand(0), I}).second) {
545-
Modified = true;
546-
I->replaceAllUsesWith(ConvMap[I->getOperand(0)]);
547-
ToErase.push_back(I);
548-
}
549-
}
550-
return Modified;
551-
}
552-
553508
/***********************************************************************
554509
* processFunction : run the category conversion pass for this Function
555510
*
@@ -583,8 +538,6 @@ bool GenXCategory::processFunction(Function *F)
583538

584539
// This commons up constpred calls just loaded.
585540
Modified |= commonUpPredicate(BB);
586-
// This commons up to-surface conversion calls.
587-
Modified |= commonUpSurface(BB);
588541

589542
// Erase instructions (and their live ranges) as requested by processValue.
590543
for (unsigned i = 0, e = ToErase.size(); i != e; ++i) {

IGC/VectorCompiler/test/GenXCategory/surface-commoning.ll

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)