Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions test/Basic/Matrix/matrix_bool_and_operator.test
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
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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?

- 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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 Darwin feature to XFAIL/UNSUPPORTED anything in this suite - it's really about the APIs and not the host OS. I'll follow up separately to propose we get rid of config.available_features.add(config.offloadtest_os) in lit.cfg.py completely - it really isn't the right way to slice this stuff.


# 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 test/Basic/Matrix/matrix_bool_and_operator_thread_group.test
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Bug https://github.com/llvm/offload-test-suite/issues/705
# Bug https://github.com/llvm/offload-test-suite/issues/705

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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
Loading
Loading