Skip to content
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

Parse SPIR-V row-major matrices #675

Closed
kvark opened this issue Apr 8, 2021 · 0 comments · Fixed by #682
Closed

Parse SPIR-V row-major matrices #675

kvark opened this issue Apr 8, 2021 · 0 comments · Fixed by #682
Assignees
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output

Comments

@kvark
Copy link
Member

kvark commented Apr 8, 2021

Our IR is column-major only. There is currently code in SPV-in fn parse_type_matrix to check for this:

if let Some(Decoration {
            matrix_major: Some(ref major),
            ..
        }) = decor
        {
            match *major {
                Majority::Column => (),
                Majority::Row => return Err(Error::UnsupportedRowMajorMatrix),
            }
        }

However, it never fires up, because the decoration is actually expected on a struct member instead of the type.
The same applies to matrix stride. They both are not correctly handled in SPV-in.
Here is an example dump from 215.spv:

               OpMemberDecorate %_struct_1504 0 RowMajor
               OpMemberDecorate %_struct_1504 0 Offset 0
               OpMemberDecorate %_struct_1504 0 MatrixStride 16
               OpMemberDecorate %_struct_1504 1 Offset 304
               OpMemberDecorate %_struct_1504 2 Offset 320
               OpMemberDecorate %_struct_1504 3 Offset 400
               OpMemberDecorate %_struct_1504 4 Offset 704

This is blocking #409

I think the idea on how this should be handled is to try to avoid translating it, unless necessary.
I.e. vector multiplication by a matrix can just switch the order in order to account for this, and it's possible that this is enough.

@kvark kvark added kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output area: front-end Input formats for conversion labels Apr 8, 2021
@kvark kvark self-assigned this Apr 9, 2021
@kvark kvark closed this as completed in #682 Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant