Skip to content

Commit 3c5f226

Browse files
ichenkaiigcbot
authored andcommitted
Re-enable dst for lifetime_start in resourec loop header
Re-enable dst for lifetime_start in resourec loop header. Set the condition to benefit compatible workloads.
1 parent 82a1986 commit 3c5f226

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8776,8 +8776,7 @@ void EmitPass::emitGather4Instruction(SamplerGatherIntrinsic *inst) {
87768776
: false;
87778777
uint label = 0;
87788778
CVariable *flag = nullptr;
8779-
CVariable *dest = dst ? dst : m_destination;
8780-
bool needLoop = ResourceLoopHeader(dest, resource, sampler, flag, label);
8779+
bool needLoop = ResourceLoopHeader(dst, resource, sampler, flag, label);
87818780
ResourceLoopSubIteration(resource, sampler, flag, label);
87828781
m_encoder->SetPredicate(flag);
87838782
m_encoder->Gather4Inst(opCode, offset, resource, pairedResource, sampler,
@@ -15963,8 +15962,7 @@ void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst *pInst, Value *dstAddr,
1596315962
}
1596415963
uint label = 0;
1596515964
CVariable *flag = nullptr;
15966-
CVariable *dest = pDst ? pDst : m_destination;
15967-
bool needLoop = ResourceLoopHeader(dest, resource, flag, label);
15965+
bool needLoop = ResourceLoopHeader(pDst, resource, flag, label);
1596815966
ResourceLoopSubIteration(resource, flag, label);
1596915967
if (shouldGenerateLSC(pInst)) {
1597015968
auto cacheOpts = LSC_DEFAULT_CACHING;
@@ -21525,6 +21523,11 @@ bool EmitPass::ResourceLoopHeader(const CVariable *destination,
2152521523
}
2152621524
m_currShader->IncNumSampleBallotLoops();
2152721525

21526+
auto *md = m_pCtx->getModuleMetaData();
21527+
if (destination && IGC_IS_FLAG_ENABLED(EnableResourceLoopDestLifeTimeStart) &&
21528+
!md->compOpt.DisableResourceLoopDestLifeTimeStart) {
21529+
m_encoder->Lifetime(LIFETIME_START, (CVariable *)destination);
21530+
}
2152821531

2152921532
label = m_encoder->GetNewLabelID("_opt_resource_loop");
2153021533
m_encoder->AddDivergentResourceLoopLabel(label);

IGC/common/MDFrameWork.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ enum class ShaderTypeMD
503503
bool DisableLoopUnroll = false;
504504
unsigned ForcePushConstantMode = 0;
505505
bool UseInstructionHoistingOptimization = false;
506+
bool DisableResourceLoopDestLifeTimeStart = false;
506507
};
507508

508509
enum class ThreadIDLayout

IGC/common/igc_flags.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ DECLARE_IGC_REGKEY(bool, DivRemIncrementCondBranchSimplify, false, "Create branc
370370
DECLARE_IGC_REGKEY(bool, EnableInstructionHoistingOptimization, false,
371371
"Enable optimization for hoisting latency instructions",
372372
false)
373+
DECLARE_IGC_REGKEY(bool, EnableResourceLoopDestLifeTimeStart, true,
374+
"Enable lifetime_start set for destination in resource loop",
375+
false)
373376

374377
DECLARE_IGC_GROUP("Shader debugging")
375378
DECLARE_IGC_REGKEY(bool, CopyA0ToDBG0, false, " Copy a0 used for extended msg descriptor to dbg0 to help debug", false)

0 commit comments

Comments
 (0)