diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2024-07-08 21:34:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-08 21:34:51 -0700 |
| commit | 5a174dfab4ae0852cb96df5f48bae474949cc017 (patch) | |
| tree | 10f6fdaf9e272d8979609d161d1caad4094f5067 /tests | |
| parent | a453fadfb373499f08779dd7df8f2347d292fd91 (diff) | |
Fix the issue in emitFloatCast (#4559)
* Fix the issue in emitFloatCast
In emitFloatCast function, we only considered the input type
is float scalar or float vector, so if the input type is a float
matrix type, it will crash.
We should also handle the float matrix type.
Also, we add some diagnose info to point out the source location
where there is error happened, so in the future it's easier to tell
us what happens.
* Add a unit test
* Disable the test for metal
Metal doesn't support 'double'.
"
metal 32023.35: /tmp/unknown-YgHAsJ.metal(15): error : 'double' is not supported in Metal
matrix<double,int(3),int(4)> b_0 = matrix<double,int(3),int(4)> (a_0);
"
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/gh-4556.slang | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/bugs/gh-4556.slang b/tests/bugs/gh-4556.slang new file mode 100644 index 000000000..eed84779e --- /dev/null +++ b/tests/bugs/gh-4556.slang @@ -0,0 +1,21 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -compute -output-using-type -shaderobj +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -compute -output-using-type -shaderobj +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -glsl -compute -output-using-type -shaderobj +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl -compute -output-using-type -shaderobj +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -output-using-type -shaderobj + +//TEST_INPUT:ubuffer(data=[0.0 0.0], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +[shader("compute")] +[numthreads(1, 1, 1)] +void computeMain(uint3 id: SV_DispatchThreadID) +{ + float3x4 a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + double3x4 b = (double3x4)a; + + // CHECK: 1.000000 + outputBuffer[0] = (float)b[0][0]; + // CHECK: 2.000000 + outputBuffer[1] = (float)b[0][1]; +} |
