Skip to content

Commit d8d2101

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: f3e8665: Internal changes
Internal changes
1 parent f3e8665 commit d8d2101

File tree

6 files changed

+34
-73
lines changed

6 files changed

+34
-73
lines changed

IGC/AdaptorCommon/RayTracing/AutoGenRTStackAccessPrivateOS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,7 @@ auto* _getObjWorldAndWorldObj_Xe(Value* arg_0, Value* arg_1, Value* arg_2, Value
19761976
SetInsertPoint(BB_5);
19771977
auto* V_31 = CreateAnd(arg_1, getInt32(3));
19781978
auto* V_32 = CreateICmpEQ(V_31, getInt32(0));
1979-
auto* V_33 = CreateSelect(V_32, ConstantFP::get(*Ctx.getLLVMContext(), APFloat(APFloat::IEEEsingle(), APInt(32, 0x3f800000))), ConstantFP::get(*Ctx.getLLVMContext(), APFloat(APFloat::IEEEsingle(), APInt(32, 0x0))));
1979+
auto* V_33 = CreateSelect(V_32, ConstantFP::get(*Ctx.getLLVMContext(), APFloat(APFloat::IEEEsingle(), APInt(32, 0x0))), ConstantFP::get(*Ctx.getLLVMContext(), APFloat(APFloat::IEEEsingle(), APInt(32, 0x3f800000))));
19801980
CreateBr(BB_7);
19811981
V_30->addIncoming(V_29, BB_6);
19821982
V_30->addIncoming(V_33, BB_5);
@@ -2023,7 +2023,7 @@ auto* _getObjWorldAndWorldObj_Xe3(Value* arg_0, Value* arg_1, Value* arg_2, Valu
20232023
SetInsertPoint(BB_5);
20242024
auto* V_29 = CreateAnd(arg_1, getInt32(3));
20252025
auto* V_30 = CreateICmpEQ(V_29, getInt32(0));
2026-
auto* V_31 = CreateSelect(V_30, ConstantFP::get(*Ctx.getLLVMContext(), APFloat(APFloat::IEEEsingle(), APInt(32, 0x3f800000))), ConstantFP::get(*Ctx.getLLVMContext(), APFloat(APFloat::IEEEsingle(), APInt(32, 0x0))));
2026+
auto* V_31 = CreateSelect(V_30, ConstantFP::get(*Ctx.getLLVMContext(), APFloat(APFloat::IEEEsingle(), APInt(32, 0x0))), ConstantFP::get(*Ctx.getLLVMContext(), APFloat(APFloat::IEEEsingle(), APInt(32, 0x3f800000))));
20272027
CreateBr(BB_7);
20282028
V_28->addIncoming(V_27, BB_6);
20292029
V_28->addIncoming(V_31, BB_5);

IGC/AdaptorCommon/RayTracing/RTBuilder.cpp

Lines changed: 32 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -729,45 +729,29 @@ Value* RTBuilder::getObjRayOrig(
729729
RTBuilder::StackPointerVal* perLaneStackPtr, uint32_t dim, Value* ShaderTy,
730730
Instruction* I, bool checkInstanceLeafPtr)
731731
{
732-
732+
auto* transformWorldToObject = CreateOr(
733+
{
734+
CreateICmpEQ(ShaderTy, getInt32(CallableShaderTypeMD::ClosestHit)),
735+
}
736+
);
737+
Instruction* trueTerm = nullptr;
738+
Instruction* falseTerm = nullptr;
733739
auto* IP = &*GetInsertPoint();
740+
SplitBlockAndInsertIfThenElse(transformWorldToObject, IP, &trueTerm, &falseTerm);
734741

735-
auto* oldBB = IP->getParent();
736-
auto* bb = SplitBlock(oldBB, IP);
737-
738-
auto* isClosestHitBB = BasicBlock::Create(*Ctx.getLLVMContext(), VALUE_NAME("isClosestHitBB"), IP->getFunction(), bb);
739-
SetInsertPoint(isClosestHitBB);
740-
auto* isClosestHitBBTerm = CreateBr(bb); // we have to do this because the functions we call are going to split the block again...
741-
SetInsertPoint(isClosestHitBBTerm);
742+
SetInsertPoint(trueTerm);
742743
auto* newI = I->clone();
743-
Insert(newI);
744-
auto* isClosestHitV = this->TransformWorldToObject(perLaneStackPtr, dim, true, ShaderTy, newI, checkInstanceLeafPtr);
744+
newI->insertBefore(trueTerm);
745+
auto* trueV = this->TransformWorldToObject(perLaneStackPtr, dim, true, ShaderTy, newI, checkInstanceLeafPtr);
745746
newI->eraseFromParent();
746747

747-
auto* isMissBB = BasicBlock::Create(Context, VALUE_NAME("isMissBB"), IP->getFunction(), bb);
748-
SetInsertPoint(isMissBB);
749-
auto* isMissBBTerm = CreateBr(bb);
750-
SetInsertPoint(isMissBBTerm);
751-
auto* isMissV = getWorldRayOrig(perLaneStackPtr, dim);
752-
753-
auto* defaultBB = BasicBlock::Create(Context, VALUE_NAME("default"), IP->getFunction(), bb);
754-
SetInsertPoint(defaultBB);
755-
auto* defaultBBTerm = CreateBr(bb);
756-
SetInsertPoint(defaultBBTerm);
757-
auto* defaultV = getMemRayOrig(perLaneStackPtr, dim, BOTTOM_LEVEL_BVH, VALUE_NAME("ObjRayOrig[" + Twine(dim) + "]"));
758-
759-
// create switch statement
760-
oldBB->getTerminator()->eraseFromParent();
761-
SetInsertPoint(oldBB);
762-
auto* switchI = CreateSwitch(ShaderTy, defaultBB);
763-
switchI->addCase(getInt32(Miss), isMissBB);
764-
switchI->addCase(getInt32(ClosestHit), isClosestHitBB);
748+
SetInsertPoint(falseTerm);
749+
auto* falseV = getMemRayOrig(perLaneStackPtr, dim, BOTTOM_LEVEL_BVH, VALUE_NAME("ObjRayOrig[" + Twine(dim) + "]"));
765750

766751
SetInsertPoint(IP);
767-
auto* info = CreatePHI(isClosestHitV->getType(), 3);
768-
info->addIncoming(isClosestHitV, isClosestHitBBTerm->getParent());
769-
info->addIncoming(isMissV, isMissBBTerm->getParent());
770-
info->addIncoming(defaultV, defaultBBTerm->getParent());
752+
auto* info = CreatePHI(trueV->getType(), 2);
753+
info->addIncoming(trueV, trueTerm->getParent());
754+
info->addIncoming(falseV, falseTerm->getParent());
771755

772756
return info;
773757
}
@@ -776,45 +760,29 @@ Value* RTBuilder::getObjRayDir(
776760
RTBuilder::StackPointerVal* perLaneStackPtr, uint32_t dim, Value* ShaderTy,
777761
Instruction* I, bool checkInstanceLeafPtr)
778762
{
779-
763+
auto* transformWorldToObject = CreateOr(
764+
{
765+
CreateICmpEQ(ShaderTy, getInt32(CallableShaderTypeMD::ClosestHit)),
766+
}
767+
);
768+
Instruction* trueTerm = nullptr;
769+
Instruction* falseTerm = nullptr;
780770
auto* IP = &*GetInsertPoint();
771+
SplitBlockAndInsertIfThenElse(transformWorldToObject, IP, &trueTerm, &falseTerm);
781772

782-
auto* oldBB = IP->getParent();
783-
auto* bb = SplitBlock(oldBB, IP);
784-
785-
auto* isClosestHitBB = BasicBlock::Create(*Ctx.getLLVMContext(), VALUE_NAME("isClosestHitBB"), IP->getFunction(), bb);
786-
SetInsertPoint(isClosestHitBB);
787-
auto* isClosestHitBBTerm = CreateBr(bb); // we have to do this because the functions we call are going to split the block again...
788-
SetInsertPoint(isClosestHitBBTerm);
773+
SetInsertPoint(trueTerm);
789774
auto* newI = I->clone();
790-
Insert(newI);
791-
auto* isClosestHitV = this->TransformWorldToObject(perLaneStackPtr, dim, false, ShaderTy, newI, checkInstanceLeafPtr);
775+
newI->insertBefore(trueTerm);
776+
auto* trueV = this->TransformWorldToObject(perLaneStackPtr, dim, false, ShaderTy, newI, checkInstanceLeafPtr);
792777
newI->eraseFromParent();
793778

794-
auto* isMissBB = BasicBlock::Create(Context, VALUE_NAME("isMissBB"), IP->getFunction(), bb);
795-
SetInsertPoint(isMissBB);
796-
auto* isMissBBTerm = CreateBr(bb);
797-
SetInsertPoint(isMissBBTerm);
798-
auto* isMissV = getWorldRayDir(perLaneStackPtr, dim);
799-
800-
auto* defaultBB = BasicBlock::Create(Context, VALUE_NAME("default"), IP->getFunction(), bb);
801-
SetInsertPoint(defaultBB);
802-
auto* defaultBBTerm = CreateBr(bb);
803-
SetInsertPoint(defaultBBTerm);
804-
auto* defaultV = getMemRayDir(perLaneStackPtr, dim, BOTTOM_LEVEL_BVH, VALUE_NAME("ObjRayDir[" + Twine(dim) + "]"));
805-
806-
// create switch statement
807-
oldBB->getTerminator()->eraseFromParent();
808-
SetInsertPoint(oldBB);
809-
auto* switchI = CreateSwitch(ShaderTy, defaultBB);
810-
switchI->addCase(getInt32(Miss), isMissBB);
811-
switchI->addCase(getInt32(ClosestHit), isClosestHitBB);
779+
SetInsertPoint(falseTerm);
780+
auto* falseV = getMemRayDir(perLaneStackPtr, dim, BOTTOM_LEVEL_BVH, VALUE_NAME("ObjRayDir[" + Twine(dim) + "]"));
812781

813782
SetInsertPoint(IP);
814-
auto* info = CreatePHI(isClosestHitV->getType(), 3);
815-
info->addIncoming(isClosestHitV, isClosestHitBBTerm->getParent());
816-
info->addIncoming(isMissV, isMissBBTerm->getParent());
817-
info->addIncoming(defaultV, defaultBBTerm->getParent());
783+
auto* info = CreatePHI(trueV->getType(), 2);
784+
info->addIncoming(trueV, trueTerm->getParent());
785+
info->addIncoming(falseV, falseTerm->getParent());
818786

819787
return info;
820788
}

IGC/AdaptorCommon/RayTracing/RayTracingInterface.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ SPDX-License-Identifier: MIT
2121
#include "AdaptorCommon/RayTracing/RayTracingAddressSpaceAliasAnalysis.h"
2222
#include "AdaptorCommon/AddImplicitArgs.hpp"
2323
#include "AdaptorCommon/ProcessFuncAttributes.h"
24-
#include "AdaptorOCL/MoveStaticAllocas.h"
2524
#include "Compiler/CISACodeGen/CodeSinking.hpp"
2625
#include "Compiler/CISACodeGen/helper.h"
2726
#include "Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryUsageAnalysis.hpp"

IGC/AdaptorCommon/RayTracing/TraceRayInlineLoweringPass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ void TraceRayInlineLoweringPass::LowerAllocateRayQuery(
206206

207207
for (auto* I : convertRayQueryToRTStackPointers)
208208
{
209-
builder.SetInsertPoint(I);
210209
auto* rtstack = getShMemRayQueryRTStack(builder, I->getRayQueryAllocationHandle());
211210
I->replaceAllUsesWith(rtstack);
212211
}

IGC/GenISAIntrinsics/GenIntrinsicInst.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,6 @@ class TraceRayAsyncHLIntrinsic : public ContinuationHLIntrinsic {
14631463
void setTMax(Value* V) { setOperand(15, V); }
14641464
Value* getPayload() const { return getOperand(16); }
14651465
Value* getComparisonValue() const { return getOperand(17); }
1466-
Value* getInternalRayFlags() const { return getOperand(18); }
14671466
};
14681467

14691468
class CallShaderHLIntrinsic : public ContinuationHLIntrinsic {

IGC/GenISAIntrinsics/generator/input/Intrinsic_definitions.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11464,10 +11464,6 @@ intrinsics:
1146411464
comment: "reserved"
1146511465
- !<ArgumentDefinition>
1146611466
name: Arg18
11467-
type_definition: *i32
11468-
comment: "reserved"
11469-
- !<ArgumentDefinition>
11470-
name: Arg19
1147111467
type_definition: *f32
1147211468
comment: "reserved"
1147311469
attributes:

0 commit comments

Comments
 (0)