Skip to content

Commit e546694

Browse files
jaladreipsigcbot
authored andcommitted
Name some values for ease of debugging
Name some values for ease of debugging
1 parent a5c0d4e commit e546694

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

IGC/AdaptorCommon/RayTracing/NewTraceRayInlineLoweringPass.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,21 @@ bool InlineRaytracing::LowerAllocations(Function &F) {
9898
// create 2 rq objects and select one based on the lane id
9999

100100
auto *rqObject1 =
101-
IRB.CreateCall(createRQObjectFn, UndefValue::get(IRB.getInt32Ty()));
101+
IRB.CreateCall(createRQObjectFn, UndefValue::get(IRB.getInt32Ty()),
102+
VALUE_NAME("RQObject"));
102103
auto *rqObject2 =
103-
IRB.CreateCall(createRQObjectFn, UndefValue::get(IRB.getInt32Ty()));
104+
IRB.CreateCall(createRQObjectFn, UndefValue::get(IRB.getInt32Ty()),
105+
VALUE_NAME("RQObject"));
104106

105107
auto *laneId = IRB.get32BitLaneID();
106108
auto *cond =
107109
IRB.CreateICmpULT(laneId, IRB.getInt32(numLanes(SIMDMode::SIMD16)));
108110
rqObject =
109-
IRB.CreateSelect(cond, rqObject1, rqObject2, VALUE_NAME("rqObject"));
111+
IRB.CreateSelect(cond, rqObject1, rqObject2, VALUE_NAME("RQObject"));
110112
} else {
111113
rqObject =
112-
IRB.CreateCall(createRQObjectFn, UndefValue::get(IRB.getInt32Ty()));
114+
IRB.CreateCall(createRQObjectFn, UndefValue::get(IRB.getInt32Ty()),
115+
VALUE_NAME("RQObject"));
113116
}
114117

115118
// iniitalize it to done so when app calls proceed without tracerayinline,
@@ -147,7 +150,8 @@ bool InlineRaytracing::LowerAllocations(Function &F) {
147150

148151
IRB.SetInsertPoint(genI);
149152
auto *RQHandle = IRB.CreateCall(getRQHandleFromRQObjectFn,
150-
{v2vMap[use->get()], I->getFlags()});
153+
{v2vMap[use->get()], I->getFlags()},
154+
VALUE_NAME("RQHandle"));
151155
use->set(RQHandle);
152156

153157
v2vMap[genI] = genI;
@@ -175,7 +179,8 @@ bool InlineRaytracing::LowerAllocations(Function &F) {
175179
cast<ArrayType>(array->getAllocatedType())->getNumElements());
176180

177181
IRB.SetInsertPoint(array);
178-
auto *newArray = IRB.CreateAlloca(ty);
182+
auto *newArray = IRB.CreateAlloca(ty, nullptr, array->getName(),
183+
array->getAddressSpace());
179184
v2vMap[array] = newArray;
180185

181186
llvm::for_each(array->uses(),
@@ -201,15 +206,15 @@ bool InlineRaytracing::LowerAllocations(Function &F) {
201206
SmallVector<Value *> indices(cast<GetElementPtrInst>(II)->indices());
202207

203208
IRB.SetInsertPoint(II);
204-
v2vMap[II] =
205-
IRB.CreateInBoundsGEP(array->getAllocatedType(), array, indices);
209+
v2vMap[II] = IRB.CreateInBoundsGEP(array->getAllocatedType(), array,
210+
indices, II->getName());
206211
llvm::for_each(II->uses(),
207212
[&worklist](Use &U) { worklist.push_back(&U); });
208213
} break;
209214
case Instruction::Load:
210215
IRB.SetInsertPoint(II);
211216
v2vMap[II] = IRB.CreateLoad(m_RQObjectType->getPointerTo(),
212-
v2vMap[II->getOperand(0)]);
217+
v2vMap[II->getOperand(0)], II->getName());
213218
llvm::for_each(II->uses(),
214219
[&worklist](Use &U) { worklist.push_back(&U); });
215220
break;
@@ -222,7 +227,7 @@ bool InlineRaytracing::LowerAllocations(Function &F) {
222227
IRB.SetInsertPoint(II);
223228
v2vMap[II] =
224229
IRB.CreateSelect(II->getOperand(0), v2vMap[II->getOperand(1)],
225-
v2vMap[II->getOperand(2)]);
230+
v2vMap[II->getOperand(2)], II->getName());
226231
llvm::for_each(II->uses(),
227232
[&worklist](Use &U) { worklist.push_back(&U); });
228233
break;
@@ -585,7 +590,8 @@ void InlineRaytracing::LowerIntrinsics(Function &F) {
585590
auto *I = cast<RayQueryInfoIntrinsic>(RQI);
586591
auto data = getPackedData(IRB, rqObject);
587592
auto *loadCommittedFromPotential = IRB.CreateICmpEQ(
588-
data.CommittedDataLocation, IRB.getInt32(PotentialHit));
593+
data.CommittedDataLocation, IRB.getInt32(PotentialHit),
594+
VALUE_NAME("loadCommittedInfoFromPotentialHit"));
589595

590596
auto *shaderTy = IRB.CreateSelect(
591597
loadCommittedFromPotential, IRB.getInt32(AnyHit),

IGC/AdaptorCommon/RayTracing/RTBuilder.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,19 +761,22 @@ Value* RTBuilder::getObjRayOrig(
761761
auto* newI = I->clone();
762762
Insert(newI);
763763
auto* isClosestHitV = this->TransformWorldToObject(perLaneStackPtr, dim, true, ShaderTy, newI, checkInstanceLeafPtr);
764+
isClosestHitV->setName(VALUE_NAME("isClosestHitV"));
764765
newI->eraseFromParent();
765766

766767
auto* isMissBB = BasicBlock::Create(Context, VALUE_NAME("isMissBB"), IP->getFunction(), bb);
767768
SetInsertPoint(isMissBB);
768769
auto* isMissBBTerm = CreateBr(bb);
769770
SetInsertPoint(isMissBBTerm);
770771
auto* isMissV = getWorldRayOrig(perLaneStackPtr, dim);
772+
isMissV->setName(VALUE_NAME("isMissV"));
771773

772774
auto* defaultBB = BasicBlock::Create(Context, VALUE_NAME("default"), IP->getFunction(), bb);
773775
SetInsertPoint(defaultBB);
774776
auto* defaultBBTerm = CreateBr(bb);
775777
SetInsertPoint(defaultBBTerm);
776778
auto* defaultV = getMemRayOrig(perLaneStackPtr, dim, BOTTOM_LEVEL_BVH, VALUE_NAME("ObjRayOrig[" + Twine(dim) + "]"));
779+
defaultV->setName(VALUE_NAME("defaultV"));
777780

778781
// create switch statement
779782
oldBB->getTerminator()->eraseFromParent();

0 commit comments

Comments
 (0)