[SM6.9][SER] inout dx::HitObject parameter reaches the DXIL intrinsic as undef
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
- 55/100
Hướng nghiên cứu
Start in CGHLSLMS.cpp at the copy-in and copy-back checks around lines 6201 and 6495, then inspect the temporary address replacement and lifetime marker handling around lines 6408 and 6540–6549. Compare how HitObject is classified in both paths and run the proposed hitobject-inout-byval.hlsl case with dxc -T lib_6_9; done means the reading callee observes the value created by MakeMiss and validation passes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
Passing a dx::HitObject as an inout parameter loses the caller's value. The callee sees undef and validation fails. in works, and inout also works with -Od or -disable-lifetime-markers. Lifetime markers are on by default from SM 6.6, so this affects normal SM 6.9 compiles.
Steps to Reproduce
RWBuffer<uint> o : register(u0);
void F(inout dx::HitObject h) { o[0] = h.IsMiss(); }
[shader("raygeneration")]
void main() {
RayDesc r;
dx::HitObject h = dx::HitObject::MakeMiss(0, 0, r);
F(h);
}
dxc -T lib_6_9 hitobject_inout.hlsl
Compiles cleanly with any of: -Od, -disable-lifetime-markers, or inout changed to in.
Actual Behavior
error: validation errors
hitobject_inout.hlsl:3:40: error: HitObject is undef.
note: at '%2 = call i1 @dx.op.hitObject_StateScalar.i1(i32 269, %dx.types.HitObject undef)' in block '#0' of function '?main@@YAXXZ'.
Validation failed.
Expected Behavior
h.IsMiss() reads the hit object created by MakeMiss.
Environment
- DXC 1.9.2609.5 (
01b62ad47), also reproduced on 1.9.2602.24 - Windows 10 Home 64-bit, build 19045
Additional context
The copy-in and copy-back code in CGHLSLMS.cpp disagree on whether HitObject is an object:
- Copy-in (
:6201) checksIsByValueObject, treatsHitObjectas a value, and emits the copy. - Copy-back (
:6495) checks onlydxilutil::IsHLSLObjectType, treats it as an object, and falls through totmpArgAddr->replaceAllUsesWith(argLV.getAddress())at:6540.
The lifetime.start emitted at :6408 is one of the rewritten uses, so it moves onto the caller's alloca after MakeMiss has stored to it. mem2reg treats it as a def and the value becomes undef. The lifetime.end at :6549 is created after the RAUW and stays on the unused temporary.
This looks like a regression from #7767 (8872029ef), which introduced IsByValueObject but didn't update the copy-back check.
Test coverage note: hitobject-byval.hlsl and hitobject-array-byval.hlsl say inout behaves like the other modifiers, but neither tests it. Adding an inout RUN line wouldn't catch this anyway, because none of the callees read their parameter. A test with a reading callee will be attached as hitobject-inout-byval.hlsl; only its inout RUN line fails today.
- 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