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
69 changes: 69 additions & 0 deletions test/Feature/CBuffer/Matrix/SingleSubscript/mat_cbuffer.f1x4.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#--- source.hlsl
RWStructuredBuffer<float4> Out : register(u0);

cbuffer example : register(b1) {
float2x4 M1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this meant to be float1x4?

Copy link
Member Author

@farzonl farzonl Feb 18, 2026

Choose a reason for hiding this comment

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

Yep. Copy paste error and looks like an unstaged change.

};

[numthreads(1,1,1)]
void main() {
Out[0] = M1[0];
Out[1] = M1[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Out[1] = M1[1];

This read and write goes out of bounds.

Copy link
Member Author

Choose a reason for hiding this comment

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

It does not currently but will when this becomes a 1x4.

Copy link
Contributor

@Icohedron Icohedron Feb 18, 2026

Choose a reason for hiding this comment

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

It does currently read out of bounds because the input data ends with 4.4] when it should end with 4.4, 0xFFFF] for a 2x4 matrix. It writes out of bounds of course because the output buffer is only 16 bytes.

}
//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: cbuffer
Format: Float32
Data: [ 1.1, 0xFFFF, 0xFFFF, 0xFFFF,
Copy link
Collaborator

Choose a reason for hiding this comment

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

0xFFFF isn't a great sigil value for float IMO (It's like 9.18e-41?). I guess you were going for an all 1s NaN and missed a few digits. That's fine, alternatively a weird bit pattern like 0x5a5a5a5a is just a number but it's usually fairly easy to spot.

2.2, 0xFFFF, 0xFFFF, 0xFFFF,
3.3, 0xFFFF, 0xFFFF, 0xFFFF,
4.4]
- Name: Out
Format: Float32
FillSize: 16
- Name: ExpectedOut
Format: Float32
Data: [ 1.1, 2.2, 3.3, 4.4]
Results:
- Result: Out
Rule: BufferExact
Actual: Out
Expected: ExpectedOut
DescriptorSets:
- Resources:
- Name: cbuffer
Kind: ConstantBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: Out
Kind: RWBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0

# Note: Metal and Vulkan KosmicKrisp and MoltenVK
# Are always empty
Comment on lines +55 to +56
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume you'll put bug numbers along with all of these unsupported/xfail before you merge this.

# UNSUPPORTED: Darwin

# NOTE: AMD on Clang and DXC have result:
# [ 1.1, 65535, 65535, 65535]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting - row vs column major confusion?

# XFAIL: AMD && DirectX

# Note: clang Vulkan crashes
# BUG https://github.com/llvm/llvm-project/issues/179879
# XFAIL: Clang && 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
69 changes: 69 additions & 0 deletions test/Feature/CBuffer/Matrix/SingleSubscript/mat_cbuffer.f2x4.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#--- source.hlsl
RWStructuredBuffer<float4> Out : register(u0);

cbuffer example : register(b1) {
float2x4 M1;
};

[numthreads(1,1,1)]
void main() {
Out[0] = M1[0];
Out[1] = M1[1];
}
//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: cbuffer
Format: Float32
Data: [ 1.1, 5.5, 0xFFFF, 0xFFFF,
2.2, 6.6, 0xFFFF, 0xFFFF,
3.3, 7.7, 0xFFFF, 0xFFFF,
4.4, 8.8 ]
- Name: Out
Format: Float32
FillSize: 32
- Name: ExpectedOut
Format: Float32
Data: [ 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 ]
Results:
- Result: Out
Rule: BufferExact
Actual: Out
Expected: ExpectedOut
DescriptorSets:
- Resources:
- Name: cbuffer
Kind: ConstantBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: Out
Kind: RWBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0

# Note: Metal and Vulkan KosmicKrisp and MoltenVK
# Are always empty
# UNSUPPORTED: Darwin

# NOTE: AMD on Clang and DXC have result:
# [ 1.1, 5.5, 6.6, 7.7, 8.8, 0, 0, 0 ]
# XFAIL: AMD && DirectX

# Note: clang Vulkan crashes
# BUG https://github.com/llvm/llvm-project/issues/179879
# XFAIL: Clang && 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
68 changes: 68 additions & 0 deletions test/Feature/CBuffer/Matrix/SingleSubscript/mat_cbuffer.f3x2.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#--- source.hlsl
RWStructuredBuffer<float2> Out : register(u0);

cbuffer example : register(b1) {
float3x2 M1;
};

[numthreads(1,1,1)]
void main() {
Out[0] = M1[0];
Out[1] = M1[1];
Out[2] = M1[2];
}
//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: cbuffer
Format: Float32
Data: [ 1.1, 3.3, 5.5, 0xFFFF,
2.2, 4.4, 6.6, 0xFFFF ]
- Name: Out
Format: Float32
FillSize: 24
- Name: ExpectedOut
Format: Float32
Data: [ 1.1, 2.2, 3.3, 4.4, 5.5, 6.6 ]
Results:
- Result: Out
Rule: BufferExact
Actual: Out
Expected: ExpectedOut
DescriptorSets:
- Resources:
- Name: cbuffer
Kind: ConstantBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: Out
Kind: RWBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0

# Note: Metal and Vulkan KosmicKrisp and MoltenVK
# Are always empty
# UNSUPPORTED: Darwin

# NOTE: AMD on Clang and DXC have result:
# [ 1.1, 3.3, 5.5, 6.6, 0, 0 ]
# XFAIL: AMD && DirectX

# Note: clang Vulkan crashes
# BUG https://github.com/llvm/llvm-project/issues/179879
# XFAIL: Clang && 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
72 changes: 72 additions & 0 deletions test/Feature/CBuffer/Matrix/SingleSubscript/mat_cbuffer.f4x2.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#--- source.hlsl
RWStructuredBuffer<float2> Out : register(u0);

cbuffer example : register(b1) {
float4x2 M1;
};

[numthreads(1,1,1)]
void main() {
Out[0] = M1[0];
Out[1] = M1[1];
Out[2] = M1[2];
Out[3] = M1[3];
}
//--- pipeline.yaml

---
Shaders:
- Stage: Compute
Entry: main
DispatchSize: [1, 1, 1]
Buffers:
- Name: cbuffer
Format: Float32
Data: [ 1.1, 2.2, 3.3, 4.4,
5.5, 6.6, 7.7, 8.8 ]
- Name: Out
Format: Float32
FillSize: 32
- Name: ExpectedOut
Format: Float32
Data: [ 1.1, 5.5, 2.2, 6.6, 3.3, 7.7, 4.4, 8.8]
Results:
- Result: Out
Rule: BufferExact
Actual: Out
Expected: ExpectedOut
DescriptorSets:
- Resources:
- Name: cbuffer
Kind: ConstantBuffer
DirectXBinding:
Register: 1
Space: 0
VulkanBinding:
Binding: 1
- Name: Out
Kind: RWBuffer
DirectXBinding:
Register: 0
Space: 0
VulkanBinding:
Binding: 0

# Note: Metal and Vulkan KosmicKrisp and MoltenVK
# Are always empty
# UNSUPPORTED: Darwin

# Note: Nvidia crashes on both clang and DXC
# XFAIL: NV && Vulkan

# Note: clang Vulkan crashes
# BUG https://github.com/llvm/llvm-project/issues/179879
# XFAIL: Clang && Vulkan

# NOTE: AMD on Clang and DXC have result:
# [ 1.1, 2.2, 3.3, 4.4, 8.8, 0, 0, 0 ]
# XFAIL: AMD && DirectX

# 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