[SPIR-V] SPV_NV_mesh_shader can produce invalid SPIR-V
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- compilers
Hướng nghiên cứu
Start from the SPIR-V emission of mesh-shader DispatchMesh (the OpStore to TaskCountNV, which currently flattens xyz), the LocalSize execution mode for MeshNV, and the BuiltIn CullPrimitiveEXT decoration for SV_CullPrimitive. Reproduce with the three HLSL snippets using -spirv with the NV target. Done means each case gets a clear diagnostic under NV and the EXT path still compiles with -fspv-target-env=vulkan1.3.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
[SPIR-V] SPV_NV_mesh_shader accepts 2-D/3-D dispatch and SV_CullPrimitive, producing wrong or invalid SPIR-V
When DXC emits SPV_NV_mesh_shader, three inputs that NV can't represent are not diagnosed:
1. DispatchMesh(x, y, z) with y or z != 1. GL_NV_mesh_shader launches a one-dimensional array of tasks, and TaskCountNV is a scalar. DXC's SPIR-V back-end flattens the arguments to xyz , so the mesh shader's SV_GroupID is silently wrong whenever y - z > 1.
2. numthreads with Y or Z != 1 in mesh or amplification shaders. GL_NV_mesh_shader guarantees a work group size of only 1 in Y and Z, and calls its workgroups one-dimensional. glslang rejects NV local_size_y/local_size_z greater than 1, but DXC is emitting LocalSize 8 4 1 .
3. SV_CullPrimitive. NV has no per-primitive cull built-in. DXC emits BuiltIn CullPrimitiveEXT without the EXT capability and fails SPIR-V validation with a "please file a bug report" fatal error.
Steps to Reproduce
// as.hlsl — dxc -T as_6_5 -E main -spirv as.hlsl
struct Payload { uint x; };
groupshared Payload p;
[numthreads(1, 1, 1)]
void main() {
p.x = 0;
DispatchMesh(2, 3, 1, p);
}
// ms_nt.hlsl — dxc -T ms_6_5 -E main -spirv ms_nt.hlsl
struct VertOut { float4 pos : SV_Position; };
[outputtopology("triangle")]
[numthreads(8, 4, 1)]
void main(uint3 tid : SV_GroupThreadID,
out vertices VertOut verts[32], out indices uint3 tris[32]) {
SetMeshOutputCounts(32, 32);
uint i = tid.y * 8 + tid.x;
verts[i].pos = float4(tid, 1);
tris[i] = uint3(0, 1, 2);
}
// ms_cull.hlsl — dxc -T ms_6_5 -E main -spirv ms_cull.hlsl
struct VertOut { float4 pos : SV_Position; };
struct PrimOut { bool cull : SV_CullPrimitive; };
[outputtopology("triangle")]
[numthreads(1, 1, 1)]
void main(out vertices VertOut verts[3], out indices uint3 tris[1],
out primitives PrimOut prims[1]) {
SetMeshOutputCounts(3, 1);
verts[0].pos = float4(0, 0, 0, 1);
tris[0] = uint3(0, 1, 2);
prims[0].cull = false;
}
Actual Behavior
- Compiles. OpStore %TaskCountNV %uint_6 launches 6 tasks in one dimension, so the mesh shader sees SV_GroupID = (0..5, 0, 0) instead of a 2×3 grid.
- Compiles, emitting OpExecutionMode %main LocalSize 8 4 1 for MeshNV.
- Fails:
fatal error: generated SPIR-V is invalid: Operand 3 of Decorate requires one of these capabilities: MeshShadingEXT
OpDecorate %4 BuiltIn CullPrimitiveEXT
note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues ...
Expected: clear errors under NV for all three. Each compiles with -fspv-target-env=vulkan1.3 , which selects EXT.
Environment
- DXC version 1.10.2609.0
- Host Operating System Windows
- Ngôn ngữ chính
- C++
- Star
- 3.7k
- Fork
- 926
- Merge trung bình
- 3 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/DirectXShaderCompiler
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/DirectXShaderCompiler#9173 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
microsoft/DirectXShaderCompiler#9155 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/DirectXShaderCompiler#9135 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
DXC emits DW_LANG_C_plus_plus instead of DW_LANG_HLSL for HLSLCó thể đã có người làm @rj123-nv đã nhận 18 ngày trước. Đang mởbug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoft/DirectXShaderCompiler#9087 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoft/DirectXShaderCompiler#9086 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/DirectXShaderCompiler
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
feature:config kind:docs os:windows toolchain:cmake triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
arch-based bug niri
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
noctalia-dev/noctalia#5552 ·
Maintainer thường phản hồi trong vòng 1 ngày