[SPIR-V] -fvk-use-dx-layout places cbuffer matrices with double columns at a different offset than DXIL
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Start by searching the compiler for -fvk-use-dx-layout handling of cbuffer matrix member offsets, then look for tests covering DX-layout matrix padding, including the cases referenced in #3463 and #3672. Reproduce with the supplied HLSL and compare SPIR-V member offsets with DXIL reflection. Done means the double-matrix member offset matches DirectX’s 16-byte placement while the shared 32-byte column stride and existing float-matrix and vector cases remain unchanged.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Under -fvk-use-dx-layout, a cbuffer matrix whose SPIR-V columns are larger than 16 bytes (3 or 4 doubles) doesn't get DirectX's offset. DirectX starts a cbuffer member on the next 16-byte row, so double a; double3x3 m; puts m at 16. The SPIR-V output instead aligns the matrix to its own 32-byte column stride and puts it at 32. The same HLSL therefore describes different bytes per backend, which defeats the point of the flag: one application-side struct can't serve both backends. Both backends agree on the 32-byte column stride; only the member offset differs.
These cases land identically on both backends:
- float matrices
- double vectors
- double scalars
Related: #3463 / #3672 fixed DX-layout matrix padding for float matrices.
Steps to Reproduce
dxc -T cs_6_2 -E main -spirv -fvk-use-dx-layout repro.hlsl, compared with dxc -T cs_6_2 -E main repro.hlsl:
cbuffer CB { double a; double3x3 m; }
RWByteAddressBuffer o;
[numthreads(1, 1, 1)]
void main(uint id : SV_DispatchThreadID) { o.Store<float>(0, (float) (a + m[2][2])); }
A standalone repro comparing DXIL reflection against SPIRV-Reflect is attached (repro_dx_layout_double_matrix_spirv_reflect.cpp).
Actual Behavior
SPIR-V:
OpMemberDecorate %type_CB 0 Offset 0
OpMemberDecorate %type_CB 1 Offset 32
OpMemberDecorate %type_CB 1 MatrixStride 32
DXIL:
; double a; ; Offset: 0
; column_major double3x3 m; ; Offset: 16
All cases:
cbuffer CB { double a; double3x3 m; } m: DXIL 16, SPIR-V 32 <-- differs
cbuffer CB { double a; double3x2 m; } m: DXIL 16, SPIR-V 32 <-- differs
cbuffer CB { float a; float3x3 m; } m: DXIL 16, SPIR-V 16
cbuffer CB { double a; double3 b; } b: DXIL 16, SPIR-V 16
Environment
- DXC version: <latest release, from
dxc --version>; also reproduces on main, libdxcompiler.so: 1.11(5563-75fba619)(1.10.0.15563) - Host Operating System: Windows (release); Linux x86_64 (main)
- Lenguaje dominante
- C++
- Estrellas
- 3.7k
- Forks
- 926
- Merge medio
- 3 d 22 h
- PR fusionados (30 d)
- 45
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/DirectXShaderCompiler
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/DirectXShaderCompiler#9173 ·
Los mantenedores suelen responder en 2 días
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
microsoft/DirectXShaderCompiler#9155 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/DirectXShaderCompiler#9135 ·
Los mantenedores suelen responder en 2 días
-
DXC emits DW_LANG_C_plus_plus instead of DW_LANG_HLSL for HLSLPosiblemente ocupada @rj123-nv la tomó hace 18 días. Abiertobug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/DirectXShaderCompiler#9087 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/DirectXShaderCompiler#9086 ·
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/DirectXShaderCompiler
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
feature:config kind:docs os:windows toolchain:cmake triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
arch-based bug niri
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
noctalia-dev/noctalia#5552 ·
Los mantenedores suelen responder en 1 día