-
Notifications
You must be signed in to change notification settings - Fork 242
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
Invalid SPIR-V generation for outer product mul #5987
Comments
If possible, please avoid using matrix types where row or col is 1. They should be >= 2. |
1-vector and 1-matrix types are not well defined and can lead to all sorts of issues in the type system. They are not supported by SPIRV, Metal, WGSL, GLSL and not officially supported by Slang at the moment. |
I see. I would still like to see an error then instead of producing invalid SPIR-V. |
True, but for those cases DXC will automatically switch to vector/scalar types in its SPIR-V output, cfr. https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst#indexing-operator |
@jtytgat it is, and we do already have some level of support of 1-vectors. But we don’t yet have 1-matrix support. There are more work around 1-matrices because we will then rewrite all the algebra operations and we did not have time to get to it. Before the support around 1-matrices are complete, users should avoid using them to prevent running into weird corner case issues. We appreciate patches to make 1-matrices functional. |
@aleino-nv can you help to add an error for this one? |
Such matrices aren't well supported by our targets, and we currently don't transform such types to supported ones. Therefore, generate an error rather than outputting invalid target code. This closes shader-slang#5987.
Here is a PR that generates error messages like the following, on the above code:
|
...although that doesn't quite do it in all cases. I just found out that this can be circumvented like so:
I'll try to find a better place for this check... Any usage of e.g. |
https://github.com/shader-slang/slang/blob/master/tests/bugs/gh-4395.slang is now generating errors. Or maybe we add an option to opt out of this error, and then pass that option in this particular test? |
->
Specifically I believe this originates from this outer product mul (mat4x1 * mat1x4):
matrix<float32_t, 4, 4> TEMP_8 = mul(r1_4, TEMP_7);
The text was updated successfully, but these errors were encountered: