-
Notifications
You must be signed in to change notification settings - Fork 25
Add more test for resource arrays without NonUniformResourceIndex #456
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
43124e0
Add more test for resource arrays without NonUniformResourceIndex
hekota 1da7b8c
Merge branch 'main' into more-resource-array-tests3
hekota ec496b8
Merge branch 'main' of https://github.com/llvm/offload-test-suite int…
hekota 5c2a517
Remove XFAILs
hekota 8e58614
Merge branch 'more-resource-array-tests3' of https://github.com/hekot…
hekota 6d1b10e
Merge branch 'main' into more-resource-array-tests3
hekota d872eea
Add XFAIL for WARP issue, update to FillSize
hekota e8de531
Not a WARP bug! Update test to use a single thread
hekota d89755e
code review feedback - use ints, update to XFAILs
hekota 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,78 @@ | ||
| #--- source.hlsl | ||
|
|
||
| // Verify handling of subsets of multi-dimensional resource arrays | ||
| // used in a function argument. | ||
|
|
||
| RWStructuredBuffer<float> In[4][2] : register(u0); | ||
| RWStructuredBuffer<float> Out : register(u0, space1); | ||
|
|
||
| float foo(RWStructuredBuffer<float> A[2], uint Index) { | ||
| return A[0][Index] + A[1][Index]; | ||
| } | ||
|
|
||
| [numthreads(4,1,1)] | ||
| void main(uint GI : SV_GroupIndex) { | ||
| for (int i = 0; i < 4; i++) { | ||
| Out[i] = foo(In[i], i); | ||
| } | ||
| } | ||
|
|
||
| //--- pipeline.yaml | ||
| --- | ||
| Shaders: | ||
| - Stage: Compute | ||
| Entry: main | ||
| DispatchSize: [1, 1, 1] | ||
| Buffers: | ||
| - Name: BufIn | ||
| Format: Float32 | ||
| ArraySize: 8 | ||
| Data: | ||
| - [ 1.0, 2.0, 3.0, 4.0 ] | ||
| - [ 0.1, 0.2, 0.3, 0.4 ] | ||
| - [ 5.0, 6.0, 7.0, 8.0 ] | ||
| - [ 0.5, 0.6, 0.7, 0.8 ] | ||
| - [ 10.0, 11.0, 12.0, 13.0 ] | ||
| - [ 0.10, 0.11, 0.12, 0.13 ] | ||
| - [ 14.0, 15.0, 16.0, 17.0 ] | ||
| - [ 0.14, 0.15, 0.16, 0.17 ] | ||
|
|
||
| - Name: BufOut | ||
| Format: Float32 | ||
| FillSize: 16 | ||
|
|
||
| - Name: ExpectedOut | ||
| Format: Float32 | ||
| Data: [ 1.1, 6.6, 12.12, 17.17 ] | ||
|
|
||
| Results: | ||
| - Result: BufOut | ||
| Rule: BufferFloatULP | ||
| ULPT: 1 # Float addition should be within 1 ULP on all hardware. | ||
hekota marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Actual: BufOut | ||
| Expected: ExpectedOut | ||
|
|
||
| DescriptorSets: | ||
| - Resources: | ||
| - Name: BufIn | ||
| Kind: RWStructuredBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 0 | ||
| - Name: BufOut | ||
| Kind: RWStructuredBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 1 | ||
| ... | ||
| #--- end | ||
|
|
||
| # Vulkan does not support multi-dimensional resource arrays | ||
| # UNSUPPORTED: Vulkan | ||
hekota marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Resource arrays are not yet supported on Metal | ||
| # UNSUPPORTED: Metal | ||
hekota marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # RUN: split-file %s %t | ||
| # RUN: %dxc_target -T cs_6_0 -Fo %t.o %t/source.hlsl | ||
| # RUN: %offloader %t/pipeline.yaml %t.o | ||
65 changes: 65 additions & 0 deletions
65
test/Feature/ResourceArrays/multi-dim-unbounded-array.test
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,65 @@ | ||
| #--- source.hlsl | ||
|
|
||
| // Verify handling of unbounded multi-dimensional resource array. | ||
|
|
||
| RWStructuredBuffer<int> Buf[][2] : register(u0); | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main(uint3 GTI : SV_GroupThreadID, uint GI : SV_GroupIndex) { | ||
| for (int i = 0; i < 4; i++) { | ||
| Buf[1][0][i] = Buf[0][0][i] + Buf[0][1][i]; | ||
| Buf[1][1][i] = Buf[0][0][i] * Buf[0][1][i]; | ||
| Buf[0][0][i] += Buf[0][1][i]; | ||
| } | ||
| } | ||
|
|
||
| //--- pipeline.yaml | ||
| --- | ||
| Shaders: | ||
| - Stage: Compute | ||
| Entry: main | ||
| DispatchSize: [1, 1, 1] | ||
| Buffers: | ||
| - Name: Buf | ||
| Format: Int32 | ||
| ArraySize: 4 | ||
| Data: | ||
| - [ 0, 1, 2, 3 ] | ||
| - [ 1, 2, 3, 4 ] | ||
| - [ 0, 0, 0, 0 ] | ||
| - [ 0, 0, 0, 0 ] | ||
|
|
||
| - Name: ExpectedBuf | ||
| Format: Int32 | ||
| ArraySize: 4 | ||
| Data: | ||
| - [ 1, 3, 5, 7 ] | ||
| - [ 1, 2, 3, 4 ] | ||
| - [ 1, 3, 5, 7 ] | ||
| - [ 0, 2, 6, 12 ] | ||
|
|
||
| Results: | ||
| - Result: Buf | ||
| Rule: BufferExact | ||
| Actual: Buf | ||
| Expected: ExpectedBuf | ||
|
|
||
| DescriptorSets: | ||
| - Resources: | ||
| - Name: Buf | ||
| Kind: RWStructuredBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 0 | ||
| ... | ||
| #--- end | ||
|
|
||
| # Resource arrays are not yet supported on Metal | ||
| # UNSUPPORTED: Metal | ||
|
|
||
| # Vulkan does not support multi-dimensional resource arrays | ||
| # UNSUPPORTED: Vulkan | ||
|
|
||
| # RUN: split-file %s %t | ||
| # RUN: %dxc_target -T cs_6_0 -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,62 @@ | ||
| #--- source.hlsl | ||
|
|
||
| // Verify handling of unbounded resource array. | ||
|
|
||
| [[vk::binding(0)]] | ||
| RWBuffer<int> Buf[] : register(u0); | ||
|
|
||
| [numthreads(4,2,1)] | ||
| void main(uint GI : SV_GroupIndex) { | ||
| for (int i = 0; i < 4; i++) { | ||
| Buf[1][i] = Buf[0][i] * 2; | ||
| Buf[2][i] = Buf[0][i] + Buf[1][i]; | ||
| } | ||
| } | ||
|
|
||
| //--- pipeline.yaml | ||
| --- | ||
| Shaders: | ||
| - Stage: Compute | ||
| Entry: main | ||
| DispatchSize: [1, 1, 1] | ||
| Buffers: | ||
| - Name: Buf | ||
| Format: Int32 | ||
| ArraySize: 3 | ||
| Data: | ||
| - [ 1, 2, 3, 4 ] | ||
| - [ 0, 0, 0, 0 ] | ||
| - [ 0, 0, 0, 0 ] | ||
|
|
||
| - Name: ExpectedBuf | ||
| Format: Int32 | ||
| ArraySize: 3 | ||
| Data: | ||
| - [ 1, 2, 3, 4 ] | ||
| - [ 2, 4, 6, 8 ] | ||
| - [ 3, 6, 9, 12 ] | ||
|
|
||
| Results: | ||
| - Result: Buf | ||
| Rule: BufferExact | ||
| Actual: Buf | ||
| Expected: ExpectedBuf | ||
|
|
||
| DescriptorSets: | ||
| - Resources: | ||
| - Name: Buf | ||
| Kind: RWBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 0 | ||
| ... | ||
| #--- end | ||
|
|
||
| # Resource arrays are not yet supported on Metal | ||
| # UNSUPPORTED: Metal | ||
|
|
||
| # RUN: split-file %s %t | ||
| # RUN: %dxc_target -T cs_6_0 -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.