-
Notifications
You must be signed in to change notification settings - Fork 31
[Matrix] Add boolean operator tests #1054
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
farzonl
wants to merge
1
commit into
llvm:main
Choose a base branch
from
farzonl:mat_bool_operator_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.
+451
−0
Open
Changes from all commits
Commits
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,143 @@ | ||
| #--- source.hlsl | ||
|
|
||
| RWStructuredBuffer<bool> In : register(u0); | ||
| RWStructuredBuffer<bool> AndTrueTrueOut : register(u1); | ||
| RWStructuredBuffer<bool> AndTrueFalseOut : register(u2); | ||
| RWStructuredBuffer<bool> AndTrueMixOut : register(u3); | ||
| RWStructuredBuffer<bool> AndTrueMix2Out : register(u4); | ||
|
|
||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| bool2x3 MatFalse = bool2x3(In[0], In[1], In[2], | ||
| In[0], In[1], In[2]); | ||
| bool2x3 MatTrue = bool2x3(In[3], In[4], In[5], | ||
| In[3], In[4], In[5]); | ||
| bool2x3 MatMix = bool2x3(In[0], In[1], In[2], | ||
| In[3], In[4], In[5]); | ||
| bool2x3 MatMix2 = bool2x3(In[3], In[4], In[5], | ||
| In[0], In[1], In[2]); | ||
|
|
||
| bool2x3 MatAndTrueTrue = and(MatTrue,MatTrue); | ||
| bool2x3 MatAndTrueFalse = and(MatTrue,MatFalse); | ||
| bool2x3 MatAndTrueMix1 = and(MatTrue,MatMix); | ||
| bool2x3 MatAndTrueMix2 = and(MatTrue,MatMix2); | ||
|
|
||
| const uint COLS = 3; // bool2x3 => 2 rows, 3 columns | ||
| for(uint i = 0; i < 6; i++) { | ||
| uint row = i / COLS; | ||
| uint col = i % COLS; | ||
| AndTrueTrueOut[i] = MatAndTrueTrue[row][col]; | ||
| AndTrueFalseOut[i] = MatAndTrueFalse[row][col]; | ||
| AndTrueMixOut[i] = MatAndTrueMix1[row][col]; | ||
| AndTrueMix2Out[i] = MatAndTrueMix2[row][col]; | ||
| } | ||
| } | ||
|
|
||
| //--- pipeline.yaml | ||
|
|
||
| --- | ||
| Shaders: | ||
| - Stage: Compute | ||
| Entry: main | ||
| DispatchSize: [1, 1, 1] | ||
| Buffers: | ||
| - Name: In | ||
| Format: Int32 | ||
| Data: [ 0, 0, 0, 1, 1, 1 ] | ||
| - Name: AndTrueTrueOut | ||
| Format: Int32 | ||
| FillSize: 24 | ||
| - Name: AndTrueTrueExpectedOut | ||
| Format: Int32 | ||
| Data: [ 1, 1, 1, 1, 1, 1 ] | ||
| - Name: AndTrueFalseOut | ||
| Format: Int32 | ||
| FillSize: 24 | ||
| - Name: AndTrueFalseExpectedOut | ||
| Format: Int32 | ||
| Data: [ 0, 0, 0, 0, 0, 0 ] | ||
| - Name: AndTrueMixOut | ||
| Format: Int32 | ||
| FillSize: 24 | ||
| - Name: AndTrueMixExpectedOut | ||
| Format: Int32 | ||
| Data: [ 0, 0, 0, 1, 1, 1 ] | ||
| - Name: AndTrueMix2Out | ||
| Format: Int32 | ||
| FillSize: 24 | ||
| - Name: AndTrueMix2ExpectedOut | ||
| Format: Int32 | ||
| Data: [ 1, 1, 1, 0, 0, 0 ] | ||
| Results: | ||
| - Result: AndTrueTrueOut | ||
| Rule: BufferExact | ||
| Actual: AndTrueTrueOut | ||
| Expected: AndTrueTrueExpectedOut | ||
| - Result: AndTrueFalseOut | ||
| Rule: BufferExact | ||
| Actual: AndTrueFalseOut | ||
| Expected: AndTrueFalseExpectedOut | ||
| - Result: AndTrueMixOut | ||
| Rule: BufferExact | ||
| Actual: AndTrueMixOut | ||
| Expected: AndTrueMixExpectedOut | ||
| - Result: AndTrueMix2Out | ||
| Rule: BufferExact | ||
| Actual: AndTrueMix2Out | ||
| Expected: AndTrueMix2ExpectedOut | ||
| DescriptorSets: | ||
| - Resources: | ||
| - Name: In | ||
| Kind: RWBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 0 | ||
| - Name: AndTrueTrueOut | ||
| Kind: RWBuffer | ||
| DirectXBinding: | ||
| Register: 1 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 1 | ||
| - Name: AndTrueFalseOut | ||
| Kind: RWBuffer | ||
| DirectXBinding: | ||
| Register: 2 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 2 | ||
| - Name: AndTrueMixOut | ||
| Kind: RWBuffer | ||
| DirectXBinding: | ||
| Register: 3 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 3 | ||
| - Name: AndTrueMix2Out | ||
| Kind: RWBuffer | ||
| DirectXBinding: | ||
| Register: 4 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 4 | ||
| ... | ||
| #--- end | ||
|
|
||
| # Bug https://github.com/microsoft/DirectXShaderCompiler/issues/8129 | ||
| # XFAIL: DXC && Vulkan | ||
|
|
||
| # Bug https://github.com/llvm/offload-test-suite/issues/703 | ||
| # XFAIL: Clang && NV && Vulkan | ||
|
|
||
| # Bug https://github.com/llvm/offload-test-suite/issues/704 | ||
| # XFAIL: Clang && Intel && Vulkan | ||
|
|
||
| # Note: Metal does not support boolean matrix types. For | ||
| # Vulkan KosmicKrisp and MoltenVK the output is always False. | ||
| # UNSUPPORTED: Darwin | ||
|
|
||
| # 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 | ||
145 changes: 145 additions & 0 deletions
145
test/Basic/Matrix/matrix_bool_and_operator_thread_group.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,145 @@ | ||||||
| #--- source.hlsl | ||||||
|
|
||||||
| RWStructuredBuffer<bool> In : register(u0); | ||||||
| RWStructuredBuffer<bool> AndTrueTrueOut : register(u1); | ||||||
| RWStructuredBuffer<bool> AndTrueFalseOut : register(u2); | ||||||
| RWStructuredBuffer<bool> AndTrueMixOut : register(u3); | ||||||
| RWStructuredBuffer<bool> AndTrueMix2Out : register(u4); | ||||||
|
|
||||||
| [numthreads(6,1,1)] | ||||||
| void main(uint GI : SV_GroupIndex) { | ||||||
| bool2x3 MatFalse = bool2x3(In[0], In[1], In[2], | ||||||
| In[0], In[1], In[2]); | ||||||
| bool2x3 MatTrue = bool2x3(In[3], In[4], In[5], | ||||||
| In[3], In[4], In[5]); | ||||||
| bool2x3 MatMix = bool2x3(In[0], In[1], In[2], | ||||||
| In[3], In[4], In[5]); | ||||||
| bool2x3 MatMix2 = bool2x3(In[3], In[4], In[5], | ||||||
| In[0], In[1], In[2]); | ||||||
|
|
||||||
| const uint COLS = 3; // bool2x3 => 2 rows, 3 columns | ||||||
| uint row = GI / COLS; // 0..1 | ||||||
| uint col = GI % COLS; // 0..2 | ||||||
|
|
||||||
| bool2x3 MatAndTrueTrue = and(MatTrue,MatTrue); | ||||||
| bool2x3 MatAndTrueFalse = and(MatTrue,MatFalse); | ||||||
| bool2x3 MatAndTrueMix1 = and(MatTrue,MatMix); | ||||||
| bool2x3 MatAndTrueMix2 = and(MatTrue,MatMix2); | ||||||
|
|
||||||
| AndTrueTrueOut[GI] = MatAndTrueTrue[row][col]; | ||||||
| AndTrueFalseOut[GI] = MatAndTrueFalse[row][col]; | ||||||
| AndTrueMixOut[GI] = MatAndTrueMix1[row][col]; | ||||||
| AndTrueMix2Out[GI] = MatAndTrueMix2[row][col]; | ||||||
| } | ||||||
|
|
||||||
| //--- pipeline.yaml | ||||||
|
|
||||||
| --- | ||||||
| Shaders: | ||||||
| - Stage: Compute | ||||||
| Entry: main | ||||||
| DispatchSize: [1, 1, 1] | ||||||
| Buffers: | ||||||
| - Name: In | ||||||
| Format: Int32 | ||||||
| Data: [ 0, 0, 0, 1, 1, 1 ] | ||||||
| - Name: AndTrueTrueOut | ||||||
| Format: Int32 | ||||||
| FillSize: 24 | ||||||
| - Name: AndTrueTrueExpectedOut | ||||||
| Format: Int32 | ||||||
| Data: [ 1, 1, 1, 1, 1, 1 ] | ||||||
| - Name: AndTrueFalseOut | ||||||
| Format: Int32 | ||||||
| FillSize: 24 | ||||||
| - Name: AndTrueFalseExpectedOut | ||||||
| Format: Int32 | ||||||
| Data: [ 0, 0, 0, 0, 0, 0 ] | ||||||
| - Name: AndTrueMixOut | ||||||
| Format: Int32 | ||||||
| FillSize: 24 | ||||||
| - Name: AndTrueMixExpectedOut | ||||||
| Format: Int32 | ||||||
| Data: [ 0, 0, 0, 1, 1, 1 ] | ||||||
| - Name: AndTrueMix2Out | ||||||
| Format: Int32 | ||||||
| FillSize: 24 | ||||||
| - Name: AndTrueMix2ExpectedOut | ||||||
| Format: Int32 | ||||||
| Data: [ 1, 1, 1, 0, 0, 0 ] | ||||||
| Results: | ||||||
| - Result: AndTrueTrueOut | ||||||
| Rule: BufferExact | ||||||
| Actual: AndTrueTrueOut | ||||||
| Expected: AndTrueTrueExpectedOut | ||||||
| - Result: AndTrueFalseOut | ||||||
| Rule: BufferExact | ||||||
| Actual: AndTrueFalseOut | ||||||
| Expected: AndTrueFalseExpectedOut | ||||||
| - Result: AndTrueMixOut | ||||||
| Rule: BufferExact | ||||||
| Actual: AndTrueMixOut | ||||||
| Expected: AndTrueMixExpectedOut | ||||||
| - Result: AndTrueMix2Out | ||||||
| Rule: BufferExact | ||||||
| Actual: AndTrueMix2Out | ||||||
| Expected: AndTrueMix2ExpectedOut | ||||||
| DescriptorSets: | ||||||
| - Resources: | ||||||
| - Name: In | ||||||
| Kind: RWBuffer | ||||||
| DirectXBinding: | ||||||
| Register: 0 | ||||||
| Space: 0 | ||||||
| VulkanBinding: | ||||||
| Binding: 0 | ||||||
| - Name: AndTrueTrueOut | ||||||
| Kind: RWBuffer | ||||||
| DirectXBinding: | ||||||
| Register: 1 | ||||||
| Space: 0 | ||||||
| VulkanBinding: | ||||||
| Binding: 1 | ||||||
| - Name: AndTrueFalseOut | ||||||
| Kind: RWBuffer | ||||||
| DirectXBinding: | ||||||
| Register: 2 | ||||||
| Space: 0 | ||||||
| VulkanBinding: | ||||||
| Binding: 2 | ||||||
| - Name: AndTrueMixOut | ||||||
| Kind: RWBuffer | ||||||
| DirectXBinding: | ||||||
| Register: 3 | ||||||
| Space: 0 | ||||||
| VulkanBinding: | ||||||
| Binding: 3 | ||||||
| - Name: AndTrueMix2Out | ||||||
| Kind: RWBuffer | ||||||
| DirectXBinding: | ||||||
| Register: 4 | ||||||
| Space: 0 | ||||||
| VulkanBinding: | ||||||
| Binding: 4 | ||||||
| ... | ||||||
| #--- end | ||||||
|
|
||||||
| # Bug https://github.com/microsoft/DirectXShaderCompiler/issues/8129 | ||||||
| # XFAIL: DXC && Vulkan | ||||||
|
|
||||||
| # Bug https://github.com/llvm/offload-test-suite/issues/703 | ||||||
| # XFAIL: Clang && NV && Vulkan | ||||||
|
|
||||||
| # Bug https://github.com/llvm/offload-test-suite/issues/704 | ||||||
| # XFAIL: Clang && Intel && Vulkan | ||||||
|
|
||||||
| Bug https://github.com/llvm/offload-test-suite/issues/705 | ||||||
|
Contributor
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.
Suggested change
|
||||||
| # XFAIL: Clang && NV && DirectX | ||||||
|
|
||||||
| # Note: Metal does not support boolean matrix types. For | ||||||
| # Vulkan KosmicKrisp and MoltenVK the output is always False. | ||||||
| # UNSUPPORTED: Darwin | ||||||
|
|
||||||
| # 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.
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.
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.
You might consider setting this data to be non-zero. A nit, but it ensures that the buffer is actually being set to 0, and that the program is actually running.
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.
I agree that we should ensure the buffers are not zero-initialized