shader: keep a mesh v_cvt_f16_f32 high half only where it is defined (Part of #3703) #3862
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3862"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-02T15:02:09Z.
Part of #3703 (claim: https://github.com/R0Y00/Xbox2Windows/issues/3703#issuecomment-7349088746).
Problem
On gfx10,
v_cvt_f16_f32writes the low half of its destination and keeps the high half. The shared ALU builds the merged word fromread(i.dst), which needs the whole old register. In a mesh program, when the destination has no value on one incoming path, or was never written, the conversion is refused withgraphics register undefined on an incoming pathorunproven mesh entry register N, even if nothing ever reads the high half.Change
Under
graphics_half_writes(the mesh frontend), the non-SDWAv_cvt_f16_f32uses the rulev_fma_mixlo_f16already uses. The high half is kept only where it is defined (graphics_bits), and the result is recorded as defined in0xffffplus those bits. A later read that needs the undefined high half is still refused byread_storagewithgraphics register read includes undefined bits. Paths withoutgraphics_half_writesand the SDWA forms are unchanged.Tests (
native_direct_mesh)cvt-f16-over-widen-low-half: v10 has no value on one path after a widened EXEC.v_cvt_f16_f32 v10thenv_pack_b32_f16of its low half translates, with no merge of an old high half.cvt-f16-over-widen-full-readandcvt-f16-over-widen-high-half(op_sel): a whole-word read or a high-half read of that v10 is refused withgraphics register read includes undefined bits: 266.v-cvt-f16-f32-unproven-destinationbecomesv-cvt-f16-f32-unwritten-destination. The conversion into a never-written v5, which the program overwrites before any read, now translates. The refusal it pinned came from reading the whole old word, and the cases above now cover the high-half reads.Census
A native Mesh86 capture on
main5770f14e(RTX 3090, 600 s,X2W_REFUSE_FIXED_MESH=1 X2W_NATIVE_MESH86=1) gives 6,685 distinct.m86programs. Each went throughcompile_dxil … gfx1013-container-ms-texture-heaponmain+ #3710 + #3760 + #3790, with #3851 and #3852 applied so it builds.undefined on an incoming path, and in 82 of them the instruction is this conversion.s_load_dwordx425 (#3835), D16 19 (#3836),v_cmpx_lt_f3215 andv_cvt_f32_f1611 (#3666),v_readfirstlane_b325 (#3842), packed rows 5,v_pack_b32_f16constant 1. The 15 that remain atundefined on an incoming patharev_fmac_f32/v_mul_legacy_f32shapes and are not part of this PR.Counts only; request bytes stay local.
Checks
Windows 11 build 26300, MSVC (VS Build Tools 14.44), SDK/DXC 10.0.26100.
ctest --preset pron this commit + #3851 + #3852 (maindoes not build with MSVC until #3852): 280/283 pass.native_direct_meshpasses. The two local failures,native_compute_implicit_lod_controlsandnative_wave_virtual_derivative_controls, are the local SDK validator 1.7 vs DXIL 1.8, also onmain. CI's Windows build will fail on the #3841 lambda capture until #3852 lands.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T15:26:19Z.
Review: APPROVED
Independent Windows/MSVC Debug review and build at
8a4aa8ee(after updating from main).cmake --build --preset dev --target compile_dxilpassed.ctest --preset dev --no-tests=error -j 1 -R '^native_direct_(mesh|container)$' --output-on-failurepassed 2/2. The mesh fixture accepts the defined low half after the widening join and refuses both high-half and whole-word consumers when the high half is undefined.