Skip to content

Add asdouble test #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions test/Feature/HLSLLib/asdouble.32.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#--- source.hlsl
StructuredBuffer<uint4> Low : register(t0);
StructuredBuffer<uint4> High : register(t1);

RWStructuredBuffer<double4> Out : register(u2);


[numthreads(1,1,1)]
void main() {
Out[0] = asdouble(Low[0], High[0]);
Out[1] = double4(asdouble(Low[1].xyz, High[1].xyz), asdouble(Low[1].w, High[1].w));
Out[2] = double4(asdouble(Low[2].xy, High[2].xy), asdouble(Low[2].zw, High[2].zw));
Out[3] = asdouble(uint4(0, 0, 0, 1413754136), uint4(0, 1072693248, 3220176896, 1074340347));
}
//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: Low
Format: UInt32
Stride: 16
Data: [
0X00000000, 0x00000000, 0x00000000, 0x54442D18,
0x2168C235, 0x0F534DD8, 0xFFFFFFFF, 0xFFFFFFFF,
0x1A9FBE77, 0x00000000, 0x6DC9C883, 0x55555555
]
# 0, 0, 0, 1413754136, 560513589, 257117656, 4294967295, 4294967295, 446676599, 0, 1841940611, 1431655765
- Name: High
Format: UInt32
Stride: 16
Data: [
0X00000000, 0x3FF00000, 0xBFF00000, 0x400921FB,
0x4005BF0A, 0xC005BF0A, 0x7FEFFFFF, 0xFFEFFFFF,
0x00000000, 0x40900000, 0x3FF6A09E, 0x3FD55555
]
# 0, 1072693248, 3220176896, 1074340347, 1074118410, 3221602058, 2146435071, 4293918719, 0, 1083179008, 1073127582, 1070945621
- Name: Out
Format: Float64
Stride: 32
ZeroInitSize: 128
- Name: ExpectedOut
Format: Hex64
Stride: 32
Data: [
0X0000000000000000, 0x3FF0000000000000, 0xBFF0000000000000, 0x400921FB54442D18,
0x4005BF0A2168C235, 0xC005BF0A0F534DD8, 0x7FEFFFFFFFFFFFFF, 0xFFEFFFFFFFFFFFFF,
0x000000001A9FBE77, 0x4090000000000000, 0x3FF6A09E6DC9C883, 0x3FD5555555555555,
0X0000000000000000, 0x3FF0000000000000, 0xBFF0000000000000, 0x400921FB54442D18
]
# 0, 1.0, -1.0, 3.14159, 2.71828, -2.71828, 1.79769e+308, -1.79769e+308, denorm, 1024.0, 1.41421, 0.33333, 0, 1.0, -1.0, 3.14159
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be mistaken, but I thought we wanted to avoid denorm testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but I wanted to add a test where all the high bits were 0, which makes the output a denorm. Thought it would be fine because the inputs aren't denorms? But let me know your thoughts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, the denorm isn't an input. And I would think the output should be driver-implementation-agnostic, it's literally just putting two strings of bits together.
I think this should be ok.

Results:
- Result: Test
Rule: BufferExact
Actual: Out
Expected: ExpectedOut
DescriptorSets:
- Resources:
- Name: Low
Kind: StructuredBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0
- Name: High
Kind: StructuredBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: Out
Kind: RWStructuredBuffer
DirectXBinding:
Register: 2
Space: 0
VulkanBinding:
Binding: 2
#--- end

# https://github.com/llvm/llvm-project/issues/153513
# XFAIL: Clang-Vulkan

# https://github.com/microsoft/DirectXShaderCompiler/issues/7699
# XFAIL: DXC-Vulkan

# REQUIRES: Double
# 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
Loading