Skip to content

Commit 2b8081f

Browse files
weiyu-chensys_zuul
authored andcommitted
Add lifetime marker for predicate A64 vector load produce by the WA
Change-Id: Ibb15fab310c0483482dd3ff9b178dce698dd8830
1 parent 078c80d commit 2b8081f

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5176,7 +5176,7 @@ void EmitPass::emitLegacySimdBlockRead(llvm::Instruction* inst, llvm::Value* ptr
51765176
m_encoder->SetUniformSIMDSize(simdmode);
51775177
if (useA64)
51785178
{
5179-
emitGatherA64(gatherDst, gatherOff, blkBits, nBlks);
5179+
emitGatherA64(inst, gatherDst, gatherOff, blkBits, nBlks);
51805180
}
51815181
else
51825182
{
@@ -14422,7 +14422,7 @@ bool EmitPass::hasA64WAEnable() const
1442214422
return m_currShader->m_Platform->WaEnableA64WA();
1442314423
}
1442414424

14425-
void EmitPass::emitGatherA64(CVariable* dst, CVariable* offset, unsigned elemSize, unsigned numElems)
14425+
void EmitPass::emitGatherA64(Value* loadInst, CVariable* dst, CVariable* offset, unsigned elemSize, unsigned numElems)
1442614426
{
1442714427
if (hasA64WAEnable() && !offset->IsUniform()) {
1442814428
CVariable* curMask = nullptr;
@@ -14431,6 +14431,11 @@ void EmitPass::emitGatherA64(CVariable* dst, CVariable* offset, unsigned elemSiz
1443114431
A64LSLoopHead(offset, curMask, lsPred, label);
1443214432

1443314433
// do send with pred
14434+
if (isa<LoadInst>(loadInst) && !m_currShader->IsCoalesced(loadInst))
14435+
{
14436+
// load inst is the single def of the vISA variable and therefore a kill
14437+
m_encoder->Lifetime(LIFETIME_START, dst);
14438+
}
1443414439
m_encoder->SetPredicate(lsPred);
1443514440
m_encoder->GatherA64(dst, offset, elemSize, numElems);
1443614441
m_encoder->Push();
@@ -14442,7 +14447,7 @@ void EmitPass::emitGatherA64(CVariable* dst, CVariable* offset, unsigned elemSiz
1444214447
}
1444314448
}
1444414449

14445-
void EmitPass::emitGather4A64(CVariable* dst, CVariable* offset)
14450+
void EmitPass::emitGather4A64(Value* loadInst, CVariable* dst, CVariable* offset)
1444614451
{
1444714452
if (hasA64WAEnable() && !offset->IsUniform()) {
1444814453
CVariable* curMask = nullptr;
@@ -14451,6 +14456,11 @@ void EmitPass::emitGather4A64(CVariable* dst, CVariable* offset)
1445114456
A64LSLoopHead(offset, curMask, lsPred, label);
1445214457

1445314458
// do send with pred
14459+
if (isa<LoadInst>(loadInst) && !m_currShader->IsCoalesced(loadInst))
14460+
{
14461+
// load inst is the single def of the vISA variable and therefore a kill
14462+
m_encoder->Lifetime(LIFETIME_START, dst);
14463+
}
1445414464
m_encoder->SetPredicate(lsPred);
1445514465
m_encoder->Gather4A64(dst, offset);
1445614466
m_encoder->Push();
@@ -14581,7 +14591,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
1458114591
}
1458214592
else
1458314593
{
14584-
emitGatherA64(gatherDst, eOffset, 8, totalBytes);
14594+
emitGatherA64(inst, gatherDst, eOffset, 8, totalBytes);
1458514595
}
1458614596

1458714597
m_encoder->Push();
@@ -14771,7 +14781,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
1477114781
}
1477214782
else
1477314783
{
14774-
emitGatherA64(gatherDst, gatherOff, blkBits, nBlks);
14784+
emitGatherA64(inst, gatherDst, gatherOff, blkBits, nBlks);
1477514785
}
1477614786
m_encoder->Push();
1477714787

@@ -14849,10 +14859,10 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
1484914859
m_encoder->Gather4Scaled(subLoadDst, resource, addrVarSIMD8);
1485014860
break;
1485114861
case VectorMessage::MESSAGE_A64_UNTYPED_SURFACE_RW:
14852-
emitGather4A64(subLoadDst, addrVarSIMD8);
14862+
emitGather4A64(inst, subLoadDst, addrVarSIMD8);
1485314863
break;
1485414864
case VectorMessage::MESSAGE_A64_SCATTERED_RW:
14855-
emitGatherA64(subLoadDst, addrVarSIMD8, blkBits, numBlks);
14865+
emitGatherA64(inst, subLoadDst, addrVarSIMD8, blkBits, numBlks);
1485614866
break;
1485714867
default:
1485814868
assert(0 && "Somethings wrong!");
@@ -14924,10 +14934,10 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
1492414934
m_encoder->Gather4Scaled(gatherDst, resource, rawAddrVar);
1492514935
break;
1492614936
case VectorMessage::MESSAGE_A64_UNTYPED_SURFACE_RW:
14927-
emitGather4A64(gatherDst, rawAddrVar);
14937+
emitGather4A64(inst, gatherDst, rawAddrVar);
1492814938
break;
1492914939
case VectorMessage::MESSAGE_A64_SCATTERED_RW:
14930-
emitGatherA64(gatherDst, rawAddrVar, blkBits, numBlks);
14940+
emitGatherA64(inst, gatherDst, rawAddrVar, blkBits, numBlks);
1493114941
break;
1493214942
default:
1493314943
assert(false && "Internal Error: unexpected message kind for load!");

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ namespace IGC
636636
bool ignoreRoundingMode(llvm::Instruction* inst) const;
637637

638638
// A64 load/store with HWA that make sure the offset hi part is the same per LS call
639-
void emitGatherA64(CVariable* dst, CVariable* offset, unsigned elemSize, unsigned numElems);
640-
void emitGather4A64(CVariable* dst, CVariable* offset);
639+
void emitGatherA64(llvm::Value* loadInst, CVariable* dst, CVariable* offset, unsigned elemSize, unsigned numElems);
640+
void emitGather4A64(llvm::Value* loadInst, CVariable* dst, CVariable* offset);
641641
void emitScatterA64(CVariable* val, CVariable* offset, unsigned elementSize, unsigned numElems);
642642
void emitScatter4A64(CVariable* src, CVariable* offset);
643643

0 commit comments

Comments
 (0)