Skip to content

[SPIR-V] QuadReadLaneAt with a matrix input generates invalid SPIR-V #9134

Open

Description

Description

QuadReadLaneAt accepts a float2x3 input, but DXC generates invalid
SPIR-V. It emits OpGroupNonUniformQuadBroadcast with a matrix result.
That instruction permits only scalar and vector results.

The same source compiles successfully for DXIL. That output contains six
scalar quad reads, one for each matrix element.

Reproducer

Save this as repro.hlsl:

StructuredBuffer<float2x3> In : register(t0);
RWStructuredBuffer<float2x3> Out : register(u1);

[numthreads(4, 1, 1)]
void main(uint3 ID : SV_DispatchThreadID) {
  Out[ID.x] = QuadReadLaneAt(In[ID.x], 0);
}

Compile with:

dxc -spirv -T cs_6_5 -E main -fspv-target-env=vulkan1.3 repro.hlsl

Actual result

Compilation fails during SPIR-V validation:

fatal error: generated SPIR-V is invalid: Result must be a scalar or vector of integer, floating-point, or boolean type
  %28 = OpGroupNonUniformQuadBroadcast %mat2v3float %uint_3 %27 %uint_0

Expected result

Compilation succeeds. DXC splits the matrix operation into valid scalar
or vector quad reads. Each result element comes from the same matrix
element in the selected source lane.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions