From 537140d38e675f0a0cc5c590f5c67abea5fb2d9c Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 12:29:55 -0800 Subject: [PATCH 1/3] Update ExperimentalNop, tests, add instructions for release shader model update --- lib/DXIL/DxilOperations.cpp | 10 ++++++++-- ...-6-9.ll => experimental-op-on-release-sm.ll} | 8 ++++++++ ....ll => experimental2-op-on-experimental1.ll} | 17 ++++++++++++++--- utils/hct/hctdb.py | 4 +++- 4 files changed, 33 insertions(+), 6 deletions(-) rename tools/clang/test/LitDXILValidation/{invalid-experimental-dxil-6-10-op-on-6-9.ll => experimental-op-on-release-sm.ll} (78%) rename tools/clang/test/LitDXILValidation/{invalid-experimental-dxil-6-10-op-on-6-8.ll => experimental2-op-on-experimental1.ll} (62%) diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index e03682959a..d9320a9c86 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -3636,12 +3636,18 @@ 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 + if ((305 <= op && op <= 308)) { major = 6; minor = 10; return; } + // Instructions: ExperimentalNop=2147483648 + if (op == 2147483648) { + major = 6; + minor = 11; + return; + } // OPCODE-SMMASK:END } diff --git a/tools/clang/test/LitDXILValidation/invalid-experimental-dxil-6-10-op-on-6-9.ll b/tools/clang/test/LitDXILValidation/experimental-op-on-release-sm.ll similarity index 78% rename from tools/clang/test/LitDXILValidation/invalid-experimental-dxil-6-10-op-on-6-9.ll rename to tools/clang/test/LitDXILValidation/experimental-op-on-release-sm.ll index 851176466b..4beef3d376 100644 --- a/tools/clang/test/LitDXILValidation/invalid-experimental-dxil-6-10-op-on-6-9.ll +++ b/tools/clang/test/LitDXILValidation/experimental-op-on-release-sm.ll @@ -3,6 +3,14 @@ target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" target triple = "dxil-ms-dx" +; Test that an experimental opcode is not allowed in a non-experimental shader model. + +; Update instructions for when release shader model is updated: +; After updating ExperimentalNop shader_model to latest release + 2 in hctdb.py: +; Update metadata to latest released: +; - !1 metadata for DXIL version +; - !2 metadata for shader model + ; CHECK: Function: main: error: Use of experimental DXILOpCode requires an experimental shader model. ; CHECK-NEXT: note: at 'call void @dx.op.nop(i32 -2147483648)' in block '#0' of function 'main'. ; CHECK-NEXT: Function: main: error: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. diff --git a/tools/clang/test/LitDXILValidation/invalid-experimental-dxil-6-10-op-on-6-8.ll b/tools/clang/test/LitDXILValidation/experimental2-op-on-experimental1.ll similarity index 62% rename from tools/clang/test/LitDXILValidation/invalid-experimental-dxil-6-10-op-on-6-8.ll rename to tools/clang/test/LitDXILValidation/experimental2-op-on-experimental1.ll index 438cb03c2c..992218b3b2 100644 --- a/tools/clang/test/LitDXILValidation/invalid-experimental-dxil-6-10-op-on-6-8.ll +++ b/tools/clang/test/LitDXILValidation/experimental2-op-on-experimental1.ll @@ -3,7 +3,18 @@ target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" target triple = "dxil-ms-dx" -; CHECK: Function: main: error: Use of experimental DXILOpCode requires an experimental shader model. +; This test checks that even when targting an experimental shader model, if +; it's not high enough for the operation, it fails based on the shader model +; requirement. + +; Update instructions for when release shader model is updated: +; After updating ExperimentalNop shader_model to latest release + 2 in hctdb.py: +; Update metadata to first experimental (one past latest released): +; - !1 metadata for DXIL version +; - !2 metadata for shader model +; Update CHECK line with the experimental shader model used. + +; CHECK: Function: main: error: Opcode ExperimentalNop not valid in shader model cs_6_10. ; CHECK-NEXT: note: at 'call void @dx.op.nop(i32 -2147483648)' in block '#0' of function 'main'. ; CHECK-NEXT: Function: main: error: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. ; CHECK-NEXT: Function: main: error: Function uses features incompatible with the shader model. @@ -27,8 +38,8 @@ attributes #0 = { nounwind readnone } !dx.entryPoints = !{!6} !0 = !{!"custom IR"} -!1 = !{i32 1, i32 8} -!2 = !{!"cs", i32 6, i32 8} +!1 = !{i32 1, i32 10} +!2 = !{!"cs", i32 6, i32 10} !3 = !{null, null, null, null} !6 = !{void ()* @main, !"main", null, !3, !7} !7 = !{i32 0, i64 0, i32 4, !8} diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 490ce8080f..dd519da6ca 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1044,8 +1044,10 @@ def populate_categories_and_models_ExperimentalOps(self): # 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(","): + # Update instructions for when release shader model is updated: + # set minor version to released SM + 2 for testing purposes self.name_idx[i].category = "No-op" - self.name_idx[i].shader_model = 6, 10 + self.name_idx[i].shader_model = 6, 11 def populate_llvm_instructions(self): # Add instructions that map to LLVM instructions. From 8c62637f82bb81b1a77fdde459615905f1a2817a Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Tue, 9 Dec 2025 16:30:00 -0800 Subject: [PATCH 2/3] Move back to 6.10, remove +2 test --- lib/DXIL/DxilOperations.cpp | 10 +--- .../experimental-op-on-release-sm.ll | 2 +- .../experimental2-op-on-experimental1.ll | 46 ------------------- utils/hct/hctdb.py | 4 +- 4 files changed, 5 insertions(+), 57 deletions(-) delete mode 100644 tools/clang/test/LitDXILValidation/experimental2-op-on-experimental1.ll diff --git a/lib/DXIL/DxilOperations.cpp b/lib/DXIL/DxilOperations.cpp index d9320a9c86..e03682959a 100644 --- a/lib/DXIL/DxilOperations.cpp +++ b/lib/DXIL/DxilOperations.cpp @@ -3636,18 +3636,12 @@ void OP::GetMinShaderModelAndMask(OpCode C, bool bWithTranslation, return; } // Instructions: MatVecMul=305, MatVecMulAdd=306, OuterProductAccumulate=307, - // VectorAccumulate=308 - if ((305 <= op && op <= 308)) { + // VectorAccumulate=308, ExperimentalNop=2147483648 + if ((305 <= op && op <= 308) || op == 2147483648) { major = 6; minor = 10; return; } - // Instructions: ExperimentalNop=2147483648 - if (op == 2147483648) { - major = 6; - minor = 11; - return; - } // OPCODE-SMMASK:END } diff --git a/tools/clang/test/LitDXILValidation/experimental-op-on-release-sm.ll b/tools/clang/test/LitDXILValidation/experimental-op-on-release-sm.ll index 4beef3d376..14a7f1691d 100644 --- a/tools/clang/test/LitDXILValidation/experimental-op-on-release-sm.ll +++ b/tools/clang/test/LitDXILValidation/experimental-op-on-release-sm.ll @@ -6,7 +6,7 @@ target triple = "dxil-ms-dx" ; Test that an experimental opcode is not allowed in a non-experimental shader model. ; Update instructions for when release shader model is updated: -; After updating ExperimentalNop shader_model to latest release + 2 in hctdb.py: +; After updating ExperimentalNop shader_model to latest experimental in hctdb.py: ; Update metadata to latest released: ; - !1 metadata for DXIL version ; - !2 metadata for shader model diff --git a/tools/clang/test/LitDXILValidation/experimental2-op-on-experimental1.ll b/tools/clang/test/LitDXILValidation/experimental2-op-on-experimental1.ll deleted file mode 100644 index 992218b3b2..0000000000 --- a/tools/clang/test/LitDXILValidation/experimental2-op-on-experimental1.ll +++ /dev/null @@ -1,46 +0,0 @@ -; REQUIRES: dxil-1-10 -; RUN: not %dxv %s 2>&1 | FileCheck %s -target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" -target triple = "dxil-ms-dx" - -; This test checks that even when targting an experimental shader model, if -; it's not high enough for the operation, it fails based on the shader model -; requirement. - -; Update instructions for when release shader model is updated: -; After updating ExperimentalNop shader_model to latest release + 2 in hctdb.py: -; Update metadata to first experimental (one past latest released): -; - !1 metadata for DXIL version -; - !2 metadata for shader model -; Update CHECK line with the experimental shader model used. - -; CHECK: Function: main: error: Opcode ExperimentalNop not valid in shader model cs_6_10. -; CHECK-NEXT: note: at 'call void @dx.op.nop(i32 -2147483648)' in block '#0' of function 'main'. -; CHECK-NEXT: Function: main: error: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. -; CHECK-NEXT: Function: main: error: Function uses features incompatible with the shader model. -; CHECK-NEXT: Validation failed. - -define void @main() { - call void @dx.op.nop(i32 -2147483648) - ret void -} - -; Function Attrs: nounwind readnone -declare void @dx.op.nop(i32) #0 - -attributes #0 = { nounwind readnone } - -!llvm.ident = !{!0} -!dx.version = !{!1} -!dx.valver = !{!1} -!dx.shaderModel = !{!2} -!dx.resources = !{!3} -!dx.entryPoints = !{!6} - -!0 = !{!"custom IR"} -!1 = !{i32 1, i32 10} -!2 = !{!"cs", i32 6, i32 10} -!3 = !{null, null, null, null} -!6 = !{void ()* @main, !"main", null, !3, !7} -!7 = !{i32 0, i64 0, i32 4, !8} -!8 = !{i32 4, i32 1, i32 1} diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index dd519da6ca..6b9976c4c9 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1045,9 +1045,9 @@ def populate_categories_and_models_ExperimentalOps(self): # experimental ops and the validator can force use of the PREVIEW hash. for i in "ExperimentalNop".split(","): # Update instructions for when release shader model is updated: - # set minor version to released SM + 2 for testing purposes + # set shader_model to latest experimental (like released + 1 minor) self.name_idx[i].category = "No-op" - self.name_idx[i].shader_model = 6, 11 + self.name_idx[i].shader_model = 6, 10 def populate_llvm_instructions(self): # Add instructions that map to LLVM instructions. From 8ba03956e00f9ce607e2539608cba6250da241b8 Mon Sep 17 00:00:00 2001 From: Tex Riddell Date: Wed, 10 Dec 2025 12:23:01 -0800 Subject: [PATCH 3/3] Removed hctdb.py comment; this is covered by another PR now, and would only create a conflict. --- utils/hct/hctdb.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/utils/hct/hctdb.py b/utils/hct/hctdb.py index 6b9976c4c9..490ce8080f 100644 --- a/utils/hct/hctdb.py +++ b/utils/hct/hctdb.py @@ -1044,8 +1044,6 @@ def populate_categories_and_models_ExperimentalOps(self): # 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(","): - # Update instructions for when release shader model is updated: - # set shader_model to latest experimental (like released + 1 minor) self.name_idx[i].category = "No-op" self.name_idx[i].shader_model = 6, 10