Skip to content

Commit 41fd913

Browse files
authored
Add AddUint64 tests (#290)
Closes #109. Adds a test for `AddUint64` testing `UInt32` type. Values primarily pulled from [HLK tests](https://github.com/microsoft/DirectXShaderCompiler/blob/57177f77a4dc6996400ac97a0d618799c82374e8/tools/clang/unittests/HLSLExec/ShaderOpArithTable.xml#L4241). Need to remove XFAILs after #292 and #344 are fixed.
1 parent 19464d2 commit 41fd913

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

test/Feature/HLSLLib/adduint64.test

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#--- source.hlsl
2+
3+
StructuredBuffer<uint4> In : register(t0);
4+
RWStructuredBuffer<uint4> Out : register(u1);
5+
6+
[numthreads(1,1,1)]
7+
void main() {
8+
// vec4
9+
Out[0] = AddUint64(In[0], In[0]);
10+
11+
// vec2
12+
uint4 Tmp = {AddUint64(In[1].xy, In[1].xy), AddUint64(In[1].zw, In[1].zw)};
13+
Out[1] = Tmp;
14+
uint4 Tmp2 = {AddUint64(In[2].xy, In[2].xy), AddUint64(In[2].zw, In[2].zw)};
15+
Out[2] = Tmp2;
16+
uint4 Tmp3 = {AddUint64(uint2(0xffffffff, 0xffffffff), uint2(1, 0)), AddUint64(uint2(1, 256), uint2(1, 256))};
17+
Out[3] = Tmp3;
18+
}
19+
20+
//--- pipeline.yaml
21+
22+
---
23+
Shaders:
24+
- Stage: Compute
25+
Entry: main
26+
DispatchSize: [1, 1, 1]
27+
Buffers:
28+
- Name: In
29+
Format: UInt32
30+
Stride: 16
31+
Data: [ 1, 0, 1, 256, 10000, 10001, 0x80000000, 1, 0x7fffffff, 0x7fffffff, 0xffffffff, 0x7fffffff ]
32+
# 1, 0, 1, 256, 10000, 10001, 2147483648, 1, 2147483647, 2147483647, 4294967295, 2147483647
33+
- Name: Out
34+
Format: UInt32
35+
Stride: 16
36+
ZeroInitSize: 64
37+
- Name: ExpectedOut # The result we expect
38+
Format: UInt32
39+
Stride: 16
40+
Data: [ 2, 0, 2, 512, 20000, 20002, 0, 3, 0xfffffffe, 0xfffffffe, 0xfffffffe, 0xffffffff, 0, 0, 2, 512 ]
41+
# 2, 0, 2, 512, 20000, 20002, 0, 3, 4294967294, 4294967294, 4294967294, 4294967295, 0, 0, 2, 512
42+
Results:
43+
- Result: Test1
44+
Rule: BufferExact
45+
Actual: Out
46+
Expected: ExpectedOut
47+
DescriptorSets:
48+
- Resources:
49+
- Name: In
50+
Kind: StructuredBuffer
51+
DirectXBinding:
52+
Register: 0
53+
Space: 0
54+
VulkanBinding:
55+
Binding: 0
56+
- Name: Out
57+
Kind: RWStructuredBuffer
58+
DirectXBinding:
59+
Register: 1
60+
Space: 0
61+
VulkanBinding:
62+
Binding: 1
63+
...
64+
#--- end
65+
66+
# https://github.com/llvm/offload-test-suite/issues/292
67+
# XFAIL: DXC-Metal
68+
69+
https://github.com/llvm/offload-test-suite/issues/344
70+
# XFAIL: Clang-Metal
71+
72+
# UNSUPPORTED: DXC-Vulkan
73+
74+
# RUN: split-file %s %t
75+
# RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl
76+
# RUN: %offloader %t/pipeline.yaml %t.o

0 commit comments

Comments
 (0)