From 28f46381fc15f5708170b4b489b72eaa004fea64 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 15:01:03 -0800 Subject: [PATCH 01/11] Reserve GetGroupWaveIndex/Count HL and DXIL ops This change reserves HLSL intrinsic HL opcodes and experimental DXIL ops for GetGroupWaveIndex and GetGroupWaveCount for SM 6.10. --- docs/DXIL.rst | 12 ++++---- include/dxc/DXIL/DxilConstants.h | 16 +++++++++-- include/dxc/DXIL/DxilInstructions.h | 40 +++++++++++++++++++++++++++ include/dxc/HlslIntrinsicOp.h | 4 ++- lib/DXIL/DxilOperations.cpp | 35 +++++++++++++++++++++-- lib/HLSL/HLOperationLower.cpp | 2 ++ utils/hct/gen_intrin_main.txt | 2 ++ utils/hct/hctdb.py | 25 ++++++++++++++++- utils/hct/hlsl_intrinsic_opcodes.json | 6 ++-- 9 files changed, 129 insertions(+), 13 deletions(-) diff --git a/docs/DXIL.rst b/docs/DXIL.rst index 29e198610f..a322b76fb3 100644 --- a/docs/DXIL.rst +++ b/docs/DXIL.rst @@ -3062,11 +3062,13 @@ Given width, offset: Opcode Table ExperimentalOps, id=32768: Experimental DXIL operations -========== =============== ================ -ID Name Description -========== =============== ================ -2147483648 ExperimentalNop nop does nothing -========== =============== ================ +========== ================= ================================================= +ID Name Description +========== ================= ================================================= +2147483648 ExperimentalNop nop does nothing +2147483649 GetGroupWaveIndex returns the index of the wave in the thread group +2147483650 GetGroupWaveCount returns the number of waves in the thread group +========== ================= ================================================= .. OPCODES-RST:END diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index 6f1f1d66ea..b50aff9da8 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -514,7 +514,11 @@ enum class OpCode : unsigned { // No-op ExperimentalNop = 0, // nop does nothing - NumOpCodes = 1, // exclusive last value of enumeration + // Wave + GetGroupWaveCount = 2, // returns the number of waves in the thread group + GetGroupWaveIndex = 1, // returns the index of the wave in the thread group + + NumOpCodes = 3, // exclusive last value of enumeration }; } // namespace ExperimentalOps static const unsigned NumOpCodeTables = 2; @@ -1131,6 +1135,12 @@ enum class OpCode : unsigned { // OpCodeTableID = 32768 // ExperimentalOps EXP_OPCODE(ExperimentalOps, ExperimentalNop), // nop does nothing + EXP_OPCODE( + ExperimentalOps, + GetGroupWaveIndex), // returns the index of the wave in the thread group + EXP_OPCODE( + ExperimentalOps, + GetGroupWaveCount), // returns the number of waves in the thread group }; // OPCODE-ENUM:END #undef EXP_OPCODE @@ -1440,6 +1450,8 @@ enum class OpCodeClass : unsigned { VectorReduce, // Wave + GetGroupWaveCount, + GetGroupWaveIndex, WaveActiveAllEqual, WaveActiveBallot, WaveActiveBit, @@ -1465,7 +1477,7 @@ enum class OpCodeClass : unsigned { NodeOutputIsValid, OutputComplete, - NumOpClasses = 197, // exclusive last value of enumeration + NumOpClasses = 199, // exclusive last value of enumeration }; // OPCODECLASS-ENUM:END diff --git a/include/dxc/DXIL/DxilInstructions.h b/include/dxc/DXIL/DxilInstructions.h index 52a3efaaac..52675d3b76 100644 --- a/include/dxc/DXIL/DxilInstructions.h +++ b/include/dxc/DXIL/DxilInstructions.h @@ -10251,5 +10251,45 @@ struct DxilInst_ExperimentalNop { // Metadata bool requiresUniformInputs() const { return false; } }; + +/// This instruction returns the index of the wave in the thread group +struct DxilInst_GetGroupWaveIndex { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_GetGroupWaveIndex(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst(Instr, + hlsl::OP::OpCode::GetGroupWaveIndex); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (1 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } +}; + +/// This instruction returns the number of waves in the thread group +struct DxilInst_GetGroupWaveCount { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_GetGroupWaveCount(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst(Instr, + hlsl::OP::OpCode::GetGroupWaveCount); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (1 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } +}; // INSTR-HELPER:END } // namespace hlsl diff --git a/include/dxc/HlslIntrinsicOp.h b/include/dxc/HlslIntrinsicOp.h index e1c1b3e7f5..19f54ea6c0 100644 --- a/include/dxc/HlslIntrinsicOp.h +++ b/include/dxc/HlslIntrinsicOp.h @@ -25,6 +25,8 @@ enum class IntrinsicOp { IOP_EvaluateAttributeSnapped = 17, IOP_GeometryIndex = 18, IOP_GetAttributeAtVertex = 19, + IOP_GetGroupWaveCount = 395, + IOP_GetGroupWaveIndex = 396, IOP_GetRemainingRecursionLevels = 20, IOP_GetRenderTargetSampleCount = 21, IOP_GetRenderTargetSamplePosition = 22, @@ -401,7 +403,7 @@ enum class IntrinsicOp { IOP_usign = 355, MOP_InterlockedUMax = 356, MOP_InterlockedUMin = 357, - Num_Intrinsics = 395, + Num_Intrinsics = 397, }; inline bool HasUnsignedIntrinsicOpcode(IntrinsicOp opcode) { switch (opcode) { diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index e03682959a..d0aed70b00 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -2728,6 +2728,24 @@ static const OP::OpCodeProperty ExperimentalOps_OpCodeProps[] = { 0, {}, {}}, // Overloads: v + + // Wave + {OC::GetGroupWaveIndex, + "GetGroupWaveIndex", + OCC::GetGroupWaveIndex, + "getGroupWaveIndex", + Attribute::ReadNone, + 0, + {}, + {}}, // Overloads: v + {OC::GetGroupWaveCount, + "GetGroupWaveCount", + OCC::GetGroupWaveCount, + "getGroupWaveCount", + Attribute::ReadNone, + 0, + {}, + {}}, // Overloads: v }; static_assert(_countof(ExperimentalOps_OpCodeProps) == (size_t)DXIL::ExperimentalOps::OpCode::NumOpCodes, @@ -3636,8 +3654,9 @@ void OP::GetMinShaderModelAndMask(OpCode C, bool bWithTranslation, return; } // Instructions: MatVecMul=305, MatVecMulAdd=306, OuterProductAccumulate=307, - // VectorAccumulate=308, ExperimentalNop=2147483648 - if ((305 <= op && op <= 308) || op == 2147483648) { + // VectorAccumulate=308, ExperimentalNop=2147483648, + // GetGroupWaveIndex=2147483649, GetGroupWaveCount=2147483650 + if ((305 <= op && op <= 308) || (2147483648 <= op && op <= 2147483650)) { major = 6; minor = 10; return; @@ -6147,6 +6166,16 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pV); A(pI32); break; + + // Wave + case OpCode::GetGroupWaveIndex: + A(pI32); + A(pI32); + break; + case OpCode::GetGroupWaveCount: + A(pI32); + A(pI32); + break; // OPCODE-OLOAD-FUNCS:END default: DXASSERT(false, "otherwise unhandled case"); @@ -6438,6 +6467,8 @@ llvm::Type *OP::GetOverloadType(OpCode opCode, llvm::Function *F) { case OpCode::ReservedC8: case OpCode::ReservedC9: case OpCode::ExperimentalNop: + case OpCode::GetGroupWaveIndex: + case OpCode::GetGroupWaveCount: return Type::getVoidTy(Ctx); case OpCode::CheckAccessFullyMapped: case OpCode::SampleIndex: diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index c9c9bb4c88..f14b17e3a7 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -7513,6 +7513,8 @@ IntrinsicLower gLowerTable[] = { {IntrinsicOp::IOP___builtin_VectorAccumulate, TranslateVectorAccumulate, DXIL::OpCode::VectorAccumulate}, {IntrinsicOp::IOP_isnormal, TrivialIsSpecialFloat, DXIL::OpCode::IsNormal}, + {IntrinsicOp::IOP_GetGroupWaveIndex, EmptyLower, DXIL::OpCode::GetGroupWaveIndex}, + {IntrinsicOp::IOP_GetGroupWaveCount, EmptyLower, DXIL::OpCode::GetGroupWaveCount}, }; } // namespace static_assert( diff --git a/utils/hct/gen_intrin_main.txt b/utils/hct/gen_intrin_main.txt index 3fb30781b0..c495dff1d1 100644 --- a/utils/hct/gen_intrin_main.txt +++ b/utils/hct/gen_intrin_main.txt @@ -303,6 +303,8 @@ $type1 [[]] QuadReadAcrossY(in numeric<> value); $type1 [[]] QuadReadAcrossDiagonal(in numeric<> value); bool [[]] QuadAny(in bool cond); bool [[]] QuadAll(in bool cond); +uint [[rn]] GetGroupWaveIndex(); +uint [[rn]] GetGroupWaveCount(); // Raytracing void [[]] TraceRay(in acceleration_struct AccelerationStructure, in uint RayFlags, in uint InstanceInclusionMask, in uint RayContributionToHitGroupIndex, in uint MultiplierForGeometryContributionToHitGroupIndex, in uint MissShaderIndex, in ray_desc Ray, inout udt Payload); diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 490ce8080f..7af922ad88 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1046,6 +1046,9 @@ def populate_categories_and_models_ExperimentalOps(self): for i in "ExperimentalNop".split(","): self.name_idx[i].category = "No-op" self.name_idx[i].shader_model = 6, 10 + for i in "GetGroupWaveIndex,GetGroupWaveCount".split(","): + self.name_idx[i].category = "Wave" + self.name_idx[i].shader_model = 6, 10 def populate_llvm_instructions(self): # Add instructions that map to LLVM instructions. @@ -6063,8 +6066,10 @@ def populate_ExperimentalOps(self): op_table = self.add_dxil_op_table( 0x8000, "ExperimentalOps", "Experimental DXIL operations" ) + add_dxil_op = op_table.add_dxil_op + # Add Nop to test experimental table infrastructure. - op_table.add_dxil_op( + add_dxil_op( "ExperimentalNop", "Nop", "nop does nothing", @@ -6075,6 +6080,24 @@ def populate_ExperimentalOps(self): ], ) + # Group Wave Operations + add_dxil_op( + "GetGroupWaveIndex", + "GetGroupWaveIndex", + "returns the index of the wave in the thread group", + "v", + "rn", + [db_dxil_param(0, "i32", "", "operation result")], + ) + add_dxil_op( + "GetGroupWaveCount", + "GetGroupWaveCount", + "returns the number of waves in the thread group", + "v", + "rn", + [db_dxil_param(0, "i32", "", "operation result")], + ) + def finalize_dxil_operations(self): "Finalize DXIL operations by setting properties and verifying consistency." diff --git a/utils/hct/hlsl_intrinsic_opcodes.json b/utils/hct/hlsl_intrinsic_opcodes.json index eb22fd7464..793b17c822 100644 --- a/utils/hct/hlsl_intrinsic_opcodes.json +++ b/utils/hct/hlsl_intrinsic_opcodes.json @@ -1,6 +1,6 @@ { "IntrinsicOpCodes": { - "Num_Intrinsics": 395, + "Num_Intrinsics": 397, "IOP_AcceptHitAndEndSearch": 0, "IOP_AddUint64": 1, "IOP_AllMemoryBarrier": 2, @@ -395,6 +395,8 @@ "IOP___builtin_MatVecMulAdd": 391, "IOP___builtin_OuterProductAccumulate": 392, "IOP___builtin_VectorAccumulate": 393, - "IOP_isnormal": 394 + "IOP_isnormal": 394, + "IOP_GetGroupWaveCount": 395, + "IOP_GetGroupWaveIndex": 396 } } From 4b966013ab9824b7634ddc82fd7bd90671251615 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 15:58:58 -0800 Subject: [PATCH 02/11] Reserve ClusterID and TriangleObjectPosition HLSL and DXIL ops Note: TriangleObjectPosition requires a new DXIL intrinsic type mapping, so the operations currently return void, with TODOs for updating signatures. --- docs/DXIL.rst | 22 ++- include/dxc/DXIL/DxilConstants.h | 57 ++++++- include/dxc/DXIL/DxilInstructions.h | 208 ++++++++++++++++++++++++++ include/dxc/HlslIntrinsicOp.h | 10 +- lib/DXIL/DxilOperations.cpp | 160 +++++++++++++++++++- lib/HLSL/HLOperationLower.cpp | 12 ++ utils/hct/gen_intrin_main.txt | 12 ++ utils/hct/hctdb.py | 157 ++++++++++++++++++- utils/hct/hlsl_intrinsic_opcodes.json | 12 +- 9 files changed, 630 insertions(+), 20 deletions(-) diff --git a/docs/DXIL.rst b/docs/DXIL.rst index a322b76fb3..6b714f6d81 100644 --- a/docs/DXIL.rst +++ b/docs/DXIL.rst @@ -3062,13 +3062,21 @@ Given width, offset: Opcode Table ExperimentalOps, id=32768: Experimental DXIL operations -========== ================= ================================================= -ID Name Description -========== ================= ================================================= -2147483648 ExperimentalNop nop does nothing -2147483649 GetGroupWaveIndex returns the index of the wave in the thread group -2147483650 GetGroupWaveCount returns the number of waves in the thread group -========== ================= ================================================= +========== ======================================== ================================================================== +ID Name Description +========== ======================================== ================================================================== +2147483648 ExperimentalNop nop does nothing +2147483649 GetGroupWaveIndex returns the index of the wave in the thread group +2147483650 GetGroupWaveCount returns the number of waves in the thread group +2147483651 ClusterID Returns the user-defined ClusterID of the intersected CLAS +2147483652 RayQuery_CandidateClusterID returns candidate hit cluster ID +2147483653 RayQuery_CommittedClusterID returns committed hit cluster ID +2147483654 HitObject_ClusterID Returns the cluster ID of this committed hit +2147483655 TriangleObjectPosition Returns triangle vertices in object space as <9 x float> +2147483656 RayQuery_CandidateTriangleObjectPosition Returns candidate triangle vertices in object space as <9 x float> +2147483657 RayQuery_CommittedTriangleObjectPosition Returns committed triangle vertices in object space as <9 x float> +2147483658 HitObject_TriangleObjectPosition Returns triangle vertices in object space as <9 x float> +========== ======================================== ================================================================== .. OPCODES-RST:END diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index b50aff9da8..6ff6e099d3 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -511,14 +511,34 @@ namespace ExperimentalOps { static const OpCodeTableID TableID = OpCodeTableID::ExperimentalOps; // Enumeration for ExperimentalOps DXIL operations enum class OpCode : unsigned { + // Inline Ray Query + RayQuery_CandidateClusterID = 4, // returns candidate hit cluster ID + RayQuery_CandidateTriangleObjectPosition = + 8, // Returns candidate triangle vertices in object space as <9 x float> + RayQuery_CommittedClusterID = 5, // returns committed hit cluster ID + RayQuery_CommittedTriangleObjectPosition = + 9, // Returns committed triangle vertices in object space as <9 x float> + // No-op ExperimentalNop = 0, // nop does nothing + // Raytracing System Values + TriangleObjectPosition = + 7, // Returns triangle vertices in object space as <9 x float> + + // Raytracing uint System Values + ClusterID = 3, // Returns the user-defined ClusterID of the intersected CLAS + + // Shader Execution Reordering + HitObject_ClusterID = 6, // Returns the cluster ID of this committed hit + HitObject_TriangleObjectPosition = + 10, // Returns triangle vertices in object space as <9 x float> + // Wave GetGroupWaveCount = 2, // returns the number of waves in the thread group GetGroupWaveIndex = 1, // returns the index of the wave in the thread group - NumOpCodes = 3, // exclusive last value of enumeration + NumOpCodes = 11, // exclusive last value of enumeration }; } // namespace ExperimentalOps static const unsigned NumOpCodeTables = 2; @@ -1141,6 +1161,32 @@ enum class OpCode : unsigned { EXP_OPCODE( ExperimentalOps, GetGroupWaveCount), // returns the number of waves in the thread group + EXP_OPCODE( + ExperimentalOps, + ClusterID), // Returns the user-defined ClusterID of the intersected CLAS + EXP_OPCODE(ExperimentalOps, + RayQuery_CandidateClusterID), // returns candidate hit cluster ID + EXP_OPCODE(ExperimentalOps, + RayQuery_CommittedClusterID), // returns committed hit cluster ID + EXP_OPCODE( + ExperimentalOps, + HitObject_ClusterID), // Returns the cluster ID of this committed hit + EXP_OPCODE(ExperimentalOps, + TriangleObjectPosition), // Returns triangle vertices in object + // space as <9 x float> + EXP_OPCODE( + ExperimentalOps, + RayQuery_CandidateTriangleObjectPosition), // Returns candidate triangle + // vertices in object space as + // <9 x float> + EXP_OPCODE( + ExperimentalOps, + RayQuery_CommittedTriangleObjectPosition), // Returns committed triangle + // vertices in object space as + // <9 x float> + EXP_OPCODE(ExperimentalOps, + HitObject_TriangleObjectPosition), // Returns triangle vertices in + // object space as <9 x float> }; // OPCODE-ENUM:END #undef EXP_OPCODE @@ -1271,8 +1317,10 @@ enum class OpCodeClass : unsigned { AllocateRayQuery, AllocateRayQuery2, RayQuery_Abort, + RayQuery_CandidateTriangleObjectPosition, RayQuery_CommitNonOpaqueTriangleHit, RayQuery_CommitProceduralPrimitiveHit, + RayQuery_CommittedTriangleObjectPosition, RayQuery_Proceed, RayQuery_StateMatrix, RayQuery_StateScalar, @@ -1349,6 +1397,9 @@ enum class OpCodeClass : unsigned { RayTCurrent, RayTMin, + // Raytracing System Values + TriangleObjectPosition, + // Raytracing hit uint System Values HitKind, @@ -1361,6 +1412,7 @@ enum class OpCodeClass : unsigned { PrimitiveIndex, // Raytracing uint System Values + ClusterID, RayFlags, // Resources - gather @@ -1416,6 +1468,7 @@ enum class OpCodeClass : unsigned { HitObject_StateScalar, HitObject_StateVector, HitObject_TraceRay, + HitObject_TriangleObjectPosition, MaybeReorderThread, // Synchronization @@ -1477,7 +1530,7 @@ enum class OpCodeClass : unsigned { NodeOutputIsValid, OutputComplete, - NumOpClasses = 199, // exclusive last value of enumeration + NumOpClasses = 204, // exclusive last value of enumeration }; // OPCODECLASS-ENUM:END diff --git a/include/dxc/DXIL/DxilInstructions.h b/include/dxc/DXIL/DxilInstructions.h index 52675d3b76..b700fe1c0c 100644 --- a/include/dxc/DXIL/DxilInstructions.h +++ b/include/dxc/DXIL/DxilInstructions.h @@ -10291,5 +10291,213 @@ struct DxilInst_GetGroupWaveCount { // Metadata bool requiresUniformInputs() const { return false; } }; + +/// This instruction Returns the user-defined ClusterID of the intersected CLAS +struct DxilInst_ClusterID { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_ClusterID(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ClusterID); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (1 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } +}; + +/// This instruction returns candidate hit cluster ID +struct DxilInst_RayQuery_CandidateClusterID { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_RayQuery_CandidateClusterID(llvm::Instruction *pInstr) + : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::RayQuery_CandidateClusterID); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (2 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } + // Operand indexes + enum OperandIdx { + arg_rayQueryHandle = 1, + }; + // Accessors + llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); } + void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); } +}; + +/// This instruction returns committed hit cluster ID +struct DxilInst_RayQuery_CommittedClusterID { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_RayQuery_CommittedClusterID(llvm::Instruction *pInstr) + : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::RayQuery_CommittedClusterID); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (2 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } + // Operand indexes + enum OperandIdx { + arg_rayQueryHandle = 1, + }; + // Accessors + llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); } + void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); } +}; + +/// This instruction Returns the cluster ID of this committed hit +struct DxilInst_HitObject_ClusterID { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_HitObject_ClusterID(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::HitObject_ClusterID); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (2 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } + // Operand indexes + enum OperandIdx { + arg_hitObject = 1, + }; + // Accessors + llvm::Value *get_hitObject() const { return Instr->getOperand(1); } + void set_hitObject(llvm::Value *val) { Instr->setOperand(1, val); } +}; + +/// This instruction Returns triangle vertices in object space as <9 x float> +struct DxilInst_TriangleObjectPosition { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_TriangleObjectPosition(llvm::Instruction *pInstr) : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::TriangleObjectPosition); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (1 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } +}; + +/// This instruction Returns candidate triangle vertices in object space as <9 x +/// float> +struct DxilInst_RayQuery_CandidateTriangleObjectPosition { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_RayQuery_CandidateTriangleObjectPosition(llvm::Instruction *pInstr) + : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::RayQuery_CandidateTriangleObjectPosition); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (2 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } + // Operand indexes + enum OperandIdx { + arg_rayQueryHandle = 1, + }; + // Accessors + llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); } + void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); } +}; + +/// This instruction Returns committed triangle vertices in object space as <9 x +/// float> +struct DxilInst_RayQuery_CommittedTriangleObjectPosition { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_RayQuery_CommittedTriangleObjectPosition(llvm::Instruction *pInstr) + : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::RayQuery_CommittedTriangleObjectPosition); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (2 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } + // Operand indexes + enum OperandIdx { + arg_rayQueryHandle = 1, + }; + // Accessors + llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); } + void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); } +}; + +/// This instruction Returns triangle vertices in object space as <9 x float> +struct DxilInst_HitObject_TriangleObjectPosition { + llvm::Instruction *Instr; + // Construction and identification + DxilInst_HitObject_TriangleObjectPosition(llvm::Instruction *pInstr) + : Instr(pInstr) {} + operator bool() const { + return hlsl::OP::IsDxilOpFuncCallInst( + Instr, hlsl::OP::OpCode::HitObject_TriangleObjectPosition); + } + // Validation support + bool isAllowed() const { return true; } + bool isArgumentListValid() const { + if (2 != llvm::dyn_cast(Instr)->getNumArgOperands()) + return false; + return true; + } + // Metadata + bool requiresUniformInputs() const { return false; } + // Operand indexes + enum OperandIdx { + arg_hitObject = 1, + }; + // Accessors + llvm::Value *get_hitObject() const { return Instr->getOperand(1); } + void set_hitObject(llvm::Value *val) { Instr->setOperand(1, val); } +}; // INSTR-HELPER:END } // namespace hlsl diff --git a/include/dxc/HlslIntrinsicOp.h b/include/dxc/HlslIntrinsicOp.h index 19f54ea6c0..aae269cfa1 100644 --- a/include/dxc/HlslIntrinsicOp.h +++ b/include/dxc/HlslIntrinsicOp.h @@ -13,6 +13,7 @@ enum class IntrinsicOp { IOP_Barrier = 5, IOP_CallShader = 6, IOP_CheckAccessFullyMapped = 7, + IOP_ClusterID = 397, IOP_CreateResourceFromHeap = 8, IOP_D3DCOLORtoUBYTE4 = 9, IOP_DeviceMemoryBarrier = 10, @@ -77,6 +78,7 @@ enum class IntrinsicOp { IOP_ReportHit = 67, IOP_SetMeshOutputCounts = 68, IOP_TraceRay = 69, + IOP_TriangleObjectPosition = 401, IOP_WaveActiveAllEqual = 70, IOP_WaveActiveAllTrue = 71, IOP_WaveActiveAnyTrue = 72, @@ -304,6 +306,7 @@ enum class IntrinsicOp { MOP_WriteSamplerFeedbackGrad = 286, MOP_WriteSamplerFeedbackLevel = 287, MOP_Abort = 288, + MOP_CandidateClusterID = 398, MOP_CandidateGeometryIndex = 289, MOP_CandidateInstanceContributionToHitGroupIndex = 290, MOP_CandidateInstanceID = 291, @@ -316,12 +319,14 @@ enum class IntrinsicOp { MOP_CandidateProceduralPrimitiveNonOpaque = 298, MOP_CandidateTriangleBarycentrics = 299, MOP_CandidateTriangleFrontFace = 300, + MOP_CandidateTriangleObjectPosition = 402, MOP_CandidateTriangleRayT = 301, MOP_CandidateType = 302, MOP_CandidateWorldToObject3x4 = 303, MOP_CandidateWorldToObject4x3 = 304, MOP_CommitNonOpaqueTriangleHit = 305, MOP_CommitProceduralPrimitiveHit = 306, + MOP_CommittedClusterID = 399, MOP_CommittedGeometryIndex = 307, MOP_CommittedInstanceContributionToHitGroupIndex = 308, MOP_CommittedInstanceID = 309, @@ -335,6 +340,7 @@ enum class IntrinsicOp { MOP_CommittedStatus = 317, MOP_CommittedTriangleBarycentrics = 318, MOP_CommittedTriangleFrontFace = 319, + MOP_CommittedTriangleObjectPosition = 403, MOP_CommittedWorldToObject3x4 = 320, MOP_CommittedWorldToObject4x3 = 321, MOP_Proceed = 322, @@ -343,6 +349,7 @@ enum class IntrinsicOp { MOP_TraceRayInline = 325, MOP_WorldRayDirection = 326, MOP_WorldRayOrigin = 327, + MOP_DxHitObject_ClusterID = 400, MOP_DxHitObject_FromRayQuery = 363, MOP_DxHitObject_GetAttributes = 364, MOP_DxHitObject_GetGeometryIndex = 365, @@ -371,6 +378,7 @@ enum class IntrinsicOp { MOP_DxHitObject_MakeNop = 358, MOP_DxHitObject_SetShaderTableIndex = 388, MOP_DxHitObject_TraceRay = 389, + MOP_DxHitObject_TriangleObjectPosition = 404, IOP_DxMaybeReorderThread = 359, MOP_Count = 328, MOP_FinishedCrossGroupSharing = 329, @@ -403,7 +411,7 @@ enum class IntrinsicOp { IOP_usign = 355, MOP_InterlockedUMax = 356, MOP_InterlockedUMin = 357, - Num_Intrinsics = 397, + Num_Intrinsics = 405, }; inline bool HasUnsignedIntrinsicOpcode(IntrinsicOp opcode) { switch (opcode) { diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index d0aed70b00..4ac324219a 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -2746,6 +2746,82 @@ static const OP::OpCodeProperty ExperimentalOps_OpCodeProps[] = { 0, {}, {}}, // Overloads: v + + // Raytracing uint System Values + {OC::ClusterID, + "ClusterID", + OCC::ClusterID, + "clusterID", + Attribute::ReadNone, + 0, + {}, + {}}, // Overloads: v + + // Inline Ray Query + {OC::RayQuery_CandidateClusterID, + "RayQuery_CandidateClusterID", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + Attribute::ReadOnly, + 0, + {}, + {}}, // Overloads: v + {OC::RayQuery_CommittedClusterID, + "RayQuery_CommittedClusterID", + OCC::RayQuery_StateScalar, + "rayQuery_StateScalar", + Attribute::ReadOnly, + 0, + {}, + {}}, // Overloads: v + + // Shader Execution Reordering + {OC::HitObject_ClusterID, + "HitObject_ClusterID", + OCC::HitObject_StateScalar, + "hitObject_StateScalar", + Attribute::ReadNone, + 0, + {}, + {}}, // Overloads: v + + // Raytracing System Values + {OC::TriangleObjectPosition, + "TriangleObjectPosition", + OCC::TriangleObjectPosition, + "triangleObjectPosition", + Attribute::ReadNone, + 1, + {{0x2}}, + {{0x0}}}, // Overloads: f + + // Inline Ray Query + {OC::RayQuery_CandidateTriangleObjectPosition, + "RayQuery_CandidateTriangleObjectPosition", + OCC::RayQuery_CandidateTriangleObjectPosition, + "rayQuery_CandidateTriangleObjectPosition", + Attribute::ReadOnly, + 1, + {{0x2}}, + {{0x0}}}, // Overloads: f + {OC::RayQuery_CommittedTriangleObjectPosition, + "RayQuery_CommittedTriangleObjectPosition", + OCC::RayQuery_CommittedTriangleObjectPosition, + "rayQuery_CommittedTriangleObjectPosition", + Attribute::ReadOnly, + 1, + {{0x2}}, + {{0x0}}}, // Overloads: f + + // Shader Execution Reordering + {OC::HitObject_TriangleObjectPosition, + "HitObject_TriangleObjectPosition", + OCC::HitObject_TriangleObjectPosition, + "hitObject_TriangleObjectPosition", + Attribute::ReadNone, + 1, + {{0x2}}, + {{0x0}}}, // Overloads: f }; static_assert(_countof(ExperimentalOps_OpCodeProps) == (size_t)DXIL::ExperimentalOps::OpCode::NumOpCodes, @@ -3655,10 +3731,32 @@ void OP::GetMinShaderModelAndMask(OpCode C, bool bWithTranslation, } // Instructions: MatVecMul=305, MatVecMulAdd=306, OuterProductAccumulate=307, // VectorAccumulate=308, ExperimentalNop=2147483648, - // GetGroupWaveIndex=2147483649, GetGroupWaveCount=2147483650 - if ((305 <= op && op <= 308) || (2147483648 <= op && op <= 2147483650)) { + // GetGroupWaveIndex=2147483649, GetGroupWaveCount=2147483650, + // RayQuery_CandidateClusterID=2147483652, + // RayQuery_CommittedClusterID=2147483653, + // RayQuery_CandidateTriangleObjectPosition=2147483656, + // RayQuery_CommittedTriangleObjectPosition=2147483657 + if ((305 <= op && op <= 308) || (2147483648 <= op && op <= 2147483650) || + (2147483652 <= op && op <= 2147483653) || + (2147483656 <= op && op <= 2147483657)) { + major = 6; + minor = 10; + return; + } + // Instructions: ClusterID=2147483651, TriangleObjectPosition=2147483655 + if (op == 2147483651 || op == 2147483655) { major = 6; minor = 10; + mask = SFLAG(Library) | SFLAG(AnyHit) | SFLAG(ClosestHit); + return; + } + // Instructions: HitObject_ClusterID=2147483654, + // HitObject_TriangleObjectPosition=2147483658 + if (op == 2147483654 || op == 2147483658) { + major = 6; + minor = 10; + mask = + SFLAG(Library) | SFLAG(RayGeneration) | SFLAG(ClosestHit) | SFLAG(Miss); return; } // OPCODE-SMMASK:END @@ -6176,6 +6274,56 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pI32); A(pI32); break; + + // Raytracing uint System Values + case OpCode::ClusterID: + A(pI32); + A(pI32); + break; + + // Inline Ray Query + case OpCode::RayQuery_CandidateClusterID: + A(pI32); + A(pI32); + A(pI32); + break; + case OpCode::RayQuery_CommittedClusterID: + A(pI32); + A(pI32); + A(pI32); + break; + + // Shader Execution Reordering + case OpCode::HitObject_ClusterID: + A(pI32); + A(pI32); + A(pHit); + break; + + // Raytracing System Values + case OpCode::TriangleObjectPosition: + A(pV); + A(pI32); + break; + + // Inline Ray Query + case OpCode::RayQuery_CandidateTriangleObjectPosition: + A(pV); + A(pI32); + A(pI32); + break; + case OpCode::RayQuery_CommittedTriangleObjectPosition: + A(pV); + A(pI32); + A(pI32); + break; + + // Shader Execution Reordering + case OpCode::HitObject_TriangleObjectPosition: + A(pV); + A(pI32); + A(pHit); + break; // OPCODE-OLOAD-FUNCS:END default: DXASSERT(false, "otherwise unhandled case"); @@ -6469,6 +6617,10 @@ llvm::Type *OP::GetOverloadType(OpCode opCode, llvm::Function *F) { case OpCode::ExperimentalNop: case OpCode::GetGroupWaveIndex: case OpCode::GetGroupWaveCount: + case OpCode::ClusterID: + case OpCode::RayQuery_CandidateClusterID: + case OpCode::RayQuery_CommittedClusterID: + case OpCode::HitObject_ClusterID: return Type::getVoidTy(Ctx); case OpCode::CheckAccessFullyMapped: case OpCode::SampleIndex: @@ -6548,6 +6700,10 @@ llvm::Type *OP::GetOverloadType(OpCode opCode, llvm::Function *F) { case OpCode::HitObject_ObjectRayDirection: case OpCode::HitObject_ObjectToWorld3x4: case OpCode::HitObject_WorldToObject3x4: + case OpCode::TriangleObjectPosition: + case OpCode::RayQuery_CandidateTriangleObjectPosition: + case OpCode::RayQuery_CommittedTriangleObjectPosition: + case OpCode::HitObject_TriangleObjectPosition: return Type::getFloatTy(Ctx); case OpCode::MakeDouble: case OpCode::SplitDouble: diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index f14b17e3a7..0fa7ab8104 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -7512,9 +7512,21 @@ IntrinsicLower gLowerTable[] = { TranslateOuterProductAccumulate, DXIL::OpCode::OuterProductAccumulate}, {IntrinsicOp::IOP___builtin_VectorAccumulate, TranslateVectorAccumulate, DXIL::OpCode::VectorAccumulate}, + {IntrinsicOp::IOP_isnormal, TrivialIsSpecialFloat, DXIL::OpCode::IsNormal}, + {IntrinsicOp::IOP_GetGroupWaveIndex, EmptyLower, DXIL::OpCode::GetGroupWaveIndex}, {IntrinsicOp::IOP_GetGroupWaveCount, EmptyLower, DXIL::OpCode::GetGroupWaveCount}, + + {IntrinsicOp::IOP_ClusterID, EmptyLower, DXIL::OpCode::ClusterID}, + {IntrinsicOp::MOP_CandidateClusterID, EmptyLower, DXIL::OpCode::RayQuery_CandidateClusterID}, + {IntrinsicOp::MOP_CommittedClusterID, EmptyLower, DXIL::OpCode::RayQuery_CommittedClusterID}, + {IntrinsicOp::MOP_DxHitObject_ClusterID, EmptyLower, DXIL::OpCode::HitObject_ClusterID}, + + {IntrinsicOp::IOP_TriangleObjectPosition, EmptyLower, DXIL::OpCode::TriangleObjectPosition}, + {IntrinsicOp::MOP_CandidateTriangleObjectPosition, EmptyLower, DXIL::OpCode::RayQuery_CandidateTriangleObjectPosition}, + {IntrinsicOp::MOP_CommittedTriangleObjectPosition, EmptyLower, DXIL::OpCode::RayQuery_CommittedTriangleObjectPosition}, + {IntrinsicOp::MOP_DxHitObject_TriangleObjectPosition, EmptyLower, DXIL::OpCode::HitObject_TriangleObjectPosition}, }; } // namespace static_assert( diff --git a/utils/hct/gen_intrin_main.txt b/utils/hct/gen_intrin_main.txt index c495dff1d1..9e6538a47c 100644 --- a/utils/hct/gen_intrin_main.txt +++ b/utils/hct/gen_intrin_main.txt @@ -338,6 +338,10 @@ float<3,4> [[rn]] WorldToObject3x4(); float<4,3> [[rn]] ObjectToWorld4x3(); float<4,3> [[rn]] WorldToObject4x3(); +uint [[ro,min_sm=6.10]] ClusterID(); +// TODO: Update return type for TriangleObjectPosition(): +void [[ro,min_sm=6.10]] TriangleObjectPosition(); + // Packed dot products with accumulate: uint [[rn]] dot4add_u8packed(in uint a, in $type1 b, in uint c); int [[rn]] dot4add_i8packed(in uint a, in $type1 b, in int c); @@ -1103,6 +1107,11 @@ float<3> [[ro]] CommittedObjectRayOrigin(); float<3> [[ro]] CommittedObjectRayDirection(); uint [[ro]] CandidateInstanceContributionToHitGroupIndex(); uint [[ro]] CommittedInstanceContributionToHitGroupIndex(); +uint [[ro,min_sm=6.10]] CandidateClusterID(); +uint [[ro,min_sm=6.10]] CommittedClusterID(); +// TODO: Update return type for *TriangleObjectPosition(): +void [[ro,min_sm=6.10]] CandidateTriangleObjectPosition(); +void [[ro,min_sm=6.10]] CommittedTriangleObjectPosition(); } namespace @@ -1137,6 +1146,9 @@ namespace DxHitObjectMethods { void [[class_prefix,min_sm=6.9]] GetAttributes(out udt Attributes); void [[class_prefix,min_sm=6.9]] SetShaderTableIndex(in uint RecordIndex); uint [[ro,class_prefix,min_sm=6.9]] LoadLocalRootTableConstant(in uint RootConstantOffsetInBytes); + uint [[ro,class_prefix,min_sm=6.10]] ClusterID(); + // TODO: Update return type for TriangleObjectPosition(): + void [[ro,class_prefix,min_sm=6.10]] TriangleObjectPosition(); } namespace namespace DxIntrinsics { diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 7af922ad88..306b9cae87 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1043,12 +1043,68 @@ def populate_categories_and_models_ExperimentalOps(self): # Note: Experimental ops must be set to a shader model higher than the # most recent release until infrastructure is in place to opt-in to # experimental ops and the validator can force use of the PREVIEW hash. - for i in "ExperimentalNop".split(","): - self.name_idx[i].category = "No-op" - self.name_idx[i].shader_model = 6, 10 - for i in "GetGroupWaveIndex,GetGroupWaveCount".split(","): - self.name_idx[i].category = "Wave" - self.name_idx[i].shader_model = 6, 10 + for name in "ExperimentalNop".split(","): + i = self.name_idx[name] + i.category = "No-op" + i.shader_model = 6, 10 + + # Group Wave Index / Count + for name in "GetGroupWaveIndex,GetGroupWaveCount".split(","): + i = self.name_idx[name] + i.category = "Wave" + i.shader_model = 6, 10 + + # Clustered Geometry + for name in ("ClusterID").split(","): + i = self.name_idx[name] + i.category = "Raytracing uint System Values" + i.shader_model = 6, 10 + i.shader_stages = ( + "library", + "anyhit", + "closesthit", + ) + for name in ("RayQuery_CandidateClusterID,RayQuery_CommittedClusterID").split(","): + i = self.name_idx[name] + i.category = "Inline Ray Query" + i.shader_model = 6, 10 + for name in ("HitObject_ClusterID").split(","): + i = self.name_idx[name] + i.category = "Shader Execution Reordering" + i.shader_model = 6, 10 + i.shader_stages = ( + "library", + "raygeneration", + "closesthit", + "miss", + ) + + # Triangle Object Positions + for name in ("TriangleObjectPosition").split(","): + i = self.name_idx[name] + i.category = "Raytracing System Values" + i.shader_model = 6, 10 + i.shader_stages = ( + "library", + "anyhit", + "closesthit", + ) + for name in ( + "RayQuery_CandidateTriangleObjectPosition,RayQuery_CommittedTriangleObjectPosition" + ).split(","): + i = self.name_idx[name] + i.category = "Inline Ray Query" + i.shader_model = 6, 10 + for name in ("HitObject_TriangleObjectPosition").split(","): + i = self.name_idx[name] + i.category = "Shader Execution Reordering" + i.shader_model = 6, 10 + i.shader_stages = ( + "library", + "raygeneration", + "closesthit", + "miss", + ) def populate_llvm_instructions(self): # Add instructions that map to LLVM instructions. @@ -6098,6 +6154,95 @@ def populate_ExperimentalOps(self): [db_dxil_param(0, "i32", "", "operation result")], ) + # Clustered Geometry + add_dxil_op( + "ClusterID", + "ClusterID", + "Returns the user-defined ClusterID of the intersected CLAS", + "v", + "rn", + [db_dxil_param(0, "i32", "", "result")], + ) + add_dxil_op( + "RayQuery_CandidateClusterID", + "RayQuery_StateScalar", + "returns candidate hit cluster ID", + "v", + "ro", + [ + db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), + ], + ) + add_dxil_op( + "RayQuery_CommittedClusterID", + "RayQuery_StateScalar", + "returns committed hit cluster ID", + "v", + "ro", + [ + db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), + ], + ) + add_dxil_op( + "HitObject_ClusterID", + "HitObject_StateScalar", + "Returns the cluster ID of this committed hit", + "v", + "rn", + [ + db_dxil_param(0, "i32", "", "operation result"), + db_dxil_param(2, "hit_object", "hitObject", "hit"), + ], + ) + + # Triangle Object Positions + add_dxil_op( + "TriangleObjectPosition", + "TriangleObjectPosition", + "Returns triangle vertices in object space as <9 x float>", + "f", + "rn", + [ + db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 + ], + ) + add_dxil_op( + "RayQuery_CandidateTriangleObjectPosition", + "RayQuery_CandidateTriangleObjectPosition", + "Returns candidate triangle vertices in object space as <9 x float>", + "f", + "ro", + [ + db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 + db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), + ], + ) + add_dxil_op( + "RayQuery_CommittedTriangleObjectPosition", + "RayQuery_CommittedTriangleObjectPosition", + "Returns committed triangle vertices in object space as <9 x float>", + "f", + "ro", + [ + db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 + db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), + ], + ) + add_dxil_op( + "HitObject_TriangleObjectPosition", + "HitObject_TriangleObjectPosition", + "Returns triangle vertices in object space as <9 x float>", + "f", + "rn", + [ + db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 + db_dxil_param(2, "hit_object", "hitObject", "hit"), + ], + ) + + def finalize_dxil_operations(self): "Finalize DXIL operations by setting properties and verifying consistency." diff --git a/utils/hct/hlsl_intrinsic_opcodes.json b/utils/hct/hlsl_intrinsic_opcodes.json index 793b17c822..e2d3c6f290 100644 --- a/utils/hct/hlsl_intrinsic_opcodes.json +++ b/utils/hct/hlsl_intrinsic_opcodes.json @@ -1,6 +1,6 @@ { "IntrinsicOpCodes": { - "Num_Intrinsics": 397, + "Num_Intrinsics": 405, "IOP_AcceptHitAndEndSearch": 0, "IOP_AddUint64": 1, "IOP_AllMemoryBarrier": 2, @@ -397,6 +397,14 @@ "IOP___builtin_VectorAccumulate": 393, "IOP_isnormal": 394, "IOP_GetGroupWaveCount": 395, - "IOP_GetGroupWaveIndex": 396 + "IOP_GetGroupWaveIndex": 396, + "IOP_ClusterID": 397, + "MOP_CandidateClusterID": 398, + "MOP_CommittedClusterID": 399, + "MOP_DxHitObject_ClusterID": 400, + "IOP_TriangleObjectPosition": 401, + "MOP_CandidateTriangleObjectPosition": 402, + "MOP_CommittedTriangleObjectPosition": 403, + "MOP_DxHitObject_TriangleObjectPosition": 404 } } From 23fbdea1d737e00ac8bb3200663fb425ffb7870f Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 16:37:06 -0800 Subject: [PATCH 03/11] formatting --- lib/HLSL/HLOperationLower.cpp | 29 +++++++++++++++++++---------- utils/hct/hctdb.py | 13 +++++++------ 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/lib/HLSL/HLOperationLower.cpp b/lib/HLSL/HLOperationLower.cpp index 0fa7ab8104..7ec0ead0eb 100644 --- a/lib/HLSL/HLOperationLower.cpp +++ b/lib/HLSL/HLOperationLower.cpp @@ -7515,18 +7515,27 @@ IntrinsicLower gLowerTable[] = { {IntrinsicOp::IOP_isnormal, TrivialIsSpecialFloat, DXIL::OpCode::IsNormal}, - {IntrinsicOp::IOP_GetGroupWaveIndex, EmptyLower, DXIL::OpCode::GetGroupWaveIndex}, - {IntrinsicOp::IOP_GetGroupWaveCount, EmptyLower, DXIL::OpCode::GetGroupWaveCount}, + {IntrinsicOp::IOP_GetGroupWaveIndex, EmptyLower, + DXIL::OpCode::GetGroupWaveIndex}, + {IntrinsicOp::IOP_GetGroupWaveCount, EmptyLower, + DXIL::OpCode::GetGroupWaveCount}, {IntrinsicOp::IOP_ClusterID, EmptyLower, DXIL::OpCode::ClusterID}, - {IntrinsicOp::MOP_CandidateClusterID, EmptyLower, DXIL::OpCode::RayQuery_CandidateClusterID}, - {IntrinsicOp::MOP_CommittedClusterID, EmptyLower, DXIL::OpCode::RayQuery_CommittedClusterID}, - {IntrinsicOp::MOP_DxHitObject_ClusterID, EmptyLower, DXIL::OpCode::HitObject_ClusterID}, - - {IntrinsicOp::IOP_TriangleObjectPosition, EmptyLower, DXIL::OpCode::TriangleObjectPosition}, - {IntrinsicOp::MOP_CandidateTriangleObjectPosition, EmptyLower, DXIL::OpCode::RayQuery_CandidateTriangleObjectPosition}, - {IntrinsicOp::MOP_CommittedTriangleObjectPosition, EmptyLower, DXIL::OpCode::RayQuery_CommittedTriangleObjectPosition}, - {IntrinsicOp::MOP_DxHitObject_TriangleObjectPosition, EmptyLower, DXIL::OpCode::HitObject_TriangleObjectPosition}, + {IntrinsicOp::MOP_CandidateClusterID, EmptyLower, + DXIL::OpCode::RayQuery_CandidateClusterID}, + {IntrinsicOp::MOP_CommittedClusterID, EmptyLower, + DXIL::OpCode::RayQuery_CommittedClusterID}, + {IntrinsicOp::MOP_DxHitObject_ClusterID, EmptyLower, + DXIL::OpCode::HitObject_ClusterID}, + + {IntrinsicOp::IOP_TriangleObjectPosition, EmptyLower, + DXIL::OpCode::TriangleObjectPosition}, + {IntrinsicOp::MOP_CandidateTriangleObjectPosition, EmptyLower, + DXIL::OpCode::RayQuery_CandidateTriangleObjectPosition}, + {IntrinsicOp::MOP_CommittedTriangleObjectPosition, EmptyLower, + DXIL::OpCode::RayQuery_CommittedTriangleObjectPosition}, + {IntrinsicOp::MOP_DxHitObject_TriangleObjectPosition, EmptyLower, + DXIL::OpCode::HitObject_TriangleObjectPosition}, }; } // namespace static_assert( diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 306b9cae87..24f4ab09a4 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1064,7 +1064,9 @@ def populate_categories_and_models_ExperimentalOps(self): "anyhit", "closesthit", ) - for name in ("RayQuery_CandidateClusterID,RayQuery_CommittedClusterID").split(","): + for name in ("RayQuery_CandidateClusterID,RayQuery_CommittedClusterID").split( + "," + ): i = self.name_idx[name] i.category = "Inline Ray Query" i.shader_model = 6, 10 @@ -6205,7 +6207,7 @@ def populate_ExperimentalOps(self): "f", "rn", [ - db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 + db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 ], ) add_dxil_op( @@ -6215,7 +6217,7 @@ def populate_ExperimentalOps(self): "f", "ro", [ - db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 + db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -6226,7 +6228,7 @@ def populate_ExperimentalOps(self): "f", "ro", [ - db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 + db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 db_dxil_param(2, "i32", "rayQueryHandle", "RayQuery handle"), ], ) @@ -6237,12 +6239,11 @@ def populate_ExperimentalOps(self): "f", "rn", [ - db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 + db_dxil_param(0, "v", "", "operation result"), # TODO: $vec9 db_dxil_param(2, "hit_object", "hitObject", "hit"), ], ) - def finalize_dxil_operations(self): "Finalize DXIL operations by setting properties and verifying consistency." From 4988b0852dbd93f99e40fd65f342128f573a3259 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 17:29:21 -0800 Subject: [PATCH 04/11] Improve new populate_categories_and_models pattern --- utils/hct/hctdb.py | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 24f4ab09a4..0007d8ead6 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1043,20 +1043,23 @@ def populate_categories_and_models_ExperimentalOps(self): # Note: Experimental ops must be set to a shader model higher than the # most recent release until infrastructure is in place to opt-in to # experimental ops and the validator can force use of the PREVIEW hash. - for name in "ExperimentalNop".split(","): - i = self.name_idx[name] + def ops(*names_to_split): + "Supply one or more [comma-separated] strings of names, to yield ops." + for names in names_to_split: + for name in names.split(","): + yield self.name_idx[name] + + for i in ops("ExperimentalNop"): i.category = "No-op" i.shader_model = 6, 10 # Group Wave Index / Count - for name in "GetGroupWaveIndex,GetGroupWaveCount".split(","): - i = self.name_idx[name] + for i in ops("GetGroupWaveIndex,GetGroupWaveCount"): i.category = "Wave" i.shader_model = 6, 10 # Clustered Geometry - for name in ("ClusterID").split(","): - i = self.name_idx[name] + for i in ops("ClusterID"): i.category = "Raytracing uint System Values" i.shader_model = 6, 10 i.shader_stages = ( @@ -1064,14 +1067,10 @@ def populate_categories_and_models_ExperimentalOps(self): "anyhit", "closesthit", ) - for name in ("RayQuery_CandidateClusterID,RayQuery_CommittedClusterID").split( - "," - ): - i = self.name_idx[name] + for i in ops("RayQuery_CandidateClusterID,RayQuery_CommittedClusterID"): i.category = "Inline Ray Query" i.shader_model = 6, 10 - for name in ("HitObject_ClusterID").split(","): - i = self.name_idx[name] + for i in ops("HitObject_ClusterID"): i.category = "Shader Execution Reordering" i.shader_model = 6, 10 i.shader_stages = ( @@ -1082,8 +1081,7 @@ def populate_categories_and_models_ExperimentalOps(self): ) # Triangle Object Positions - for name in ("TriangleObjectPosition").split(","): - i = self.name_idx[name] + for i in ops("TriangleObjectPosition"): i.category = "Raytracing System Values" i.shader_model = 6, 10 i.shader_stages = ( @@ -1091,14 +1089,13 @@ def populate_categories_and_models_ExperimentalOps(self): "anyhit", "closesthit", ) - for name in ( - "RayQuery_CandidateTriangleObjectPosition,RayQuery_CommittedTriangleObjectPosition" - ).split(","): - i = self.name_idx[name] + for i in ops( + "RayQuery_CandidateTriangleObjectPosition", + "RayQuery_CommittedTriangleObjectPosition", + ): i.category = "Inline Ray Query" i.shader_model = 6, 10 - for name in ("HitObject_TriangleObjectPosition").split(","): - i = self.name_idx[name] + for i in ops("HitObject_TriangleObjectPosition"): i.category = "Shader Execution Reordering" i.shader_model = 6, 10 i.shader_stages = ( From e7146879b85c48139bcbe7823952bd315a2b741b Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 17:50:50 -0800 Subject: [PATCH 05/11] rename op() to insts() --- utils/hct/hctdb.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 0007d8ead6..03d21f0922 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1043,23 +1043,23 @@ def populate_categories_and_models_ExperimentalOps(self): # Note: Experimental ops must be set to a shader model higher than the # most recent release until infrastructure is in place to opt-in to # experimental ops and the validator can force use of the PREVIEW hash. - def ops(*names_to_split): - "Supply one or more [comma-separated] strings of names, to yield ops." + def insts(*names_to_split): + "Supply one or more [comma-separated] strings of names, to yield instructions." for names in names_to_split: for name in names.split(","): yield self.name_idx[name] - for i in ops("ExperimentalNop"): + for i in insts("ExperimentalNop"): i.category = "No-op" i.shader_model = 6, 10 # Group Wave Index / Count - for i in ops("GetGroupWaveIndex,GetGroupWaveCount"): + for i in insts("GetGroupWaveIndex,GetGroupWaveCount"): i.category = "Wave" i.shader_model = 6, 10 # Clustered Geometry - for i in ops("ClusterID"): + for i in insts("ClusterID"): i.category = "Raytracing uint System Values" i.shader_model = 6, 10 i.shader_stages = ( @@ -1067,10 +1067,10 @@ def ops(*names_to_split): "anyhit", "closesthit", ) - for i in ops("RayQuery_CandidateClusterID,RayQuery_CommittedClusterID"): + for i in insts("RayQuery_CandidateClusterID,RayQuery_CommittedClusterID"): i.category = "Inline Ray Query" i.shader_model = 6, 10 - for i in ops("HitObject_ClusterID"): + for i in insts("HitObject_ClusterID"): i.category = "Shader Execution Reordering" i.shader_model = 6, 10 i.shader_stages = ( @@ -1081,7 +1081,7 @@ def ops(*names_to_split): ) # Triangle Object Positions - for i in ops("TriangleObjectPosition"): + for i in insts("TriangleObjectPosition"): i.category = "Raytracing System Values" i.shader_model = 6, 10 i.shader_stages = ( @@ -1089,13 +1089,13 @@ def ops(*names_to_split): "anyhit", "closesthit", ) - for i in ops( + for i in insts( "RayQuery_CandidateTriangleObjectPosition", "RayQuery_CommittedTriangleObjectPosition", ): i.category = "Inline Ray Query" i.shader_model = 6, 10 - for i in ops("HitObject_TriangleObjectPosition"): + for i in insts("HitObject_TriangleObjectPosition"): i.category = "Shader Execution Reordering" i.shader_model = 6, 10 i.shader_stages = ( From 583895c4f332a2d1d0eae87642c645e488abdb94 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 19:49:01 -0800 Subject: [PATCH 06/11] Fix up Group Wave Ops DXIL properties --- utils/hct/hctdb.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 03d21f0922..2699d91dd6 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1055,8 +1055,10 @@ def insts(*names_to_split): # Group Wave Index / Count for i in insts("GetGroupWaveIndex,GetGroupWaveCount"): - i.category = "Wave" + i.category = "Group Wave Ops" i.shader_model = 6, 10 + i.shader_stages = ("compute", "mesh", "amplification", "library") + i.is_wave = True # Clustered Geometry for i in insts("ClusterID"): From d33757440e54b62688760f6cce660653ee31ea07 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 19:52:16 -0800 Subject: [PATCH 07/11] Set min_sm for HLSL Group Wave intrinsics --- utils/hct/gen_intrin_main.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/hct/gen_intrin_main.txt b/utils/hct/gen_intrin_main.txt index 9e6538a47c..8b10f733a8 100644 --- a/utils/hct/gen_intrin_main.txt +++ b/utils/hct/gen_intrin_main.txt @@ -303,8 +303,8 @@ $type1 [[]] QuadReadAcrossY(in numeric<> value); $type1 [[]] QuadReadAcrossDiagonal(in numeric<> value); bool [[]] QuadAny(in bool cond); bool [[]] QuadAll(in bool cond); -uint [[rn]] GetGroupWaveIndex(); -uint [[rn]] GetGroupWaveCount(); +uint [[rn,min_sm=6.10]] GetGroupWaveIndex(); +uint [[rn,min_sm=6.10]] GetGroupWaveCount(); // Raytracing void [[]] TraceRay(in acceleration_struct AccelerationStructure, in uint RayFlags, in uint InstanceInclusionMask, in uint RayContributionToHitGroupIndex, in uint MultiplierForGeometryContributionToHitGroupIndex, in uint MissShaderIndex, in ray_desc Ray, inout udt Payload); From 97ed13beeb3e8877e997a171569e569332af6d5e Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Wed, 10 Dec 2025 10:11:47 -0800 Subject: [PATCH 08/11] Update generated files (group name change impacted sorting) --- include/dxc/DXIL/DxilConstants.h | 14 ++++++++------ lib/DXIL/DxilOperations.cpp | 20 ++++++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index 6ff6e099d3..47255f19f4 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -511,6 +511,10 @@ namespace ExperimentalOps { static const OpCodeTableID TableID = OpCodeTableID::ExperimentalOps; // Enumeration for ExperimentalOps DXIL operations enum class OpCode : unsigned { + // Group Wave Ops + GetGroupWaveCount = 2, // returns the number of waves in the thread group + GetGroupWaveIndex = 1, // returns the index of the wave in the thread group + // Inline Ray Query RayQuery_CandidateClusterID = 4, // returns candidate hit cluster ID RayQuery_CandidateTriangleObjectPosition = @@ -534,10 +538,6 @@ enum class OpCode : unsigned { HitObject_TriangleObjectPosition = 10, // Returns triangle vertices in object space as <9 x float> - // Wave - GetGroupWaveCount = 2, // returns the number of waves in the thread group - GetGroupWaveIndex = 1, // returns the index of the wave in the thread group - NumOpCodes = 11, // exclusive last value of enumeration }; } // namespace ExperimentalOps @@ -1298,6 +1298,10 @@ enum class OpCodeClass : unsigned { // Graphics shader ViewID, + // Group Wave Ops + GetGroupWaveCount, + GetGroupWaveIndex, + // Helper Lanes IsHelperLane, @@ -1503,8 +1507,6 @@ enum class OpCodeClass : unsigned { VectorReduce, // Wave - GetGroupWaveCount, - GetGroupWaveIndex, WaveActiveAllEqual, WaveActiveBallot, WaveActiveBit, diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index 4ac324219a..1e38138347 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -2729,7 +2729,7 @@ static const OP::OpCodeProperty ExperimentalOps_OpCodeProps[] = { {}, {}}, // Overloads: v - // Wave + // Group Wave Ops {OC::GetGroupWaveIndex, "GetGroupWaveIndex", OCC::GetGroupWaveIndex, @@ -3160,9 +3160,11 @@ bool OP::IsDxilOpWave(OpCode C) { // WaveReadLaneFirst=118, WaveActiveOp=119, WaveActiveBit=120, // WavePrefixOp=121, QuadReadLaneAt=122, QuadOp=123, WaveAllBitCount=135, // WavePrefixBitCount=136, WaveMatch=165, WaveMultiPrefixOp=166, - // WaveMultiPrefixBitCount=167, QuadVote=222 + // WaveMultiPrefixBitCount=167, QuadVote=222, GetGroupWaveIndex=2147483649, + // GetGroupWaveCount=2147483650 return (110 <= op && op <= 123) || (135 <= op && op <= 136) || - (165 <= op && op <= 167) || op == 222; + (165 <= op && op <= 167) || op == 222 || + (2147483649 <= op && op <= 2147483650); // OPCODE-WAVE:END } @@ -3731,18 +3733,24 @@ void OP::GetMinShaderModelAndMask(OpCode C, bool bWithTranslation, } // Instructions: MatVecMul=305, MatVecMulAdd=306, OuterProductAccumulate=307, // VectorAccumulate=308, ExperimentalNop=2147483648, - // GetGroupWaveIndex=2147483649, GetGroupWaveCount=2147483650, // RayQuery_CandidateClusterID=2147483652, // RayQuery_CommittedClusterID=2147483653, // RayQuery_CandidateTriangleObjectPosition=2147483656, // RayQuery_CommittedTriangleObjectPosition=2147483657 - if ((305 <= op && op <= 308) || (2147483648 <= op && op <= 2147483650) || + if ((305 <= op && op <= 308) || op == 2147483648 || (2147483652 <= op && op <= 2147483653) || (2147483656 <= op && op <= 2147483657)) { major = 6; minor = 10; return; } + // Instructions: GetGroupWaveIndex=2147483649, GetGroupWaveCount=2147483650 + if ((2147483649 <= op && op <= 2147483650)) { + major = 6; + minor = 10; + mask = SFLAG(Compute) | SFLAG(Mesh) | SFLAG(Amplification) | SFLAG(Library); + return; + } // Instructions: ClusterID=2147483651, TriangleObjectPosition=2147483655 if (op == 2147483651 || op == 2147483655) { major = 6; @@ -6265,7 +6273,7 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) { A(pI32); break; - // Wave + // Group Wave Ops case OpCode::GetGroupWaveIndex: A(pI32); A(pI32); From 38199949d14aacc51d671511a917313019d576b7 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Wed, 10 Dec 2025 10:56:56 -0800 Subject: [PATCH 09/11] Add db_dxil.get_insts_by_names Just assign 'insts' to self.get_insts_by_names. This makes using it in main populate_categories_and_models easier in the future. --- utils/hct/hctdb.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 2699d91dd6..5b511b16cf 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -501,6 +501,12 @@ def get_all_insts(self): for i in table: yield i + def get_insts_by_names(self, *names): + "Get instructions by strings of names separated by commas." + for names_to_split in names: + for name in names_to_split.split(","): + yield self.name_idx[name.strip()] + def add_dxil_op_table(self, id, name, doc): "Add a new DXIL operation table." assert name not in self.op_table_idx, f"DXIL op table '{name}' already exists" @@ -1043,11 +1049,7 @@ def populate_categories_and_models_ExperimentalOps(self): # Note: Experimental ops must be set to a shader model higher than the # most recent release until infrastructure is in place to opt-in to # experimental ops and the validator can force use of the PREVIEW hash. - def insts(*names_to_split): - "Supply one or more [comma-separated] strings of names, to yield instructions." - for names in names_to_split: - for name in names.split(","): - yield self.name_idx[name] + insts = self.get_insts_by_names for i in insts("ExperimentalNop"): i.category = "No-op" From 8737512b820a7b0ae7384d1b77dc66616a34aa31 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Wed, 10 Dec 2025 11:36:06 -0800 Subject: [PATCH 10/11] Use common experimental_sm variable for experimental ops --- utils/hct/hctdb.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 5b511b16cf..5d03e2a6c6 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1049,23 +1049,28 @@ def populate_categories_and_models_ExperimentalOps(self): # Note: Experimental ops must be set to a shader model higher than the # most recent release until infrastructure is in place to opt-in to # experimental ops and the validator can force use of the PREVIEW hash. + + # Update experimental_sm to released + 1 minor version when highest + # released shader model is updated in latest-release.json. + experimental_sm = 6, 10 + insts = self.get_insts_by_names for i in insts("ExperimentalNop"): i.category = "No-op" - i.shader_model = 6, 10 + i.shader_model = experimental_sm # Group Wave Index / Count for i in insts("GetGroupWaveIndex,GetGroupWaveCount"): i.category = "Group Wave Ops" - i.shader_model = 6, 10 + i.shader_model = experimental_sm i.shader_stages = ("compute", "mesh", "amplification", "library") i.is_wave = True # Clustered Geometry for i in insts("ClusterID"): i.category = "Raytracing uint System Values" - i.shader_model = 6, 10 + i.shader_model = experimental_sm i.shader_stages = ( "library", "anyhit", @@ -1073,10 +1078,10 @@ def populate_categories_and_models_ExperimentalOps(self): ) for i in insts("RayQuery_CandidateClusterID,RayQuery_CommittedClusterID"): i.category = "Inline Ray Query" - i.shader_model = 6, 10 + i.shader_model = experimental_sm for i in insts("HitObject_ClusterID"): i.category = "Shader Execution Reordering" - i.shader_model = 6, 10 + i.shader_model = experimental_sm i.shader_stages = ( "library", "raygeneration", @@ -1087,7 +1092,7 @@ def populate_categories_and_models_ExperimentalOps(self): # Triangle Object Positions for i in insts("TriangleObjectPosition"): i.category = "Raytracing System Values" - i.shader_model = 6, 10 + i.shader_model = experimental_sm i.shader_stages = ( "library", "anyhit", @@ -1098,10 +1103,10 @@ def populate_categories_and_models_ExperimentalOps(self): "RayQuery_CommittedTriangleObjectPosition", ): i.category = "Inline Ray Query" - i.shader_model = 6, 10 + i.shader_model = experimental_sm for i in insts("HitObject_TriangleObjectPosition"): i.category = "Shader Execution Reordering" - i.shader_model = 6, 10 + i.shader_model = experimental_sm i.shader_stages = ( "library", "raygeneration", From c10d88b40fb8a412b748cdabf60ee73a20c46051 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Wed, 10 Dec 2025 11:58:13 -0800 Subject: [PATCH 11/11] Consistent casing for new DXIL op descriptions --- docs/DXIL.rst | 12 ++++++------ include/dxc/DXIL/DxilConstants.h | 24 ++++++++++++------------ include/dxc/DXIL/DxilInstructions.h | 12 ++++++------ utils/hct/hctdb.py | 12 ++++++------ 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/docs/DXIL.rst b/docs/DXIL.rst index 6b714f6d81..e9514212dd 100644 --- a/docs/DXIL.rst +++ b/docs/DXIL.rst @@ -3068,14 +3068,14 @@ ID Name Description 2147483648 ExperimentalNop nop does nothing 2147483649 GetGroupWaveIndex returns the index of the wave in the thread group 2147483650 GetGroupWaveCount returns the number of waves in the thread group -2147483651 ClusterID Returns the user-defined ClusterID of the intersected CLAS +2147483651 ClusterID returns the user-defined ClusterID of the intersected CLAS 2147483652 RayQuery_CandidateClusterID returns candidate hit cluster ID 2147483653 RayQuery_CommittedClusterID returns committed hit cluster ID -2147483654 HitObject_ClusterID Returns the cluster ID of this committed hit -2147483655 TriangleObjectPosition Returns triangle vertices in object space as <9 x float> -2147483656 RayQuery_CandidateTriangleObjectPosition Returns candidate triangle vertices in object space as <9 x float> -2147483657 RayQuery_CommittedTriangleObjectPosition Returns committed triangle vertices in object space as <9 x float> -2147483658 HitObject_TriangleObjectPosition Returns triangle vertices in object space as <9 x float> +2147483654 HitObject_ClusterID returns the cluster ID of this committed hit +2147483655 TriangleObjectPosition returns triangle vertices in object space as <9 x float> +2147483656 RayQuery_CandidateTriangleObjectPosition returns candidate triangle vertices in object space as <9 x float> +2147483657 RayQuery_CommittedTriangleObjectPosition returns committed triangle vertices in object space as <9 x float> +2147483658 HitObject_TriangleObjectPosition returns triangle vertices in object space as <9 x float> ========== ======================================== ================================================================== diff --git a/include/dxc/DXIL/DxilConstants.h b/include/dxc/DXIL/DxilConstants.h index 47255f19f4..83615dabfd 100644 --- a/include/dxc/DXIL/DxilConstants.h +++ b/include/dxc/DXIL/DxilConstants.h @@ -518,25 +518,25 @@ enum class OpCode : unsigned { // Inline Ray Query RayQuery_CandidateClusterID = 4, // returns candidate hit cluster ID RayQuery_CandidateTriangleObjectPosition = - 8, // Returns candidate triangle vertices in object space as <9 x float> + 8, // returns candidate triangle vertices in object space as <9 x float> RayQuery_CommittedClusterID = 5, // returns committed hit cluster ID RayQuery_CommittedTriangleObjectPosition = - 9, // Returns committed triangle vertices in object space as <9 x float> + 9, // returns committed triangle vertices in object space as <9 x float> // No-op ExperimentalNop = 0, // nop does nothing // Raytracing System Values TriangleObjectPosition = - 7, // Returns triangle vertices in object space as <9 x float> + 7, // returns triangle vertices in object space as <9 x float> // Raytracing uint System Values - ClusterID = 3, // Returns the user-defined ClusterID of the intersected CLAS + ClusterID = 3, // returns the user-defined ClusterID of the intersected CLAS // Shader Execution Reordering - HitObject_ClusterID = 6, // Returns the cluster ID of this committed hit + HitObject_ClusterID = 6, // returns the cluster ID of this committed hit HitObject_TriangleObjectPosition = - 10, // Returns triangle vertices in object space as <9 x float> + 10, // returns triangle vertices in object space as <9 x float> NumOpCodes = 11, // exclusive last value of enumeration }; @@ -1163,29 +1163,29 @@ enum class OpCode : unsigned { GetGroupWaveCount), // returns the number of waves in the thread group EXP_OPCODE( ExperimentalOps, - ClusterID), // Returns the user-defined ClusterID of the intersected CLAS + ClusterID), // returns the user-defined ClusterID of the intersected CLAS EXP_OPCODE(ExperimentalOps, RayQuery_CandidateClusterID), // returns candidate hit cluster ID EXP_OPCODE(ExperimentalOps, RayQuery_CommittedClusterID), // returns committed hit cluster ID EXP_OPCODE( ExperimentalOps, - HitObject_ClusterID), // Returns the cluster ID of this committed hit + HitObject_ClusterID), // returns the cluster ID of this committed hit EXP_OPCODE(ExperimentalOps, - TriangleObjectPosition), // Returns triangle vertices in object + TriangleObjectPosition), // returns triangle vertices in object // space as <9 x float> EXP_OPCODE( ExperimentalOps, - RayQuery_CandidateTriangleObjectPosition), // Returns candidate triangle + RayQuery_CandidateTriangleObjectPosition), // returns candidate triangle // vertices in object space as // <9 x float> EXP_OPCODE( ExperimentalOps, - RayQuery_CommittedTriangleObjectPosition), // Returns committed triangle + RayQuery_CommittedTriangleObjectPosition), // returns committed triangle // vertices in object space as // <9 x float> EXP_OPCODE(ExperimentalOps, - HitObject_TriangleObjectPosition), // Returns triangle vertices in + HitObject_TriangleObjectPosition), // returns triangle vertices in // object space as <9 x float> }; // OPCODE-ENUM:END diff --git a/include/dxc/DXIL/DxilInstructions.h b/include/dxc/DXIL/DxilInstructions.h index b700fe1c0c..2bef121009 100644 --- a/include/dxc/DXIL/DxilInstructions.h +++ b/include/dxc/DXIL/DxilInstructions.h @@ -10292,7 +10292,7 @@ struct DxilInst_GetGroupWaveCount { bool requiresUniformInputs() const { return false; } }; -/// This instruction Returns the user-defined ClusterID of the intersected CLAS +/// This instruction returns the user-defined ClusterID of the intersected CLAS struct DxilInst_ClusterID { llvm::Instruction *Instr; // Construction and identification @@ -10367,7 +10367,7 @@ struct DxilInst_RayQuery_CommittedClusterID { void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); } }; -/// This instruction Returns the cluster ID of this committed hit +/// This instruction returns the cluster ID of this committed hit struct DxilInst_HitObject_ClusterID { llvm::Instruction *Instr; // Construction and identification @@ -10394,7 +10394,7 @@ struct DxilInst_HitObject_ClusterID { void set_hitObject(llvm::Value *val) { Instr->setOperand(1, val); } }; -/// This instruction Returns triangle vertices in object space as <9 x float> +/// This instruction returns triangle vertices in object space as <9 x float> struct DxilInst_TriangleObjectPosition { llvm::Instruction *Instr; // Construction and identification @@ -10414,7 +10414,7 @@ struct DxilInst_TriangleObjectPosition { bool requiresUniformInputs() const { return false; } }; -/// This instruction Returns candidate triangle vertices in object space as <9 x +/// This instruction returns candidate triangle vertices in object space as <9 x /// float> struct DxilInst_RayQuery_CandidateTriangleObjectPosition { llvm::Instruction *Instr; @@ -10443,7 +10443,7 @@ struct DxilInst_RayQuery_CandidateTriangleObjectPosition { void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); } }; -/// This instruction Returns committed triangle vertices in object space as <9 x +/// This instruction returns committed triangle vertices in object space as <9 x /// float> struct DxilInst_RayQuery_CommittedTriangleObjectPosition { llvm::Instruction *Instr; @@ -10472,7 +10472,7 @@ struct DxilInst_RayQuery_CommittedTriangleObjectPosition { void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); } }; -/// This instruction Returns triangle vertices in object space as <9 x float> +/// This instruction returns triangle vertices in object space as <9 x float> struct DxilInst_HitObject_TriangleObjectPosition { llvm::Instruction *Instr; // Construction and identification diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 5d03e2a6c6..2ae135ebc8 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -6166,7 +6166,7 @@ def populate_ExperimentalOps(self): add_dxil_op( "ClusterID", "ClusterID", - "Returns the user-defined ClusterID of the intersected CLAS", + "returns the user-defined ClusterID of the intersected CLAS", "v", "rn", [db_dxil_param(0, "i32", "", "result")], @@ -6196,7 +6196,7 @@ def populate_ExperimentalOps(self): add_dxil_op( "HitObject_ClusterID", "HitObject_StateScalar", - "Returns the cluster ID of this committed hit", + "returns the cluster ID of this committed hit", "v", "rn", [ @@ -6209,7 +6209,7 @@ def populate_ExperimentalOps(self): add_dxil_op( "TriangleObjectPosition", "TriangleObjectPosition", - "Returns triangle vertices in object space as <9 x float>", + "returns triangle vertices in object space as <9 x float>", "f", "rn", [ @@ -6219,7 +6219,7 @@ def populate_ExperimentalOps(self): add_dxil_op( "RayQuery_CandidateTriangleObjectPosition", "RayQuery_CandidateTriangleObjectPosition", - "Returns candidate triangle vertices in object space as <9 x float>", + "returns candidate triangle vertices in object space as <9 x float>", "f", "ro", [ @@ -6230,7 +6230,7 @@ def populate_ExperimentalOps(self): add_dxil_op( "RayQuery_CommittedTriangleObjectPosition", "RayQuery_CommittedTriangleObjectPosition", - "Returns committed triangle vertices in object space as <9 x float>", + "returns committed triangle vertices in object space as <9 x float>", "f", "ro", [ @@ -6241,7 +6241,7 @@ def populate_ExperimentalOps(self): add_dxil_op( "HitObject_TriangleObjectPosition", "HitObject_TriangleObjectPosition", - "Returns triangle vertices in object space as <9 x float>", + "returns triangle vertices in object space as <9 x float>", "f", "rn", [