Skip to content

Commit 571a0ef

Browse files
author
joaosaffran
committed
fix tests
1 parent c16f15b commit 571a0ef

File tree

4 files changed

+309
-68
lines changed

4 files changed

+309
-68
lines changed

clang/test/SemaHLSL/RootSignature-Validation-Fail.hlsl

Lines changed: 0 additions & 35 deletions
This file was deleted.

clang/test/SemaHLSL/RootSignature-Validation.hlsl

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

0 commit comments

Comments
 (0)