-
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
base: main
Are you sure you want to change the base?
Changes from all 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,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 | ||
|
Comment on lines
+137
to
+139
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. These are two different failure modes, so they should probably be two different XFAILs. I also really don't think we should be using the |
||
|
|
||
| # 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 | ||
| 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
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. Commented on the issue, but it needs some detail added to it before I'm comfortable using it to mark an XFAIL. It isn't clear to me whether this is really a driver issue or if it's just a clang bug of some kind. |
||||||
| # 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 | ||||||
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
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.
Random thought, should we have a feature where we populate output buffers with random data to catch issues going under the radar due to data being zero-initialized?