Skip to content

[SPIR-V] sign() codegen uses incorrect vector size for non-square uint matrices with at least two rows/columns #8860

Description

@djb

Description

sign() generates invalid SPIR-V for any non-square uintMxN matrix with at least two rows and two columns due to a shape mismatch in the generated code: it uses OpUGreaterThan to compare each N-element row vector to an M-element zero vector and uses an M-element boolean vector result type.

Steps to Reproduce

Godbolt

Compile with dxc -T cs_6_0 -E main -Od -spirv source.hlsl:

[numthreads(1,1,1)]
void main() {
  uint2x4 u;
  int2x4 result = sign(u);
}

Actual Behavior

fatal error: generated SPIR-V is invalid: Expected vector sizes of Result Type and the operands to be equal: UGreaterThan
  %31 = OpUGreaterThan %v2bool %28 %8

Disabling validation, we can see the shape mismatch:

          %8 = OpConstantComposite %v2uint %uint_0 %uint_0
         [...]
         %28 = OpCompositeExtract %v4uint %27 0
         %31 = OpUGreaterThan %v2bool %28 %8

Environment

  • DXC version: libdxcompiler.so: 1.10(5474-942eeceb)(1.9.0.15470)
  • Host Operating System: Fedora Linux 43

Activity

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

    bugBug, regression, crashneeds-triageAwaiting triagespirvWork related to SPIR-V

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions