Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/DXIL/DxilOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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}
Expand Down
4 changes: 3 additions & 1 deletion utils/hct/hctdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading