Skip to content

Commit 54265ab

Browse files
more tests
1 parent 23b70fc commit 54265ab

18 files changed

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

0 commit comments

Comments
 (0)