Skip to content

Commit 59f7ca2

Browse files
more tests
1 parent 65a341b commit 59f7ca2

4 files changed

+588
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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() % 4)) {
9+
case 0: {
10+
if ((WaveGetLaneIndex() < 8)) {
11+
result = (result + WaveActiveSum(1));
12+
uint _participantCount = WaveActiveSum(1);
13+
bool _isCorrect = (_participantCount == 2);
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 == 0);
23+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
24+
}
25+
break;
26+
}
27+
case 2: {
28+
if (true) {
29+
result = (result + WaveActiveSum(3));
30+
uint _participantCount = WaveActiveSum(1);
31+
bool _isCorrect = (_participantCount == 16);
32+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
33+
}
34+
break;
35+
}
36+
case 3: {
37+
if (((WaveGetLaneIndex() == 27) || (WaveGetLaneIndex() == 32))) {
38+
if ((((WaveGetLaneIndex() == 9) || (WaveGetLaneIndex() == 32)) || (WaveGetLaneIndex() == 48))) {
39+
result = (result + WaveActiveSum(result));
40+
uint _participantCount = WaveActiveSum(1);
41+
bool _isCorrect = (_participantCount == 0);
42+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
43+
}
44+
uint counter0 = 0;
45+
while ((counter0 < 2)) {
46+
counter0 = (counter0 + 1);
47+
if ((WaveGetLaneIndex() >= 45)) {
48+
result = (result + WaveActiveMin((WaveGetLaneIndex() + 2)));
49+
uint _participantCount = WaveActiveSum(1);
50+
bool _isCorrect = (_participantCount == 0);
51+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
52+
}
53+
uint counter1 = 0;
54+
while ((counter1 < 2)) {
55+
counter1 = (counter1 + 1);
56+
if ((((((WaveGetLaneIndex() == 12) || (WaveGetLaneIndex() == 23)) || (WaveGetLaneIndex() == 45)) || (WaveGetLaneIndex() == 56)) || (WaveGetLaneIndex() == 35))) {
57+
result = (result + WaveActiveMax((WaveGetLaneIndex() + 3)));
58+
uint _participantCount = WaveActiveSum(1);
59+
bool _isCorrect = (_participantCount == 0);
60+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
61+
}
62+
}
63+
if ((WaveGetLaneIndex() < 19)) {
64+
result = (result + WaveActiveMin(result));
65+
uint _participantCount = WaveActiveSum(1);
66+
bool _isCorrect = (_participantCount == 0);
67+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
68+
}
69+
}
70+
if ((((WaveGetLaneIndex() == 7) || (WaveGetLaneIndex() == 38)) || (WaveGetLaneIndex() == 48))) {
71+
result = (result + WaveActiveMin(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+
}
81+
82+
#--- pipeline.yaml
83+
---
84+
Shaders:
85+
- Stage: Compute
86+
Entry: main
87+
DispatchSize: [1, 1, 1] # Single dispatch for 64 threads
88+
Buffers:
89+
- Name: _participant_check_sum
90+
Format: UInt32
91+
Stride: 4
92+
Fill: 0
93+
Size: 64
94+
- Name: expected_participants
95+
Format: UInt32
96+
Stride: 4
97+
Data: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]
98+
Results:
99+
- Result: WaveOpValidation
100+
Rule: BufferExact
101+
Actual: _participant_check_sum
102+
Expected: expected_participants
103+
DescriptorSets:
104+
- Resources:
105+
- Name: _participant_check_sum
106+
Kind: RWStructuredBuffer
107+
DirectXBinding:
108+
Register: 1
109+
Space: 0
110+
VulkanBinding:
111+
Binding: 1
112+
...
113+
#--- end
114+
115+
# RUN: split-file %s %t
116+
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
117+
# RUN: %offloader %t/pipeline.yaml %t.o
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
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+
if (((WaveGetLaneIndex() < 9) || (WaveGetLaneIndex() >= 51))) {
9+
result = (result + WaveActiveSum(1));
10+
uint _participantCount = WaveActiveSum(1);
11+
bool _isCorrect = (_participantCount == 22);
12+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
13+
} else {
14+
if (((WaveGetLaneIndex() < 13) || (WaveGetLaneIndex() >= 49))) {
15+
result = (result + WaveActiveMin((WaveGetLaneIndex() + 2)));
16+
uint _participantCount = WaveActiveSum(1);
17+
bool _isCorrect = (_participantCount == 6);
18+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
19+
} else {
20+
if ((WaveGetLaneIndex() < 23)) {
21+
result = (result + WaveActiveMax((WaveGetLaneIndex() + 3)));
22+
uint _participantCount = WaveActiveSum(1);
23+
bool _isCorrect = (_participantCount == 10);
24+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
25+
} else {
26+
if (((WaveGetLaneIndex() < 5) || (WaveGetLaneIndex() >= 59))) {
27+
result = (result + WaveActiveSum(4));
28+
uint _participantCount = WaveActiveSum(1);
29+
bool _isCorrect = (_participantCount == 0);
30+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
31+
} else {
32+
if ((WaveGetLaneIndex() < 26)) {
33+
result = (result + WaveActiveMin((WaveGetLaneIndex() + 5)));
34+
uint _participantCount = WaveActiveSum(1);
35+
bool _isCorrect = (_participantCount == 3);
36+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
37+
}
38+
}
39+
}
40+
}
41+
}
42+
switch ((WaveGetLaneIndex() % 4)) {
43+
case 0: {
44+
if ((WaveGetLaneIndex() < 8)) {
45+
result = (result + WaveActiveSum(1));
46+
uint _participantCount = WaveActiveSum(1);
47+
bool _isCorrect = (_participantCount == 2);
48+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
49+
}
50+
break;
51+
}
52+
case 1: {
53+
if (((WaveGetLaneIndex() % 2) == 0)) {
54+
result = (result + WaveActiveSum(2));
55+
uint _participantCount = WaveActiveSum(1);
56+
bool _isCorrect = (_participantCount == 0);
57+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
58+
}
59+
break;
60+
}
61+
case 2: {
62+
for (uint i0 = 0; (i0 < 3); i0 = (i0 + 1)) {
63+
if (((WaveGetLaneIndex() & 1) == 0)) {
64+
result = (result + WaveActiveMax(WaveGetLaneIndex()));
65+
uint _participantCount = WaveActiveSum(1);
66+
bool _isCorrect = (_participantCount == 16);
67+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
68+
}
69+
for (uint i1 = 0; (i1 < 2); i1 = (i1 + 1)) {
70+
if (((((WaveGetLaneIndex() == 8) || (WaveGetLaneIndex() == 22)) || (WaveGetLaneIndex() == 37)) || (WaveGetLaneIndex() == 61))) {
71+
result = (result + WaveActiveMin(result));
72+
uint _participantCount = WaveActiveSum(1);
73+
bool _isCorrect = (_participantCount == 1);
74+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
75+
}
76+
if (((((WaveGetLaneIndex() == 6) || (WaveGetLaneIndex() == 19)) || (WaveGetLaneIndex() == 43)) || (WaveGetLaneIndex() == 51))) {
77+
result = (result + WaveActiveMax(result));
78+
uint _participantCount = WaveActiveSum(1);
79+
bool _isCorrect = (_participantCount == 1);
80+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
81+
}
82+
if ((i1 == 1)) {
83+
break;
84+
}
85+
}
86+
if (((WaveGetLaneIndex() & 1) == 1)) {
87+
result = (result + WaveActiveSum(2));
88+
uint _participantCount = WaveActiveSum(1);
89+
bool _isCorrect = (_participantCount == 0);
90+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
91+
}
92+
}
93+
break;
94+
}
95+
case 3: {
96+
if ((WaveGetLaneIndex() < 20)) {
97+
result = (result + WaveActiveSum(4));
98+
uint _participantCount = WaveActiveSum(1);
99+
bool _isCorrect = (_participantCount == 5);
100+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
101+
}
102+
break;
103+
}
104+
}
105+
}
106+
107+
#--- pipeline.yaml
108+
---
109+
Shaders:
110+
- Stage: Compute
111+
Entry: main
112+
DispatchSize: [1, 1, 1] # Single dispatch for 64 threads
113+
Buffers:
114+
- Name: _participant_check_sum
115+
Format: UInt32
116+
Stride: 4
117+
Fill: 0
118+
Size: 64
119+
- Name: expected_participants
120+
Format: UInt32
121+
Stride: 4
122+
Data: [2, 1, 4, 2, 2, 1, 10, 2, 1, 1, 4, 2, 1, 1, 4, 2, 1, 1, 4, 2, 1, 1, 10, 1, 1, 1, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1]
123+
Results:
124+
- Result: WaveOpValidation
125+
Rule: BufferExact
126+
Actual: _participant_check_sum
127+
Expected: expected_participants
128+
DescriptorSets:
129+
- Resources:
130+
- Name: _participant_check_sum
131+
Kind: RWStructuredBuffer
132+
DirectXBinding:
133+
Register: 1
134+
Space: 0
135+
VulkanBinding:
136+
Binding: 1
137+
...
138+
#--- end
139+
140+
# RUN: split-file %s %t
141+
# RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl
142+
# RUN: %offloader %t/pipeline.yaml %t.o
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
if ((WaveGetLaneIndex() < 22)) {
9+
if (((((WaveGetLaneIndex() == 12) || (WaveGetLaneIndex() == 28)) || (WaveGetLaneIndex() == 36)) || (WaveGetLaneIndex() == 63))) {
10+
if (((((WaveGetLaneIndex() == 1) || (WaveGetLaneIndex() == 25)) || (WaveGetLaneIndex() == 36)) || (WaveGetLaneIndex() == 51))) {
11+
result = (result + WaveActiveMin((WaveGetLaneIndex() + 4)));
12+
uint _participantCount = WaveActiveSum(1);
13+
bool _isCorrect = (_participantCount == 0);
14+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
15+
}
16+
for (uint i0 = 0; (i0 < 2); i0 = (i0 + 1)) {
17+
if (((WaveGetLaneIndex() == 9) || (WaveGetLaneIndex() == 35))) {
18+
result = (result + WaveActiveMin(WaveGetLaneIndex()));
19+
uint _participantCount = WaveActiveSum(1);
20+
bool _isCorrect = (_participantCount == 0);
21+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
22+
}
23+
if ((i0 == 1)) {
24+
break;
25+
}
26+
}
27+
if ((((WaveGetLaneIndex() == 10) || (WaveGetLaneIndex() == 24)) || (WaveGetLaneIndex() == 42))) {
28+
result = (result + WaveActiveMin(1));
29+
uint _participantCount = WaveActiveSum(1);
30+
bool _isCorrect = (_participantCount == 0);
31+
_participant_check_sum[tid.x] = (_participant_check_sum[tid.x] + (_isCorrect ? 1 : 0));
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)