Skip to content

Commit b0cc9ce

Browse files
committed
WIP fp16 test
1 parent 9825eb1 commit b0cc9ce

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

test/Feature/HLSLLib/dot.fp16.test

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#--- source.hlsl
2+
StructuredBuffer<half4> X : register(t0);
3+
StructuredBuffer<half4> Y : register(t1);
4+
5+
RWStructuredBuffer<half> Out : register(u2);
6+
7+
8+
[numthreads(1,1,1)]
9+
void main() {
10+
Out[0] = dot(X[0].x, Y[0].x);
11+
Out[1] = dot(X[0].xy, Y[0].xy);
12+
Out[2] = dot(X[0].xyz, Y[0].xyz);
13+
Out[3] = dot(X[0], Y[0]);
14+
15+
Out[4] = dot(X[1].x, Y[1].x);
16+
Out[5] = dot(X[1].xy, Y[1].xy);
17+
Out[6] = dot(X[1].xyz, Y[1].xyz);
18+
Out[7] = dot(X[1], Y[1]);
19+
}
20+
//--- pipeline.yaml
21+
22+
---
23+
Shaders:
24+
- Stage: Compute
25+
Entry: main
26+
DispatchSize: [1, 1, 1]
27+
Buffers:
28+
- Name: X
29+
Format: Float16
30+
Stride: 8
31+
Data: [ 0x3c00, 0x3c00, 0x3c00, 0x3c00, 0xc900, 0x0000, 0x0000, 0x4900 ]
32+
# [ 1, 1, 1, 1, -10, 0, 0, 10 ]
33+
- Name: Y
34+
Format: Float16
35+
Stride: 8
36+
Data: [ 0x3c00, 0x3c00, 0x3c00, 0x3c00, 0x4900, 0x0000, 0x0000, 0x4900 ]
37+
# [ 1, 1, 1, 1, 10, 0, 0, 10 ]
38+
- Name: Out
39+
Format: Float16
40+
Stride: 8
41+
ZeroInitSize: 16
42+
- Name: ExpectedOut
43+
Format: Float16
44+
Stride: 8
45+
Data: [ 0x3C00, 0x4000, 0x4200, 0x4400, 0xd640, 0xd640, 0xd640, 0x0000 ]
46+
# [ 1, 2, 3, 4, -100, -100, -100, 0 ]
47+
Results:
48+
- Result: Test1
49+
Rule: BufferFloatEpsilon
50+
Epsilon: 0.0008
51+
Actual: Out
52+
Expected: ExpectedOut
53+
DescriptorSets:
54+
- Resources:
55+
- Name: X
56+
Kind: StructuredBuffer
57+
DirectXBinding:
58+
Register: 0
59+
Space: 0
60+
VulkanBinding:
61+
Binding: 0
62+
- Name: Y
63+
Kind: StructuredBuffer
64+
DirectXBinding:
65+
Register: 1
66+
Space: 0
67+
VulkanBinding:
68+
Binding: 1
69+
- Name: Out
70+
Kind: RWStructuredBuffer
71+
DirectXBinding:
72+
Register: 2
73+
Space: 0
74+
VulkanBinding:
75+
Binding: 2
76+
#--- end
77+
78+
# REQUIRES: Half
79+
# RUN: split-file %s %t
80+
# RUN: %dxc_target -enable-16bit-types -T cs_6_5 -Fo %t.o %t/source.hlsl
81+
# RUN: %offloader %t/pipeline.yaml %t.o

0 commit comments

Comments
 (0)