Skip to content

Commit 931b875

Browse files
apronin-intelsys_zuul
authored andcommitted
Changes in code.
Change-Id: I337cc974221e0aa59238688ec8eb29ff068d3271
1 parent cae1109 commit 931b875

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenX.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ const constexpr int DWordBytes = DWordBits / ByteBits;
139139
const constexpr int QWordBytes = QWordBits / ByteBits;
140140
const constexpr int OWordBytes = OWordBits / ByteBits;
141141

142+
// Currently EM determines behavior of 32 lanes.
143+
// Probably that should be moved to subtarget if
144+
// different targets will support different EM sizes.
145+
const constexpr unsigned int TotalEMSize = 32;
146+
142147
// vISA allows [-512,511] for operation to be baled as offset
143148
// for rdregion, copied from visa
144149
const constexpr int G4_MAX_ADDR_IMM = 511;

IGC/VectorCompiler/lib/GenXCodeGen/GenXCategory.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,9 @@ bool GenXCategory::fixCircularPhis(Function *F)
577577
// A phi node is never a struct -- GenXLowering removed struct phis.
578578
assert(!isa<StructType>(Phi->getType()));
579579
// Insert a copy, split as required to be legal.
580-
auto NewCopy = Liveness->insertCopy(Phi, nullptr, BB->getFirstNonPHI(),
581-
Phi->getName() + ".unoverlapper", 0);
580+
auto NewCopy =
581+
Liveness->insertCopy(Phi, nullptr, BB->getFirstNonPHI(),
582+
Phi->getName() + ".unoverlapper", 0, Subtarget);
582583
// Change the uses that existed before we added the copy to use the
583584
// copy instead.
584585
for (auto ui = Uses.begin(), ue = Uses.end(); ui != ue; ++ui)

IGC/VectorCompiler/lib/GenXCodeGen/GenXCoalescing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,8 @@ Instruction *GenXCoalescing::insertCopy(SimpleValue Input, LiveRange *LR,
16711671
Liveness->setLiveRange(SimpleValue(Extract), SourceLR);
16721672
Input = SimpleValue(Extract);
16731673
}
1674-
return Liveness->insertCopy(Input.getValue(), LR, InsertBefore, Name, Number);
1674+
return Liveness->insertCopy(Input.getValue(), LR, InsertBefore, Name, Number,
1675+
ST);
16751676
}
16761677

16771678
/***********************************************************************

IGC/VectorCompiler/lib/GenXCodeGen/GenXLiveness.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3737
#include "GenXIntrinsics.h"
3838
#include "GenXNumbering.h"
3939
#include "GenXRegion.h"
40+
#include "GenXSubtarget.h"
4041
#include "GenXUtil.h"
4142
#include "vc/GenXOpts/Utils/RegCategory.h"
4243
#include "llvm/ADT/SmallSet.h"
@@ -1163,8 +1164,9 @@ bool GenXLiveness::wrapsAround(Value *V1, Value *V2)
11631164
* adjust live ranges. Also at this stage there is no baling info to update.
11641165
*/
11651166
Instruction *GenXLiveness::insertCopy(Value *InputVal, LiveRange *LR,
1166-
Instruction *InsertBefore, const Twine &Name, unsigned Number)
1167-
{
1167+
Instruction *InsertBefore,
1168+
const Twine &Name, unsigned Number,
1169+
const GenXSubtarget *ST) {
11681170
assert(!isa<Constant>(InputVal));
11691171
bool AdjustLRs = LR != nullptr;
11701172
LiveRange *SourceLR = nullptr;
@@ -1211,7 +1213,10 @@ Instruction *GenXLiveness::insertCopy(Value *InputVal, LiveRange *LR,
12111213
}
12121214

12131215
Region R(InputVal);
1214-
unsigned MaxNum = R.ElementBytes == 1 ? 32 : 64 / R.ElementBytes;
1216+
unsigned MaxNum =
1217+
R.getLegalSize(/* StartIdx */ 0, /* Allow2D */ false, R.NumElements, ST);
1218+
// Adjust size to Exec size
1219+
MaxNum = std::min(MaxNum, TotalEMSize);
12151220
if (exactLog2(R.NumElements) >= 0 && R.NumElements <= MaxNum) {
12161221
// Can be done with a single copy.
12171222
if (SourceLR && (SourceLR->Category != RegCategory::GENERAL

IGC/VectorCompiler/lib/GenXCodeGen/GenXLiveness.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ class FunctionPass;
196196
class GenXBaling;
197197
class GenXLiveness;
198198
class GenXNumbering;
199+
class GenXSubtarget;
199200
class Instruction;
200201
class PHINode;
201202
class raw_ostream;
@@ -609,7 +610,9 @@ class GenXLiveness : public FunctionGroupPass {
609610
// See if V1 is a phi node and V2 wraps round to a phi use in the same BB after V1's def
610611
static bool wrapsAround(Value *V1, Value *V2);
611612
// Insert a copy of a non-struct value.
612-
Instruction *insertCopy(Value *InputVal, genx::LiveRange *LR, Instruction *InsertBefore, const Twine &Name, unsigned Number);
613+
Instruction *insertCopy(Value *InputVal, genx::LiveRange *LR,
614+
Instruction *InsertBefore, const Twine &Name,
615+
unsigned Number, const GenXSubtarget *ST);
613616
// eraseUnusedTree : erase unused tree of instructions, and remove from GenXLiveness
614617
void eraseUnusedTree(Instruction *Inst);
615618
// setArgAddressBase : set the base value of an argument indirect address

0 commit comments

Comments
 (0)