Skip to content

Commit 9f32f88

Browse files
jaladreipsigcbot
authored andcommitted
Implement dedicated logic for handling discards in DynamicRayManagementPass
Implement dedicated logic for handling discards in DynamicRayManagementPass
1 parent 9f4f28c commit 9f32f88

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

IGC/AdaptorCommon/RayTracing/DynamicRayManagementPass.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ bool DynamicRayManagementPass::requiresSplittingCheckReleaseRegion(Instruction&
238238
return
239239
isa<ContinuationHLIntrinsic>(I) ||
240240
isBarrierIntrinsic(&I) ||
241-
isUserFunctionCall(&I);
241+
isUserFunctionCall(&I) ||
242+
isDiscardInstruction(&I);
242243
}
243244

244245
void DynamicRayManagementPass::FindProceedsInOperands(Instruction* I, SetVector<TraceRaySyncProceedHLIntrinsic*>& proceeds, SmallPtrSetImpl<Instruction*>& cache)
@@ -993,6 +994,18 @@ void DynamicRayManagementPass::HandleComplexControlFlow(Function& F)
993994
break;
994995
}
995996

997+
if (isDiscardInstruction(&I) && !m_CGCtx->platform.allowDivergentControlFlowRayQueryCheckRelease())
998+
{
999+
rayQueryReleaseIntrinsic->eraseFromParent();
1000+
rayQueryCheckIntrinsic->eraseFromParent();
1001+
1002+
// Remove the pair from the vector in case more Barriers or External
1003+
// calls are between them.
1004+
m_RayQueryCheckReleasePairs.erase(m_RayQueryCheckReleasePairs.begin() + rayQueryCheckReleasePairIndex);
1005+
1006+
break;
1007+
}
1008+
9961009
// The barrier/call instruction is within the RayQueryCheck-Release pair.
9971010
// Insert RayQueryRelease before it, and RaytQueryCheck after, to re-enable
9981011
// Dynamic Ray Management.

IGC/Compiler/CISACodeGen/helper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,11 @@ namespace IGC
16961696
return isUserFunction;
16971697
}
16981698

1699+
bool isDiscardInstruction(const llvm::Instruction* I)
1700+
{
1701+
return isa<GenIntrinsicInst>(I) && cast<GenIntrinsicInst>(I)->getIntrinsicID() == GenISAIntrinsic::GenISA_discard;
1702+
}
1703+
16991704
bool isURBWriteIntrinsic(const llvm::Instruction* I)
17001705
{
17011706
const GenIntrinsicInst* GII = dyn_cast<GenIntrinsicInst>(I);

IGC/Compiler/CISACodeGen/helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ namespace IGC
192192

193193
bool isUserFunctionCall(const llvm::Instruction* I);
194194

195+
bool isDiscardInstruction(const llvm::Instruction* I);
196+
195197
bool IsMemLoadIntrinsic(llvm::GenISAIntrinsic::ID id);
196198

197199
bool IsStatelessMemLoadIntrinsic(llvm::GenISAIntrinsic::ID id);

0 commit comments

Comments
 (0)