Skip to content

Commit 23b70fc

Browse files
tests
1 parent 59f7ca2 commit 23b70fc

17 files changed

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

0 commit comments

Comments
 (0)