Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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 llvm/lib/Target/DirectX/DXILRootSignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ analyzeModule(Module &M) {
return RSDMap;

for (const auto &RSDefNode : RootSignatureNode->operands()) {
if (RSDefNode->getNumOperands() != 2) {
if (RSDefNode->getNumOperands() != 3) {
reportError(Ctx, "Invalid format for Root Signature Definition. Pairs "
"of function, root signature expected.");
Comment on lines -312 to 314
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message no longer really makes sense - we don't expect pairs at all!

continue;
Expand Down Expand Up @@ -348,8 +348,14 @@ analyzeModule(Module &M) {
reportError(Ctx, "Root Element is not a metadata node.");
continue;
}

mcdxbc::RootSignatureDesc RSD;
if (std::optional<uint32_t> Version = extractMdIntValue(RSDefNode, 2))
RSD.Version = *Version;
else {
reportError(Ctx, "Invalid RSDefNode value, expected constant int");
continue;
}

// Clang emits the root signature data in dxcontainer following a specific
// sequence. First the header, then the root parameters. So the header
// offset will always equal to the header size.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ entry:
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }

!dx.rootsignatures = !{!2, !5} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
!5 = !{ i32 -1, !6 } ; function, root signature
!5 = !{ i32 -1, !6, i32 2 } ; function, root signature
!6 = !{ !7 } ; list of root signature elements
!7 = !{ !"RootFlags", i32 2 } ; 1 = allow_input_assembler_input_layout
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ entry:
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }

!dx.rootsignatures = !{!2, !5} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
!5 = !{ !3, !6 } ; function, root signature
!5 = !{ !3, !6, i32 2 } ; function, root signature
!6 = !{ !7 } ; list of root signature elements
!7 = !{ !"RootFlags", i32 2 } ; 1 = allow_input_assembler_input_layout
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ entry:
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }

!dx.rootsignatures = !{!2, !5} ; list of function/root signature pairs
!2 = !{ ptr @main, null } ; function, root signature
!2 = !{ ptr @main, null, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
!5 = !{ i32 -1, !6 } ; function, root signature
!5 = !{ i32 -1, !6, i32 2 } ; function, root signature
!6 = !{ !7 } ; list of root signature elements
!7 = !{ !"RootFlags", i32 2 } ; 1 = allow_input_assembler_input_layout
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ entry:
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }

!dx.rootsignatures = !{!2, !5} ; list of function/root signature pairs
!2 = !{ ptr @main, i32 -1 } ; function, root signature
!2 = !{ ptr @main, i32 -1, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
!5 = !{ i32 -1, !6 } ; function, root signature
!5 = !{ i32 -1, !6, i32 2 } ; function, root signature
!6 = !{ !7 } ; list of root signature elements
!7 = !{ !"RootFlags", i32 2 } ; 1 = allow_input_assembler_input_layout
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"NOTRootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ entry:
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }

!dx.rootsignatures = !{!2, !5} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
!5 = !{ ptr @anotherMain, !6 } ; function, root signature
!5 = !{ ptr @anotherMain, !6, i32 2 } ; function, root signature
!6 = !{ !7 } ; list of root signature elements
!7 = !{ !"RootFlags", i32 2 } ; 1 = allow_input_assembler_input_layout

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ entry:
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }

!dx.rootsignatures = !{!2, !5} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
!5 = !{ null, !6 } ; function, root signature
!5 = !{ null, !6, i32 2 } ; function, root signature
!6 = !{ !7 } ; list of root signature elements
!7 = !{ !"RootFlags", i32 2 } ; 1 = allow_input_assembler_input_layout
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ entry:
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }

!dx.rootsignatures = !{!0}
!0 = !{ ptr @main, !1 }
!0 = !{ ptr @main, !1, i32 2 }
!1 = !{ !2 }
!2 = !{ i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootConstants", i32 255, i32 1, i32 2, i32 3 }
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ entry:
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }

!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !4, !5, !6 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
!5 = !{ !"RootConstants", i32 0, i32 1, i32 2, i32 3 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ entry:
}

!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootConstants", i32 0, i32 1, i32 2, !"Invalid" }
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootConstants", i32 0, i32 1, !"Invalid", i32 3 }
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootConstants", i32 0, !"Invalid", i32 2, i32 3 }
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootConstants", i32 0, i32 1, i32 2, i32 3 }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 1 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootCBV", i32 0, i32 1, i32 2, i32 3 }
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"Invalid", i32 0, i32 1, i32 2, i32 3 }
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootCBV", i32 0, i32 1, i32 4294967280, i32 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootCBV", i32 0, i32 4294967295, i32 2, i32 3 }
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootCBV", i32 0, i32 1, i32 2, i32 8 }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
; RUN: opt %s -dxil-embed -dxil-globals -S -o - | FileCheck %s
; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC

target triple = "dxil-unknown-shadermodel6.0-compute"

; CHECK: @dx.rts0 = private constant [44 x i8] c"{{.*}}", section "RTS0", align 4

define void @main() #0 {
entry:
ret void
}
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3, i32 1 } ; function, root signature
!3 = !{ !5 } ; list of root signature elements
!5 = !{ !"RootCBV", i32 0, i32 1, i32 2, i32 8 }

; DXC: - Name: RTS0
; DXC-NEXT: Size: 44
; DXC-NEXT: RootSignature:
; DXC-NEXT: Version: 1
; DXC-NEXT: NumRootParameters: 1
; DXC-NEXT: RootParametersOffset: 24
; DXC-NEXT: NumStaticSamplers: 0
; DXC-NEXT: StaticSamplersOffset: 0
; DXC-NEXT: Parameters:
; DXC-NEXT: - ParameterType: 2
; DXC-NEXT: ShaderVisibility: 0
; DXC-NEXT: Descriptor:
; DXC-NEXT: RegisterSpace: 2
; DXC-NEXT: ShaderRegister: 1
; DXC-NOT: DATA_STATIC: true
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !"NOTRootElements" } ; list of root signature elements
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }


!dx.rootsignatures = !{!2} ; list of function/root signature pairs
!2 = !{ ptr @main, !3 } ; function, root signature
!2 = !{ ptr @main, !3, i32 2 } ; function, root signature
!3 = !{ !4 } ; list of root signature elements
!4 = !{ !"RootFlags", i32 2147487744 } ; 1 = allow_input_assembler_input_layout
Loading