-
Notifications
You must be signed in to change notification settings - Fork 31
Add tests for fma #953
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
NeKon69
wants to merge
13
commits into
llvm:main
Choose a base branch
from
NeKon69:fma-scalar-vector-matrix-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+247
−0
Open
Add tests for fma #953
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f2ba5a6
[Matrix] Add tests for fma
NeKon69 3983163
upgrade tests to use real double values + test some edge cases
NeKon69 d1b8197
update variable name
NeKon69 8440721
implement suggestions
NeKon69 3d2df24
update values
NeKon69 fde3513
Merge branch 'main' into fma-scalar-vector-matrix-tests
NeKon69 383306e
add XFAILS for one of the targets, add tests for more precise values
NeKon69 4ceba74
update tests
NeKon69 a482934
delete the comment in main, update buffer values to use the same valu…
NeKon69 0110647
add xfail for intel vulkan
NeKon69 53871f1
delete clang xfail
NeKon69 35c626f
xfail arm64 && warp on clang
NeKon69 df1ccbc
switch to ULP tolerance and update the link to the issue
NeKon69 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| #--- source.hlsl | ||
|
|
||
| StructuredBuffer<double4> A : register(t0); | ||
| StructuredBuffer<double4> B : register(t1); | ||
| StructuredBuffer<double4> C : register(t2); | ||
|
|
||
| RWStructuredBuffer<double4> Out : register(u3); | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| double3x2 r32 = fma(double3x2(A[0].xyz, A[1].xyz), | ||
| double3x2(B[0].xyz, B[1].xyz), | ||
| double3x2(C[0].xyz, C[1].xyz)); | ||
|
|
||
| double2x4 r24 = fma(double2x4(A[2], A[3]), | ||
| double2x4(B[2], B[3]), | ||
| double2x4(C[2], C[3])); | ||
|
|
||
| double3x1 r31 = fma(double3x1(A[4].xyz), | ||
| double3x1(B[4].xyz), | ||
| double3x1(C[4].xyz)); | ||
|
|
||
| double4x4 r44 = fma(double4x4(A[5], A[6], A[7], A[8]), | ||
| double4x4(B[5], B[6], B[7], B[8]), | ||
| double4x4(C[5], C[6], C[7], C[8])); | ||
|
|
||
| Out[0] = double4(r32[0], r32[1]); | ||
| Out[1] = double4(r32[2], 0.0, 0.0); | ||
| Out[2] = r24[0]; | ||
| Out[3] = r24[1]; | ||
| Out[4] = double4(r31[0][0], r31[1][0], r31[2][0], 0.0); | ||
| Out[5] = r44[0]; | ||
| Out[6] = r44[1]; | ||
| Out[7] = r44[2]; | ||
| Out[8] = r44[3]; | ||
| } | ||
|
|
||
| //--- pipeline.yaml | ||
|
|
||
| --- | ||
| Shaders: | ||
| - Stage: Compute | ||
| Entry: main | ||
| DispatchSize: [1, 1, 1] | ||
| Buffers: | ||
| - Name: A | ||
| Format: Float64 | ||
| Stride: 32 | ||
| Data: [ 1.5, -2.5, 0.5, 0.0, | ||
| -0.5, 2.0, 3.0, 0.0, | ||
| 0.25, -0.25, 10.4, -10.6, | ||
| 0.0, 10.0, -10.0, 10.5, | ||
| 1.25, -4.0, 2.5, 0.0, | ||
| 1.0, 2.0, 3.0, 4.0, | ||
| -1.0, -2.0, -3.0, -4.0, | ||
| 0.5, 1.5, -0.5, -1.5, | ||
| 10.0, -10.0, 2.25, -2.25 ] | ||
| - Name: B | ||
| Format: Float64 | ||
| Stride: 32 | ||
| Data: [ 2.0, -1.0, 4.0, 0.0, | ||
| 4.0, -0.5, 1.5, 0.0, | ||
| 1.0, 1.0, 1.0, 1.0, | ||
| 1.0, 2.0, -1.0, 1.0, | ||
| 2.0, -0.5, 3.0, 0.0, | ||
| 2.0, -1.0, 0.5, 3.0, | ||
| 4.0, 0.5, -2.0, -1.0, | ||
| 1.0, 2.0, 3.0, 4.0, | ||
| -0.5, 1.5, -1.0, 2.0 ] | ||
| - Name: C | ||
| Format: Float64 | ||
| Stride: 32 | ||
| Data: [ 0.25, 0.75, -1.5, 0.0, | ||
| 1.5, 1.0, -2.0, 0.0, | ||
| 0.0, 0.0, 0.0, 0.0, | ||
| 0.0, 0.5, 0.5, 0.0, | ||
| 0.5, 1.0, -1.5, 0.0, | ||
| 0.5, 1.0, -1.5, 0.0, | ||
| -0.5, 2.0, 1.0, 3.0, | ||
| 1.5, -2.0, 0.5, -4.0, | ||
| 5.0, -5.0, 0.25, -0.25 ] | ||
| - Name: Out | ||
| Format: Float64 | ||
| Stride: 32 | ||
| FillSize: 288 | ||
| - Name: Expected | ||
| Format: Float64 | ||
| Stride: 32 | ||
| Data: [ 3.25, 3.25, 0.5, -0.5, | ||
| 0.0, 2.5, 0.0, 0.0, | ||
| 0.25, -0.25, 10.4, -10.6, | ||
| 0.0, 20.5, 10.5, 10.5, | ||
| 3.0, 3.0, 6.0, 0.0, | ||
| 2.5, -1.0, 0.0, 12.0, | ||
| -4.5, 1.0, 7.0, 7.0, | ||
| 2.0, 1.0, -1.0, -10.0, | ||
| 0.0, -20.0, -2.0, -4.75 ] | ||
| Results: | ||
| - Result: Result | ||
| Rule: BufferExact | ||
| Actual: Out | ||
| Expected: Expected | ||
| DescriptorSets: | ||
| - Resources: | ||
| - Name: A | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 0 | ||
| - Name: B | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 1 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 1 | ||
| - Name: C | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 2 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 2 | ||
| - Name: Out | ||
| Kind: RWStructuredBuffer | ||
| DirectXBinding: | ||
| Register: 3 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 3 | ||
| #--- end | ||
|
|
||
| # Bug https://github.com/llvm/offload-test-suite/issues/1000 | ||
| # XFAIL: arm64 && WARP | ||
|
|
||
| # REQUIRES: Double | ||
| # RUN: split-file %s %t | ||
| # RUN: %dxc_target -Gis -HV 202x -T cs_6_5 -Fo %t.o %t/source.hlsl | ||
| # RUN: %offloader %t/pipeline.yaml %t.o | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| #--- source.hlsl | ||
|
|
||
| StructuredBuffer<double4> A : register(t0); | ||
| StructuredBuffer<double4> B : register(t1); | ||
| StructuredBuffer<double4> C : register(t2); | ||
|
|
||
| RWStructuredBuffer<double4> Out : register(u3); | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| Out[0] = fma(A[0], B[0], C[0]); | ||
| Out[1] = double4(fma(A[1].xyz, B[1].xyz, C[1].xyz), fma(A[1].w, B[1].w, C[1].w)); | ||
| Out[2] = double4(fma(A[2].xy, B[2].xy, C[2].xy), fma(A[2].zw, B[2].zw, C[2].zw)); | ||
| Out[3] = fma(double4(1.0000000149011612l, -1.0000000149011612l, 1.0000000000000002l, 0.5l), double4(67108865.0l, 67108865.0l, -0.9999999999999998l, -8.0l), double4(-67108866.0l, 67108866.0l, 1.0l, 1.0l)); | ||
| } | ||
|
|
||
| //--- pipeline.yaml | ||
|
|
||
| --- | ||
| Shaders: | ||
| - Stage: Compute | ||
| Entry: main | ||
| DispatchSize: [1, 1, 1] | ||
| Buffers: | ||
| - Name: A | ||
| Format: Float64 | ||
| Stride: 32 | ||
| Data: [ 1.5, -2.0, 0.75, -3.25, | ||
| 2.5, -4.0, 1.25, 3.5, | ||
| 1.0000000149011612, -1.0000000149011612, 1.0000000000000002, 0.5 ] | ||
| # last row: (1 + 2^-26), -(1 + 2^-26), (1 + 2^-52), 0.5 | ||
| - Name: B | ||
| Format: Float64 | ||
| Stride: 32 | ||
| Data: [ 2.25, 4.5, -8.0, -2.0, | ||
| -1.5, -2.0, 8.0, -2.0, | ||
| 67108865.0, 67108865.0, -0.9999999999999998, -8.0 ] | ||
| # last row: (2^26 + 1), (2^26 + 1), -(1 - 2^-52), -8 | ||
| - Name: C | ||
| Format: Float64 | ||
| Stride: 32 | ||
| Data: [ 0.125, 1.25, 2.5, -0.5, | ||
| 0.25, -1.5, -0.75, 0.5, | ||
| -67108866.0, 67108866.0, 1.0, 1.0 ] | ||
| # last row: -(2^26 + 2), (2^26 + 2), 1, 1 | ||
| - Name: Out | ||
| Format: Float64 | ||
| Stride: 32 | ||
| FillSize: 128 | ||
| - Name: Expected | ||
| Format: Float64 | ||
| Stride: 32 | ||
| Data: [ 3.5, -7.75, -3.5, 6.0, | ||
| -3.5, 6.5, 9.25, -6.5, | ||
| 0x1.0000000000000p-26, -0x1.0000000000000p-26, 0x1.0000000000000p-104, -3.0, | ||
| 0x1.0000000000000p-26, -0x1.0000000000000p-26, 0x1.0000000000000p-104, -3.0 ] | ||
| # last two rows: 2^-26, -(2^-26), 2^-104, -3 | ||
| Results: | ||
| - Result: Result | ||
| Rule: BufferExact | ||
NeKon69 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Actual: Out | ||
| Expected: Expected | ||
| DescriptorSets: | ||
| - Resources: | ||
| - Name: A | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 0 | ||
| - Name: B | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 1 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 1 | ||
| - Name: C | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 2 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 2 | ||
| - Name: Out | ||
| Kind: RWStructuredBuffer | ||
| DirectXBinding: | ||
| Register: 3 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 3 | ||
| #--- end | ||
|
|
||
| # Bug https://github.com/llvm/offload-test-suite/issues/1000 | ||
| # XFAIL: arm64 && WARP | ||
|
|
||
| # Bug https://github.com/llvm/offload-test-suite/issues/1026 | ||
NeKon69 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # XFAIL: Intel && Vulkan && DXC | ||
|
|
||
kmpeng marked this conversation as resolved.
Show resolved
Hide resolved
NeKon69 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # REQUIRES: Double | ||
| # RUN: split-file %s %t | ||
| # RUN: %dxc_target -Gis -HV 202x -T cs_6_5 -Fo %t.o %t/source.hlsl | ||
| # RUN: %offloader %t/pipeline.yaml %t.o | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.