|
1 | 1 | ; RUN: opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 |
2 | 2 | ; expected-no-diagnostics |
3 | 3 |
|
4 | | -; |
5 | | -; Resource Bindings: |
6 | | -; |
7 | | -; Name Type Format Dim ID HLSL Bind Count |
8 | | -; ------------------------------ ---------- ------- ----------- ------- -------------- --------- |
9 | | -; In texture struct r/o T0 t0 1 |
10 | | -; Out UAV struct r/w U0 u0 1 |
11 | | -; UAV3 UAV struct r/w U1 u1 1 |
12 | | -; UAV1 UAV struct r/w U2 u2 1 |
13 | | -; UAV UAV struct r/w U3 u4294967294 1 |
14 | | -; CB cbuffer NA NA CB0 cb3,space1 1 |
15 | | -; |
16 | | -; ModuleID = '../clang/test/SemaHLSL/RootSignature-Validation.hlsl' |
17 | | -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" |
18 | | -target triple = "dxilv1.5-unknown-shadermodel6.5-compute" |
| 4 | + |
| 5 | +; Root Signature( |
| 6 | +; CBV(b3, space=1, visibility=SHADER_VISIBILITY_ALL) |
| 7 | +; DescriptorTable(SRV(t0, space=0, numDescriptors=1), visibility=SHADER_VISIBILITY_ALL) |
| 8 | +; DescriptorTable(Sampler(s0, numDescriptors=2), visibility=SHADER_VISIBILITY_VERTEX) |
| 9 | +; DescriptorTable(UAV(u0, numDescriptors=unbounded), visibility=SHADER_VISIBILITY_ALL) |
19 | 10 |
|
20 | 11 | %__cblayout_CB = type <{ float }> |
21 | | -%"StructuredBuffer<int32_t>" = type { i32 } |
22 | | -%"RWStructuredBuffer<int32_t>" = type { i32 } |
23 | | -%"RWStructuredBuffer<float>" = type { float } |
24 | | -%CBuffer.CB = type { float } |
25 | 12 |
|
26 | | -@CB.cb = local_unnamed_addr global target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) poison |
27 | 13 | @CB.str = private unnamed_addr constant [3 x i8] c"CB\00", align 1 |
28 | | -@.str = private unnamed_addr constant [3 x i8] c"In\00", align 1 |
29 | | -@.str.2 = private unnamed_addr constant [4 x i8] c"Out\00", align 1 |
30 | | -@.str.4 = private unnamed_addr constant [4 x i8] c"UAV\00", align 1 |
31 | | -@.str.6 = private unnamed_addr constant [5 x i8] c"UAV1\00", align 1 |
32 | | -@.str.10 = private unnamed_addr constant [5 x i8] c"UAV3\00", align 1 |
33 | | -@In = external constant %"StructuredBuffer<int32_t>" |
34 | | -@Out = external constant %"RWStructuredBuffer<int32_t>" |
35 | | -@UAV3 = external constant %"RWStructuredBuffer<float>" |
36 | | -@UAV1 = external constant %"RWStructuredBuffer<float>" |
37 | | -@UAV = external constant %"RWStructuredBuffer<float>" |
38 | | -@CB = external constant %CBuffer.CB |
39 | | - |
40 | | -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) |
41 | | -declare target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) @llvm.dx.resource.handlefrombinding.tdx.CBuffer_tdx.Layout_s___cblayout_CBs_4_0tt(i32, i32, i32, i32, i1, ptr) #0 |
| 14 | +@Smp.str = private unnamed_addr constant [4 x i8] c"Smp\00", align 1 |
| 15 | +@SB.str = private unnamed_addr constant [3 x i8] c"SB\00", align 1 |
| 16 | +@RWB.str = private unnamed_addr constant [4 x i8] c"RWB\00", align 1 |
42 | 17 |
|
43 | | -; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) |
44 | | -define void @CSMain() local_unnamed_addr #1 { |
| 18 | +define void @CSMain() "hlsl.shader"="compute" { |
45 | 19 | entry: |
46 | | - %CB.cb_h.i.i = tail call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) @llvm.dx.resource.handlefrombinding.tdx.CBuffer_tdx.Layout_s___cblayout_CBs_4_0tt(i32 1, i32 3, i32 1, i32 0, i1 false, ptr nonnull @CB.str) |
47 | | - store target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) %CB.cb_h.i.i, ptr @CB.cb, align 4 |
48 | | - %0 = tail call target("dx.RawBuffer", i32, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i32_0_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr nonnull @.str) |
49 | | - %1 = tail call target("dx.RawBuffer", i32, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i32_1_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr nonnull @.str.2) |
50 | | - %2 = tail call target("dx.RawBuffer", float, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_1_0t(i32 0, i32 -2, i32 1, i32 0, i1 false, ptr nonnull @.str.4) |
51 | | - %3 = tail call target("dx.RawBuffer", float, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_1_0t(i32 0, i32 2, i32 1, i32 0, i1 false, ptr nonnull @.str.6) |
52 | | - %4 = call target("dx.RawBuffer", float, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_1_0t(i32 0, i32 1, i32 1, i32 0, i1 false, ptr @.str.10) |
53 | | - %5 = call { float, float, float, float } @llvm.dx.resource.load.cbufferrow.4.f32.f32.f32.f32.tdx.CBuffer_tdx.Layout_s___cblayout_CBs_4_0tt(target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) %CB.cb_h.i.i, i32 0) |
54 | | - %6 = extractvalue { float, float, float, float } %5, 0 |
55 | | - %7 = call { i32, i1 } @llvm.dx.resource.load.rawbuffer.i32.tdx.RawBuffer_i32_0_0t(target("dx.RawBuffer", i32, 0, 0) %0, i32 0, i32 0) |
56 | | - %8 = extractvalue { i32, i1 } %7, 0 |
57 | | - %conv.i = sitofp i32 %8 to float |
58 | | - %add.i = fadd reassoc nnan ninf nsz arcp afn float %6, %conv.i |
59 | | - %9 = call { float, i1 } @llvm.dx.resource.load.rawbuffer.f32.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0) %2, i32 0, i32 0) |
60 | | - %10 = extractvalue { float, i1 } %9, 0 |
61 | | - %add2.i = fadd reassoc nnan ninf nsz arcp afn float %add.i, %10 |
62 | | - %11 = call { float, i1 } @llvm.dx.resource.load.rawbuffer.f32.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0) %3, i32 0, i32 0) |
63 | | - %12 = extractvalue { float, i1 } %11, 0 |
64 | | - %add4.i = fadd reassoc nnan ninf nsz arcp afn float %add2.i, %12 |
65 | | - %13 = call { float, i1 } @llvm.dx.resource.load.rawbuffer.f32.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0) %4, i32 0, i32 0) |
66 | | - %14 = extractvalue { float, i1 } %13, 0 |
67 | | - %add6.i = fadd reassoc nnan ninf nsz arcp afn float %add4.i, %14 |
68 | | - %conv7.i = fptosi float %add6.i to i32 |
69 | | - call void @llvm.dx.resource.store.rawbuffer.tdx.RawBuffer_i32_1_0t.i32(target("dx.RawBuffer", i32, 1, 0) %1, i32 0, i32 0, i32 %conv7.i) |
70 | | - ret void |
71 | | -} |
72 | | - |
73 | | -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) |
74 | | -declare target("dx.RawBuffer", i32, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i32_0_0t(i32, i32, i32, i32, i1, ptr) #0 |
75 | | - |
76 | | -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) |
77 | | -declare target("dx.RawBuffer", i32, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i32_1_0t(i32, i32, i32, i32, i1, ptr) #0 |
78 | | - |
79 | | -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) |
80 | | -declare target("dx.RawBuffer", float, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_1_0t(i32, i32, i32, i32, i1, ptr) #0 |
81 | | - |
82 | | -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) |
83 | | -declare ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_i32_1_0t(target("dx.RawBuffer", i32, 1, 0), i32) #0 |
84 | 20 |
|
85 | | -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) |
86 | | -declare ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_i32_0_0t(target("dx.RawBuffer", i32, 0, 0), i32) #0 |
| 21 | + %CB = tail call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)) @llvm.dx.resource.handlefrombinding(i32 1, i32 3, i32 1, i32 0, i1 false, ptr nonnull @CB.str) |
| 22 | + %Sampler = call target("dx.Sampler", 0) @llvm.dx.resource.handlefrombinding(i32 2, i32 3, i32 1, i32 0, i1 false, ptr nonnull @Smp.str) |
| 23 | + %SB = tail call target("dx.RawBuffer", i32, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i32_0_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr nonnull @SB.str) |
| 24 | + %RWB = tail call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f32_1_0_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr nonnull @RWB.str) |
87 | 25 |
|
88 | | -; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none) |
89 | | -declare ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0), i32) #0 |
90 | | - |
91 | | -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(read) |
92 | | -declare { i32, i1 } @llvm.dx.resource.load.rawbuffer.i32.tdx.RawBuffer_i32_0_0t(target("dx.RawBuffer", i32, 0, 0), i32, i32) #2 |
93 | | - |
94 | | -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(read) |
95 | | -declare { float, i1 } @llvm.dx.resource.load.rawbuffer.f32.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0), i32, i32) #2 |
96 | | - |
97 | | -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(write) |
98 | | -declare void @llvm.dx.resource.store.rawbuffer.tdx.RawBuffer_i32_1_0t.i32(target("dx.RawBuffer", i32, 1, 0), i32, i32, i32) #3 |
99 | | - |
100 | | -; Function Attrs: nocallback nofree nosync nounwind willreturn memory(read) |
101 | | -declare { float, float, float, float } @llvm.dx.resource.load.cbufferrow.4.f32.f32.f32.f32.tdx.CBuffer_tdx.Layout_s___cblayout_CBs_4_0tt(target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 4, 0)), i32) #2 |
102 | | - |
103 | | -; uselistorder directives |
104 | | -uselistorder ptr @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_1_0t, { 2, 1, 0 } |
105 | | -uselistorder ptr @llvm.dx.resource.load.rawbuffer.f32.tdx.RawBuffer_f32_1_0t, { 2, 1, 0 } |
106 | | - |
107 | | -attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(none) } |
108 | | -attributes #1 = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) "approx-func-fp-math"="false" "frame-pointer"="all" "hlsl.numthreads"="8,8,1" "hlsl.shader"="compute" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
109 | | -attributes #2 = { nocallback nofree nosync nounwind willreturn memory(read) } |
110 | | -attributes #3 = { nocallback nofree nosync nounwind willreturn memory(write) } |
| 26 | + ret void |
| 27 | +} |
111 | 28 |
|
112 | 29 | !dx.rootsignatures = !{!0} |
113 | | -!llvm.module.flags = !{!9, !10} |
114 | | -!dx.valver = !{!11} |
115 | | -!llvm.ident = !{!12} |
116 | | -!dx.shaderModel = !{!13} |
117 | | -!dx.version = !{!14} |
118 | | -!dx.resources = !{!15} |
119 | | -!dx.entryPoints = !{!26} |
120 | 30 |
|
121 | 31 | !0 = !{ptr @CSMain, !1, i32 2} |
122 | 32 | !1 = !{!2, !3, !5, !7} |
123 | 33 | !2 = !{!"RootCBV", i32 0, i32 3, i32 1, i32 4} |
124 | 34 | !3 = !{!"DescriptorTable", i32 0, !4} |
125 | | -!4 = !{!"SRV", i32 1, i32 0, i32 0, i32 -1, i32 4} |
126 | | -!5 = !{!"DescriptorTable", i32 1, !6} |
127 | | -!6 = !{!"Sampler", i32 2, i32 0, i32 0, i32 -1, i32 0} |
| 35 | +!4 = !{!"SRV", i32 1, i32 0, i32 0, i32 -1, i32 0} |
| 36 | +!5 = !{!"DescriptorTable", i32 0, !6} |
| 37 | +!6 = !{!"Sampler", i32 5, i32 3, i32 2, i32 -1, i32 0} |
128 | 38 | !7 = !{!"DescriptorTable", i32 0, !8} |
129 | 39 | !8 = !{!"UAV", i32 -1, i32 0, i32 0, i32 -1, i32 2} |
130 | | -!9 = !{i32 1, !"wchar_size", i32 4} |
131 | | -!10 = !{i32 7, !"frame-pointer", i32 2} |
132 | | -!11 = !{i32 1, i32 8} |
133 | | -!12 = !{!"clang version 21.0.0git (https://github.com/joaosaffran/llvm-project.git c16f15b4cd469a3f6efc2e4b0e098190d7fd0787)"} |
134 | | -!13 = !{!"cs", i32 6, i32 5} |
135 | | -!14 = !{i32 1, i32 5} |
136 | | -!15 = !{!16, !19, !24, null} |
137 | | -!16 = !{!17} |
138 | | -!17 = !{i32 0, ptr @In, !"In", i32 0, i32 0, i32 1, i32 12, i32 0, !18} |
139 | | -!18 = !{i32 1, i32 4} |
140 | | -!19 = !{!20, !21, !22, !23} |
141 | | -!20 = !{i32 0, ptr @Out, !"Out", i32 0, i32 0, i32 1, i32 12, i1 false, i1 false, i1 false, !18} |
142 | | -!21 = !{i32 1, ptr @UAV3, !"UAV3", i32 0, i32 1, i32 1, i32 12, i1 false, i1 false, i1 false, !18} |
143 | | -!22 = !{i32 2, ptr @UAV1, !"UAV1", i32 0, i32 2, i32 1, i32 12, i1 false, i1 false, i1 false, !18} |
144 | | -!23 = !{i32 3, ptr @UAV, !"UAV", i32 0, i32 -2, i32 1, i32 12, i1 false, i1 false, i1 false, !18} |
145 | | -!24 = !{!25} |
146 | | -!25 = !{i32 0, ptr @CB, !"CB", i32 1, i32 3, i32 1, i32 4, null} |
147 | | -!26 = !{ptr @CSMain, !"CSMain", null, !15, !27} |
148 | | -!27 = !{i32 0, i64 16, i32 4, !28} |
149 | | -!28 = !{i32 8, i32 8, i32 1} |
0 commit comments