Skip to content

SPIR-V DebugTypeMatrix metadata differs between Slang, DXC, and glslang #12757

Description

@pdeayton-nv

Issue Description

For a column-major HLSL float2x3 buffer member, Slang emits a different
NonSemantic.Shader.DebugInfo.100 DebugTypeMatrix shape from DXC and glslang. The repro also
includes a row-major buffer member and local matrices as comparison cases.

Reproducer Code

repro.hlsl:

cbuffer ColumnParameters
{
    column_major float2x3 columnMajorValue;
};

cbuffer RowParameters
{
    row_major float2x3 rowMajorValue;
};

RWStructuredBuffer<float3> result;

[numthreads(1, 1, 1)]
void main()
{
    // Control case: Slang, DXC, and glslang emit the same DebugTypeMatrix
    // shape for these local float2x3 matrices.
    float2x3 localFromColumnMajor = columnMajorValue;
    float2x3 localFromRowMajor = rowMajorValue;

    float2 inputValue = float2(1.0, 2.0);
    result[0] =
        mul(inputValue, localFromColumnMajor) +
        mul(inputValue, localFromRowMajor);
}
slangc repro.hlsl -target spirv-asm -entry main -stage compute -g2

Expected Behavior

Ideally, Slang's DebugTypeMatrix for columnMajorValue would be consistent with DXC and
glslang: a three-component vector, vector count two, and a true Column Major operand.

Actual Behavior

The observed debug matrix types are:

Declaration Slang DXC glslang
column_major float2x3 columnMajorValue DebugTypeMatrix(vec2, 3, false) DebugTypeMatrix(vec3, 2, 1) DebugTypeMatrix(vec3, 2, true)
row_major float2x3 rowMajorValue DebugTypeMatrix(vec3, 2, true) DebugTypeMatrix(vec3, 2, 1) DebugTypeMatrix(vec3, 2, true)
local float2x3 matrices DebugTypeMatrix(vec3, 2, true) DebugTypeMatrix(vec3, 2, 1) DebugTypeMatrix(vec3, 2, true)

DXC expresses the true Column Major operand as integer 1.

All three compilers emit the same core matrix type. Their member decorations also agree, changing
with the source layout independently of the debug type:

%mat2v3float = OpTypeMatrix %v3float 2
OpMemberDecorate %ColumnParameters 0 RowMajor
OpMemberDecorate %ColumnParameters 0 MatrixStride 16
OpMemberDecorate %RowParameters 0 ColMajor
OpMemberDecorate %RowParameters 0 MatrixStride 16

Environment

  • Slang v2026.16-21-g30d3e0f3e (30d3e0f3e8c1fae72826988aa8576db344683834)
  • DXC 1.8.0.5049 (-fspv-debug=vulkan-with-source)
  • glslangValidator 15.4.0 (-gVS)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Dev OpenedreproducedProvided instructions confirmed to reproduce the issue

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions