forked from llvm/offload-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWaveActiveBitXor.convergence.test
More file actions
169 lines (152 loc) · 3.49 KB
/
WaveActiveBitXor.convergence.test
File metadata and controls
169 lines (152 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#--- source.hlsl
StructuredBuffer<uint> In : register(t0);
RWStructuredBuffer<uint> Out1 : register(u1); // branch A
RWStructuredBuffer<uint> Out2 : register(u2); // branch B
RWStructuredBuffer<uint> Out3 : register(u3); // reconverged
RWStructuredBuffer<uint> Out4 : register(u4); // loop
RWStructuredBuffer<uint> Out5 : register(u5); // divergent loop
[numthreads(4,1,1)]
void main(uint3 TID : SV_GroupThreadID) {
uint V = In[TID.x];
// divergent branch
if (TID.x < 2)
Out1[TID.x] = WaveActiveBitXor(V);
else
Out2[TID.x] = WaveActiveBitXor(V);
// reconverged wave op
Out3[TID.x] = WaveActiveBitXor(V);
// loop case
uint R = V;
for (uint i = 0; i < 2; i++)
R = WaveActiveBitXor(R);
Out4[TID.x] = R;
// divergent loop: each thread iterates TID.x times
// thread 0: 0 iters, thread 1: 1 iter, thread 2: 2 iters, thread 3: 3 iters
uint R2 = V;
for (uint j = 0; j < TID.x; j++)
R2 = WaveActiveBitXor(R2);
Out5[TID.x] = R2;
}
#--- pipeline.yaml
---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: In
Format: UInt32
Stride: 4
Data: [ 0x11, 0x12, 0x14, 0x18 ]
- Name: Out1
Format: UInt32
Stride: 4
FillSize: 16
- Name: Out2
Format: UInt32
Stride: 4
FillSize: 16
- Name: Out3
Format: UInt32
Stride: 4
FillSize: 16
- Name: Out4
Format: UInt32
Stride: 4
FillSize: 16
- Name: Out5
Format: UInt32
Stride: 4
FillSize: 16
- Name: ExpectedOut1
Format: UInt32
Stride: 4
Data: [ 0x3, 0x3, 0x0, 0x0 ]
- Name: ExpectedOut2
Format: UInt32
Stride: 4
Data: [ 0x0, 0x0, 0xc, 0xc ]
- Name: ExpectedOut3
Format: UInt32
Stride: 4
Data: [ 0xf, 0xf, 0xf, 0xf ]
- Name: ExpectedOut4
Format: UInt32
Stride: 4
Data: [ 0x0, 0x0, 0x0, 0x0 ]
- Name: ExpectedOut5
Format: UInt32
Stride: 4
Data: [ 0x11, 0x1e, 0x0, 0x0 ]
Results:
- Result: ExpectedOut1
Rule: BufferExact
Actual: Out1
Expected: ExpectedOut1
- Result: ExpectedOut2
Rule: BufferExact
Actual: Out2
Expected: ExpectedOut2
- Result: ExpectedOut3
Rule: BufferExact
Actual: Out3
Expected: ExpectedOut3
- Result: ExpectedOut4
Rule: BufferExact
Actual: Out4
Expected: ExpectedOut4
- Result: ExpectedOut5
Rule: BufferExact
Actual: Out5
Expected: ExpectedOut5
DescriptorSets:
- Resources:
- Name: In
Kind: StructuredBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0
- Name: Out1
Kind: RWStructuredBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: Out2
Kind: RWStructuredBuffer
DirectXBinding:
Register: 2
Space: 0
VulkanBinding:
Binding: 2
- Name: Out3
Kind: RWStructuredBuffer
DirectXBinding:
Register: 3
Space: 0
VulkanBinding:
Binding: 3
- Name: Out4
Kind: RWStructuredBuffer
DirectXBinding:
Register: 4
Space: 0
VulkanBinding:
Binding: 4
- Name: Out5
Kind: RWStructuredBuffer
DirectXBinding:
Register: 5
Space: 0
VulkanBinding:
Binding: 5
...
#--- end
# Bug: https://github.com/llvm/llvm-project/issues/188323
# XFAIL: Vulkan && Clang
# RUN: split-file %s %t
# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl
# RUN: %offloader %t/pipeline.yaml %t.o