Skip to content

Commit 42469d1

Browse files
Dimus77igcbot
authored andcommitted
Changes in code.
1 parent be9f0eb commit 42469d1

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

visa/BuildIR.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,11 @@ class IR_Builder
588588

589589
//
590590
// Check if opnd is or can be made "alignByte"-byte aligned.
591-
// It will change the underlying variable's alignment
592-
// (e.g., make a scalar variable GRF-aligned) when possible to satisfy the alignment
591+
// These functions will change the underlying variable's alignment
592+
// (e.g., make a scalar variable GRF-aligned) when possible to satisfy
593+
// the alignment
593594
bool isOpndAligned(G4_Operand* opnd, int alignByte) const;
594-
// Use this version if you want to know the fixed subreg offset for the operand even if it's not aligned.
595-
std::tuple<bool, uint16_t> isOpndAlignedTo(G4_Operand *opnd, int align_byte) const;
595+
bool isOpndAligned(G4_Operand *opnd, unsigned short &offset, int align_byte) const;
596596

597597
void setIsKernel(bool value) { isKernel = value; }
598598
bool getIsKernel() const { return isKernel; }

visa/BuildIRImpl.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ void IR_Builder::bindInputDecl(G4_Declare* dcl, int offset)
164164
}
165165

166166
// check if an operand is aligned to <align_byte>
167-
std::tuple<bool, uint16_t> IR_Builder::isOpndAlignedTo(
168-
G4_Operand *opnd, int align_byte) const
167+
bool IR_Builder::isOpndAligned(
168+
G4_Operand *opnd, unsigned short &offset, int align_byte) const
169169
{
170-
uint16_t offset = 0;
170+
offset = 0;
171171
bool isAligned = true;
172172

173173
switch (opnd->getKind())
@@ -209,7 +209,7 @@ std::tuple<bool, uint16_t> IR_Builder::isOpndAlignedTo(
209209
}
210210
if (!isAligned)
211211
{
212-
return std::make_tuple(isAligned, offset);
212+
return isAligned;
213213
}
214214

215215
if (opnd->isDstRegRegion())
@@ -230,7 +230,7 @@ std::tuple<bool, uint16_t> IR_Builder::isOpndAlignedTo(
230230
}
231231
if (offset % align_byte != 0)
232232
{
233-
return std::make_tuple(false, offset);
233+
return false;
234234
}
235235
// Only alignment of the top dcl can be changed.
236236
if (dcl && dcl->getRegFile() == G4_GRF)
@@ -355,14 +355,14 @@ std::tuple<bool, uint16_t> IR_Builder::isOpndAlignedTo(
355355
default:
356356
break;
357357
}
358-
return std::make_tuple(isAligned, offset);
358+
return isAligned;
359359
}
360360

361361

362362
bool IR_Builder::isOpndAligned(G4_Operand* opnd, int alignByte) const
363363
{
364-
auto [isAligned, offset] = isOpndAlignedTo(opnd, alignByte);
365-
return isAligned;
364+
uint16_t offset = 0; // ignored
365+
return isOpndAligned(opnd, offset, alignByte);
366366
}
367367

368368

visa/HWConformity.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,8 +1591,8 @@ bool HWConformity::fixDstAlignment(INST_LIST_ITER i, G4_BB* bb, G4_Type extype,
15911591
bool dstHFMixModeInst = inst->getDst()->getType() == builder.getMixModeType() && extype == Type_F;
15921592
bool dstNotAlignedToExecType = exec_size > 1 && (dst_elsize * h_stride) < extypesize &&
15931593
!(builder.hasMixMode() && dstHFMixModeInst);
1594-
1595-
auto [isAligned, dst_byte_offset] = builder.isOpndAlignedTo(dst, extypesize);
1594+
unsigned short dst_byte_offset;
1595+
builder.isOpndAligned(dst, dst_byte_offset, extypesize);
15961596
if (!((dst_byte_offset % extypesize == 0) ||
15971597
(byteDst &&
15981598
(dst_byte_offset % extypesize == 1))
@@ -4736,7 +4736,8 @@ void HWConformity::fixSendInst(G4_BB* bb)
47364736
}
47374737
}
47384738

4739-
if (!builder.isOpndAligned(inst->getDst(), numEltPerGRF(Type_UB)))
4739+
uint16_t offset = 0;
4740+
if (!builder.isOpndAligned(inst->getDst(), offset, numEltPerGRF(Type_UB)))
47404741
{
47414742
replaceDst(i, inst->getDst()->getType(), GRFALIGN);
47424743
}

visa/ReduceExecSize.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,10 @@ bool HWConformity::reduceExecSize(INST_LIST_ITER iter, G4_BB* bb)
452452
if (dstRegionSize <= 16)
453453
{
454454
// see if we can make the dst fit in one oword
455+
unsigned short dstOffset = 0;
456+
bool dstOwordAligned = false;
455457
int dstAlign = Round_Up_Pow2(dstRegionSize);
456-
auto [dstOwordAligned, dstOffset] = builder.isOpndAlignedTo(dst, dstAlign);
458+
dstOwordAligned = builder.isOpndAligned(dst, dstOffset, dstAlign);
457459
if (!dstOwordAligned)
458460
{
459461
// If we can align dst to its size, it must fit in one OWord
@@ -465,7 +467,7 @@ bool HWConformity::reduceExecSize(INST_LIST_ITER iter, G4_BB* bb)
465467
// technically if dst and src are both evenly split the instruction is
466468
// still ok, but this case should be rare so we ignore it
467469
G4_DstRegRegion* newDst = insertMovAfter(iter, dst, dst->getType(), bb);
468-
bool alignTmpDst = builder.isOpndAligned(newDst, 16);
470+
bool alignTmpDst = builder.isOpndAligned(newDst, dstOffset, 16);
469471
MUST_BE_TRUE(alignTmpDst, "must be able to oword align tmp dst");
470472
inst->setDest(newDst);
471473
return true;

0 commit comments

Comments
 (0)