diff options
| author | Yong He <yonghe@outlook.com> | 2022-12-14 09:37:55 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-14 09:37:55 -0800 |
| commit | 1c2c4908c64396de2d1bee197c8f000ae2fed0fc (patch) | |
| tree | 9156050fd8613ded46b7b2a2bf6c3bf139663521 /tests | |
| parent | 5ce8d4c146fef7c8890cd40e112858db69702bd2 (diff) | |
Fix code generation for matrix reshape. (#2568)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/matrix-reshape.slang | 20 | ||||
| -rw-r--r-- | tests/bugs/matrix-reshape.slang.expected.txt | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/bugs/matrix-reshape.slang b/tests/bugs/matrix-reshape.slang new file mode 100644 index 000000000..2d95963d4 --- /dev/null +++ b/tests/bugs/matrix-reshape.slang @@ -0,0 +1,20 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj -output-using-type + +//TEST_INPUT:ubuffer(data=[0], stride=4):out,name outputBuffer +RWStructuredBuffer<float> outputBuffer; + +float test(float3x3 m3) +{ + return m3[0][0] + m3[1][1] + m3[2][2]; +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + float4x4 m = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; + float3x3 m3 = float3x3(m); + outputBuffer[0] = test(m3); // Expect 18 +}
\ No newline at end of file diff --git a/tests/bugs/matrix-reshape.slang.expected.txt b/tests/bugs/matrix-reshape.slang.expected.txt new file mode 100644 index 000000000..2d8f3b3a7 --- /dev/null +++ b/tests/bugs/matrix-reshape.slang.expected.txt @@ -0,0 +1,2 @@ +type: float +18.0 |
