Skip to content

Commit 65a341b

Browse files
more tests
1 parent 6db22a6 commit 65a341b

8 files changed

+1290
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#--- source.hlsl
2+
RWStructuredBuffer<uint> _participant_check_sum : register(u1);
3+
4+
[numthreads(64, 1, 1)]
5+
void main(uint3 tid : SV_DispatchThreadID) {
6+
_participant_check_sum[tid.x] = 0;
7+
uint result = 0;
8+
for (uint i0 = 0; (i0 < 2); i0 = (i0 + 1)) {
9+
if ((WaveGetLaneIndex() >= 46)) {
10+
result = (result + WaveActiveMin(3));
11+
uint _participantCount = WaveActiveSum(1);
12+
bool _isCorrect = (_participantCount == 18);
13+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
14+
}
15+
for (uint i1 = 0; (i1 < 3); i1 = (i1 + 1)) {
16+
if ((WaveGetLaneIndex() == 0)) {
17+
result = (result + WaveActiveSum((WaveGetLaneIndex() + 4)));
18+
uint _participantCount = WaveActiveSum(1);
19+
bool _isCorrect = (_participantCount == 1);
20+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
21+
}
22+
if (((((WaveGetLaneIndex() == 7) || (WaveGetLaneIndex() == 22)) || (WaveGetLaneIndex() == 34)) || (WaveGetLaneIndex() == 51))) {
23+
if (((((WaveGetLaneIndex() == 1) || (WaveGetLaneIndex() == 20)) || (WaveGetLaneIndex() == 34)) || (WaveGetLaneIndex() == 51))) {
24+
result = (result + WaveActiveMax((WaveGetLaneIndex() + 5)));
25+
uint _participantCount = WaveActiveSum(1);
26+
bool _isCorrect = (_participantCount == 2);
27+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
28+
}
29+
if (((WaveGetLaneIndex() == 19) || (WaveGetLaneIndex() == 54))) {
30+
result = (result + WaveActiveMin(result));
31+
uint _participantCount = WaveActiveSum(1);
32+
bool _isCorrect = (_participantCount == 0);
33+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
34+
}
35+
}
36+
if ((WaveGetLaneIndex() == 39)) {
37+
result = (result + WaveActiveMax((WaveGetLaneIndex() + 2)));
38+
uint _participantCount = WaveActiveSum(1);
39+
bool _isCorrect = (_participantCount == 1);
40+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
41+
}
42+
if ((i1 == 2)) {
43+
break;
44+
}
45+
}
46+
if ((WaveGetLaneIndex() < 7)) {
47+
result = (result + WaveActiveMin(4));
48+
uint _participantCount = WaveActiveSum(1);
49+
bool _isCorrect = (_participantCount == 7);
50+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
51+
}
52+
if ((i0 == 1)) {
53+
continue;
54+
}
55+
}
56+
switch ((WaveGetLaneIndex() % 2)) {
57+
case 0: {
58+
for (uint i2 = 0; (i2 < 2); i2 = (i2 + 1)) {
59+
if ((WaveGetLaneIndex() < 28)) {
60+
result = (result + WaveActiveMin(WaveGetLaneIndex()));
61+
uint _participantCount = WaveActiveSum(1);
62+
bool _isCorrect = (_participantCount == 14);
63+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
64+
}
65+
if (((WaveGetLaneIndex() < 12) || (WaveGetLaneIndex() >= 52))) {
66+
if (((WaveGetLaneIndex() < 18) || (WaveGetLaneIndex() >= 58))) {
67+
result = (result + WaveActiveMin((WaveGetLaneIndex() + 4)));
68+
uint _participantCount = WaveActiveSum(1);
69+
bool _isCorrect = (_participantCount == 9);
70+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
71+
}
72+
if (((WaveGetLaneIndex() < 16) || (WaveGetLaneIndex() >= 50))) {
73+
result = (result + WaveActiveMin(result));
74+
uint _participantCount = WaveActiveSum(1);
75+
bool _isCorrect = (_participantCount == 12);
76+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
77+
}
78+
} else {
79+
if ((WaveGetLaneIndex() < 24)) {
80+
result = (result + WaveActiveMax(1));
81+
uint _participantCount = WaveActiveSum(1);
82+
bool _isCorrect = (_participantCount == 6);
83+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
84+
}
85+
}
86+
}
87+
break;
88+
}
89+
case 1: {
90+
if (((WaveGetLaneIndex() % 2) == 0)) {
91+
result = (result + WaveActiveSum(2));
92+
uint _participantCount = WaveActiveSum(1);
93+
bool _isCorrect = (_participantCount == 0);
94+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
95+
}
96+
break;
97+
}
98+
default: {
99+
result = (result + WaveActiveSum(99));
100+
uint _participantCount = WaveActiveSum(1);
101+
bool _isCorrect = (_participantCount == 0);
102+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
103+
break;
104+
}
105+
}
106+
}
107+
108+
#--- pipeline.yaml
109+
---
110+
Shaders:
111+
- Stage: Compute
112+
Entry: main
113+
DispatchSize: [1, 1, 1] # Single dispatch for 64 threads
114+
Buffers:
115+
- Name: _participant_check_sum
116+
Format: UInt32
117+
Stride: 4
118+
Fill: 0
119+
Size: 64
120+
- Name: expected_participants
121+
Format: UInt32
122+
Stride: 4
123+
Data: [14, 2, 8, 2, 8, 2, 8, 0, 6, 0, 6, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 8, 4, 2, 4, 2, 4, 2, 6, 2, 6, 2, 6, 2]
124+
Results:
125+
- Result: WaveOpValidation
126+
Rule: BufferExact
127+
Actual: _participant_check_sum
128+
Expected: expected_participants
129+
DescriptorSets:
130+
- Resources:
131+
- Name: _participant_check_sum
132+
Kind: RWStructuredBuffer
133+
DirectXBinding:
134+
Register: 1
135+
Space: 0
136+
VulkanBinding:
137+
Binding: 1
138+
...
139+
#--- end
140+
141+
# RUN: split-file %s %t
142+
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
143+
# RUN: %offloader %t/pipeline.yaml %t.o
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
#--- source.hlsl
2+
RWStructuredBuffer<uint> _participant_check_sum : register(u1);
3+
4+
[numthreads(64, 1, 1)]
5+
void main(uint3 tid : SV_DispatchThreadID) {
6+
_participant_check_sum[tid.x] = 0;
7+
uint result = 0;
8+
switch ((WaveGetLaneIndex() % 3)) {
9+
case 0: {
10+
if ((WaveGetLaneIndex() < 8)) {
11+
result = (result + WaveActiveSum(1));
12+
uint _participantCount = WaveActiveSum(1);
13+
bool _isCorrect = (_participantCount == 3);
14+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
15+
}
16+
break;
17+
}
18+
case 1: {
19+
if (((WaveGetLaneIndex() % 2) == 0)) {
20+
result = (result + WaveActiveSum(2));
21+
uint _participantCount = WaveActiveSum(1);
22+
bool _isCorrect = (_participantCount == 10);
23+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
24+
}
25+
break;
26+
}
27+
case 2: {
28+
if ((WaveGetLaneIndex() == 13)) {
29+
if ((WaveGetLaneIndex() == 36)) {
30+
result = (result + WaveActiveMax(result));
31+
uint _participantCount = WaveActiveSum(1);
32+
bool _isCorrect = (_participantCount == 0);
33+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
34+
}
35+
switch ((WaveGetLaneIndex() % 2)) {
36+
case 0: {
37+
uint counter0 = 0;
38+
while ((counter0 < 2)) {
39+
counter0 = (counter0 + 1);
40+
if (((WaveGetLaneIndex() & 1) == 1)) {
41+
result = (result + WaveActiveMin((WaveGetLaneIndex() + 3)));
42+
uint _participantCount = WaveActiveSum(1);
43+
bool _isCorrect = (_participantCount == 0);
44+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
45+
}
46+
}
47+
break;
48+
}
49+
case 1: {
50+
if (((((WaveGetLaneIndex() == 18) || (WaveGetLaneIndex() == 41)) || (WaveGetLaneIndex() == 49)) || (WaveGetLaneIndex() == 32))) {
51+
if (((((WaveGetLaneIndex() == 7) || (WaveGetLaneIndex() == 27)) || (WaveGetLaneIndex() == 47)) || (WaveGetLaneIndex() == 21))) {
52+
result = (result + WaveActiveSum(9));
53+
uint _participantCount = WaveActiveSum(1);
54+
bool _isCorrect = (_participantCount == 0);
55+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
56+
}
57+
if (((((WaveGetLaneIndex() == 17) || (WaveGetLaneIndex() == 35)) || (WaveGetLaneIndex() == 59)) || (WaveGetLaneIndex() == 48))) {
58+
result = (result + WaveActiveMin(result));
59+
uint _participantCount = WaveActiveSum(1);
60+
bool _isCorrect = (_participantCount == 0);
61+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
62+
}
63+
} else {
64+
if ((WaveGetLaneIndex() == 50)) {
65+
result = (result + WaveActiveSum(result));
66+
uint _participantCount = WaveActiveSum(1);
67+
bool _isCorrect = (_participantCount == 0);
68+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
69+
}
70+
if ((WaveGetLaneIndex() == 24)) {
71+
result = (result + WaveActiveSum(result));
72+
uint _participantCount = WaveActiveSum(1);
73+
bool _isCorrect = (_participantCount == 0);
74+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
75+
}
76+
}
77+
break;
78+
}
79+
}
80+
if ((WaveGetLaneIndex() == 17)) {
81+
result = (result + WaveActiveMin(result));
82+
uint _participantCount = WaveActiveSum(1);
83+
bool _isCorrect = (_participantCount == 0);
84+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
85+
}
86+
} else {
87+
if (((WaveGetLaneIndex() < 11) || (WaveGetLaneIndex() >= 51))) {
88+
result = (result + WaveActiveMin(result));
89+
uint _participantCount = WaveActiveSum(1);
90+
bool _isCorrect = (_participantCount == 7);
91+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
92+
}
93+
}
94+
break;
95+
}
96+
default: {
97+
result = (result + WaveActiveSum(99));
98+
uint _participantCount = WaveActiveSum(1);
99+
bool _isCorrect = (_participantCount == 0);
100+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
101+
break;
102+
}
103+
}
104+
if (((WaveGetLaneIndex() < 13) || (WaveGetLaneIndex() >= 57))) {
105+
if (((WaveGetLaneIndex() < 10) || (WaveGetLaneIndex() >= 53))) {
106+
result = (result + WaveActiveMin(2));
107+
uint _participantCount = WaveActiveSum(1);
108+
bool _isCorrect = (_participantCount == 17);
109+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
110+
}
111+
switch ((WaveGetLaneIndex() % 2)) {
112+
case 0: {
113+
if ((WaveGetLaneIndex() < 8)) {
114+
result = (result + WaveActiveSum(1));
115+
uint _participantCount = WaveActiveSum(1);
116+
bool _isCorrect = (_participantCount == 4);
117+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
118+
}
119+
break;
120+
}
121+
case 1: {
122+
if ((WaveGetLaneIndex() == 16)) {
123+
if ((WaveGetLaneIndex() == 62)) {
124+
result = (result + WaveActiveMin(WaveGetLaneIndex()));
125+
uint _participantCount = WaveActiveSum(1);
126+
bool _isCorrect = (_participantCount == 0);
127+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
128+
}
129+
}
130+
break;
131+
}
132+
}
133+
}
134+
switch ((WaveGetLaneIndex() % 3)) {
135+
case 0: {
136+
if ((WaveGetLaneIndex() < 8)) {
137+
result = (result + WaveActiveSum(1));
138+
uint _participantCount = WaveActiveSum(1);
139+
bool _isCorrect = (_participantCount == 3);
140+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
141+
}
142+
break;
143+
}
144+
case 1: {
145+
switch ((WaveGetLaneIndex() % 3)) {
146+
case 0: {
147+
if (((WaveGetLaneIndex() < 4) || (WaveGetLaneIndex() >= 50))) {
148+
if (((WaveGetLaneIndex() < 7) || (WaveGetLaneIndex() >= 43))) {
149+
result = (result + WaveActiveMax(WaveGetLaneIndex()));
150+
uint _participantCount = WaveActiveSum(1);
151+
bool _isCorrect = (_participantCount == 0);
152+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
153+
}
154+
if (((WaveGetLaneIndex() < 10) || (WaveGetLaneIndex() >= 58))) {
155+
result = (result + WaveActiveSum(result));
156+
uint _participantCount = WaveActiveSum(1);
157+
bool _isCorrect = (_participantCount == 0);
158+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
159+
}
160+
}
161+
break;
162+
}
163+
case 1: {
164+
if (((WaveGetLaneIndex() % 2) == 0)) {
165+
result = (result + WaveActiveSum(2));
166+
uint _participantCount = WaveActiveSum(1);
167+
bool _isCorrect = (_participantCount == 10);
168+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
169+
}
170+
break;
171+
}
172+
case 2: {
173+
if (true) {
174+
result = (result + WaveActiveSum(3));
175+
uint _participantCount = WaveActiveSum(1);
176+
bool _isCorrect = (_participantCount == 0);
177+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
178+
}
179+
break;
180+
}
181+
}
182+
break;
183+
}
184+
case 2: {
185+
for (uint i1 = 0; (i1 < 3); i1 = (i1 + 1)) {
186+
if ((WaveGetLaneIndex() == 4)) {
187+
result = (result + WaveActiveMax(result));
188+
uint _participantCount = WaveActiveSum(1);
189+
bool _isCorrect = (_participantCount == 0);
190+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
191+
}
192+
if ((((WaveGetLaneIndex() == 8) || (WaveGetLaneIndex() == 37)) || (WaveGetLaneIndex() == 51))) {
193+
if (((((WaveGetLaneIndex() == 0) || (WaveGetLaneIndex() == 24)) || (WaveGetLaneIndex() == 45)) || (WaveGetLaneIndex() == 58))) {
194+
result = (result + WaveActiveMax(WaveGetLaneIndex()));
195+
uint _participantCount = WaveActiveSum(1);
196+
bool _isCorrect = (_participantCount == 0);
197+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
198+
}
199+
if (((((WaveGetLaneIndex() == 5) || (WaveGetLaneIndex() == 23)) || (WaveGetLaneIndex() == 33)) || (WaveGetLaneIndex() == 59))) {
200+
result = (result + WaveActiveMin((WaveGetLaneIndex() + 5)));
201+
uint _participantCount = WaveActiveSum(1);
202+
bool _isCorrect = (_participantCount == 0);
203+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
204+
}
205+
}
206+
if ((WaveGetLaneIndex() == 56)) {
207+
result = (result + WaveActiveMin(3));
208+
uint _participantCount = WaveActiveSum(1);
209+
bool _isCorrect = (_participantCount == 1);
210+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
211+
}
212+
}
213+
break;
214+
}
215+
}
216+
}
217+
218+
#--- pipeline.yaml
219+
---
220+
Shaders:
221+
- Stage: Compute
222+
Entry: main
223+
DispatchSize: [1, 1, 1] # Single dispatch for 64 threads
224+
Buffers:
225+
- Name: _participant_check_sum
226+
Format: UInt32
227+
Stride: 4
228+
Fill: 0
229+
Size: 64
230+
- Name: expected_participants
231+
Format: UInt32
232+
Stride: 4
233+
Data: [4, 1, 3, 3, 4, 2, 4, 1, 2, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 1, 0, 0, 4, 1, 3, 2, 1, 1, 2, 1]
234+
Results:
235+
- Result: WaveOpValidation
236+
Rule: BufferExact
237+
Actual: _participant_check_sum
238+
Expected: expected_participants
239+
DescriptorSets:
240+
- Resources:
241+
- Name: _participant_check_sum
242+
Kind: RWStructuredBuffer
243+
DirectXBinding:
244+
Register: 1
245+
Space: 0
246+
VulkanBinding:
247+
Binding: 1
248+
...
249+
#--- end
250+
251+
# RUN: split-file %s %t
252+
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
253+
# RUN: %offloader %t/pipeline.yaml %t.o

0 commit comments

Comments
 (0)