-
Notifications
You must be signed in to change notification settings - Fork 12
Add offload-test-suite support for ldexp
#200
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#--- source.hlsl | ||
|
||
StructuredBuffer<float4> In : register(t0); | ||
RWStructuredBuffer<float4> Out : register(u1); | ||
|
||
[numthreads(1,1,1)] | ||
void main() { | ||
Out[0] = ldexp(In[0], In[1]); | ||
Out[1].x = ldexp(In[1].x, In[1].y); | ||
Out[1].yzw = ldexp(In[1].yzw, In[0].yzw); | ||
Out[2].xy = ldexp(In[0].xy, In[1].yw); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might be helpful to add a comment showing what value combinations are being tested; I believe this is correct (but the formatting is messed up)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added this in the main function but didn't know if that made sense. Lmk if you think there's a better place to move it |
||
|
||
//--- pipeline.yaml | ||
|
||
--- | ||
Shaders: | ||
- Stage: Compute | ||
Entry: main | ||
DispatchSize: [1, 1, 1] | ||
Buffers: | ||
- Name: In | ||
Format: Float32 | ||
Stride: 16 | ||
Data: [ 3.14159, 0, -inf, NaN, 1, 1.5, -0.5, inf ] | ||
kmpeng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Name: Out | ||
Format: Float32 | ||
Stride: 16 | ||
ZeroInitSize: 48 | ||
- Name: ExpectedOut # The result we expect | ||
Format: Float32 | ||
Stride: 16 | ||
Data: [ 6.28318, 0, -inf, NaN, 2.828427, 1.5, -0, NaN, 8.885758, NaN, 0, 0 ] | ||
Results: | ||
- Result: Test1 | ||
Rule: BufferFuzzy | ||
ULPT: 1 | ||
Actual: Out | ||
Expected: ExpectedOut | ||
DescriptorSets: | ||
- Resources: | ||
- Name: In | ||
Kind: StructuredBuffer | ||
DirectXBinding: | ||
Register: 0 | ||
Space: 0 | ||
VulkanBinding: | ||
Binding: 0 | ||
- Name: Out | ||
Kind: RWStructuredBuffer | ||
DirectXBinding: | ||
Register: 1 | ||
Space: 0 | ||
VulkanBinding: | ||
Binding: 1 | ||
... | ||
#--- end | ||
|
||
# UNSUPPORTED: Clang-Vulkan | ||
# 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#--- source.hlsl | ||
|
||
StructuredBuffer<half4> In : register(t0); | ||
RWStructuredBuffer<half4> Out : register(u1); | ||
|
||
[numthreads(1,1,1)] | ||
void main() { | ||
kmpeng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Out[0] = ldexp(In[0], In[1]); | ||
Out[1].x = ldexp(In[1].x, In[1].y); | ||
Out[1].yzw = ldexp(In[1].yzw, In[0].yzw); | ||
Out[2].xy = ldexp(In[0].xy, In[1].yw); | ||
} | ||
|
||
//--- pipeline.yaml | ||
|
||
--- | ||
Shaders: | ||
- Stage: Compute | ||
Entry: main | ||
DispatchSize: [1, 1, 1] | ||
Buffers: | ||
- Name: In | ||
Format: Float16 | ||
Stride: 8 | ||
Data: [ 0x4248, 0x0000, 0xFC00, 0x7E00, 0x3C00, 0x3E00, 0xB800, 0x7C00 ] | ||
kmpeng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Name: Out | ||
Format: Float16 | ||
Stride: 8 | ||
ZeroInitSize: 24 | ||
- Name: ExpectedOut # The result we expect | ||
Format: Float16 | ||
Stride: 8 | ||
Data: [ 0x4648, 0x0000, 0xFC00, 0x7E00, 0x41A8, 0x3E00, 0x8000, 0x7E00, 0x4871, 0x7E00, 0x0000, 0x0000 ] | ||
kmpeng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Results: | ||
- Result: Test1 | ||
Rule: BufferFuzzy | ||
ULPT: 1 | ||
Actual: Out | ||
Expected: ExpectedOut | ||
DescriptorSets: | ||
- Resources: | ||
- Name: In | ||
Kind: StructuredBuffer | ||
DirectXBinding: | ||
Register: 0 | ||
Space: 0 | ||
VulkanBinding: | ||
Binding: 0 | ||
- Name: Out | ||
Kind: RWStructuredBuffer | ||
DirectXBinding: | ||
Register: 1 | ||
Space: 0 | ||
VulkanBinding: | ||
Binding: 1 | ||
... | ||
#--- end | ||
|
||
# REQUIRES: Half | ||
|
||
# UNSUPPORTED: Clang-Vulkan | ||
# RUN: split-file %s %t | ||
# RUN: %dxc_target -enable-16bit-types -T cs_6_5 -Fo %t.o %t/source.hlsl | ||
# RUN: %offloader %t/pipeline.yaml %t.o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we use float4 instead of float?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way each version can easily be tested. If it was float, a float4, etc, would need to be constructed.
Line 8 tests the float4 version of ldexp, like 10 tests float3 etc