Skip to content

[DXIL] Broken codegen for loading elements from FP16 matrix types in StructuredBuffer #4492

Open

Description

On latest main I get the wrong result when loading elements from fp16 matrix types stored in structured buffers.

struct Data
{
    float16_t4x4 a;
};

StructuredBuffer<Data> buf : register(t1);

...
float16_t2 b = buf.a[0].xy;

This loads elements a[0][0] and a[0][2], not a[0][1] as expected.
Looking at the generated code it looks like it thinks there is 4B between each element not 2B.

See attached example HLSL and generated DXIL.
dxc-float16_t4x4-example.zip

Activity

  1. added
    bug
    correctness
    matrix-bug
    and removed
    needs-triage
    on Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcorrectnessmatrix-bug

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions