shader: treat a mesh uniform-address buffer load in an entered lane skip as uniform (Part of #3703) #3955

Open
mumba17 wants to merge 1 commit from upstream-pr/3955 into main
mumba17 commented 2026-12-03 17:42:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-03T17:42:32Z.


Part of #3703 (R1, v_readfirstlane_b32; claim: https://github.com/R0Y00/Xbox2Windows/issues/3703#issuecomment-7384414865).

Problem

#3790 marks a buffer load at a uniform address (no OFFEN, uniform IDXEN index, constant or uniform SOFFSET) as uniform, so a following v_readfirstlane_b32 reads the loaded word directly. Under a narrowed EXEC it did so only for a whole-wave skip (whole_wave_execution()). Inside an entered per-lane EXECZ skip the load lost the proof, and the read needed the groupshared broadcast, which cannot run inside a per-lane skip. It was refused with unsupported mesh instruction or EXEC state: v_readfirstlane_b32.

Change

mark_uniform_buffer_load also records the loaded words in active_uniform for the current lane set inside an entered EXECZ skip (exec_skip->guard == lane_active). That is the same term #3945 added for uniform-address scalar loads. Each thread that runs the load there is an active guest lane reading the same address, so every active lane sees the same words. The buffer-load rule's other conditions are unchanged: no open branch, and the uniform-address checks of #3790. Readers of active_uniform match the lane set, so the proof does not survive a further narrowing or a restore. The heap typed-load path is not changed.

Tests (native_direct_mesh)

  • uniform-load-in-lane-skip: buffer_load_dword v6, off, s[24:27], 0 offset:20 inside a per-lane v_cmpx_eq_u32 skip with s_cbranch_execz, then v_readfirstlane_b32 s20, v6 and v_cvt_f32_u32 v1, s20. It translates with no meshReadFirstLane slot, and the conversion reads the loaded word directly.
  • uniform-load-offen-in-lane-skip: the same with a per-lane OFFEN address. Still refused.
  • Mutation check: with the source change reverted, uniform-load-in-lane-skip fails with the v_readfirstlane_b32 refusal.

Census

Our native Mesh86 capture (RTX 3090, 600 s): 6,685 distinct .m86 programs, each run once through compile_dxil … gfx1013-container-ms-texture-heap.

  • main 8cb022db: 2,163 translate. With this change alone: 2,163, and no program's first refusal changes. The programs it helps stop earlier on main, at the SDWA v_cmpx_lt_u32 that #3947 lowers.
  • main 8cb022db + #3947: 2,163 translate; 276 stop at a v_readfirstlane_b32 of such a load inside a per-lane skip.
  • main 8cb022db + #3947 + this change: 2,292 translate (+129), 0 lost. All 276 move off v_readfirstlane_b32: 129 translate, and the rest stop at unproven packed mesh signature rows 43, v_cvt_f32_f16 24 (C1), mesh SAVEEXEC else arm is not vector-only 22, unsupported packed vertex export 20, mesh EXEC write inside a lane-skip block 18, unbound numeric SGPR 16, heap-slot provenance 2, mesh SAVEEXEC then arm lacks an EXECZ skip 2. No other program changes.

Counts only; request bytes stay local.

Checks

Windows 11 build 26300, MSVC (VS Build Tools 14.44), SDK/DXC 10.0.26100. ctest --preset pr on this commit (on main 8cb022db): 349/351 pass, native_direct_mesh included. The two local failures, native_compute_implicit_lod_controls and native_wave_virtual_derivative_controls, are the local SDK validator 1.7 vs DXIL 1.8 and fail on main too.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5631803322 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3955). Originally posted by [mumba17](https://github.com/mumba17) on 2026-12-03T17:42:32Z. --- Part of #3703 (R1, `v_readfirstlane_b32`; claim: https://github.com/R0Y00/Xbox2Windows/issues/3703#issuecomment-7384414865). ## Problem #3790 marks a buffer load at a uniform address (no OFFEN, uniform IDXEN index, constant or uniform SOFFSET) as uniform, so a following `v_readfirstlane_b32` reads the loaded word directly. Under a narrowed EXEC it did so only for a whole-wave skip (`whole_wave_execution()`). Inside an entered per-lane EXECZ skip the load lost the proof, and the read needed the groupshared broadcast, which cannot run inside a per-lane skip. It was refused with `unsupported mesh instruction or EXEC state: v_readfirstlane_b32`. ## Change `mark_uniform_buffer_load` also records the loaded words in `active_uniform` for the current lane set inside an entered EXECZ skip (`exec_skip->guard == lane_active`). That is the same term #3945 added for uniform-address scalar loads. Each thread that runs the load there is an active guest lane reading the same address, so every active lane sees the same words. The buffer-load rule's other conditions are unchanged: no open branch, and the uniform-address checks of #3790. Readers of `active_uniform` match the lane set, so the proof does not survive a further narrowing or a restore. The heap typed-load path is not changed. ## Tests (`native_direct_mesh`) - `uniform-load-in-lane-skip`: `buffer_load_dword v6, off, s[24:27], 0 offset:20` inside a per-lane `v_cmpx_eq_u32` skip with `s_cbranch_execz`, then `v_readfirstlane_b32 s20, v6` and `v_cvt_f32_u32 v1, s20`. It translates with no `meshReadFirstLane` slot, and the conversion reads the loaded word directly. - `uniform-load-offen-in-lane-skip`: the same with a per-lane OFFEN address. Still refused. - Mutation check: with the source change reverted, `uniform-load-in-lane-skip` fails with the `v_readfirstlane_b32` refusal. ## Census Our native Mesh86 capture (RTX 3090, 600 s): 6,685 distinct `.m86` programs, each run once through `compile_dxil … gfx1013-container-ms-texture-heap`. - `main` `8cb022db`: 2,163 translate. With this change alone: 2,163, and no program's first refusal changes. The programs it helps stop earlier on `main`, at the SDWA `v_cmpx_lt_u32` that #3947 lowers. - `main` `8cb022db` + #3947: 2,163 translate; 276 stop at a `v_readfirstlane_b32` of such a load inside a per-lane skip. - `main` `8cb022db` + #3947 + this change: **2,292 translate (+129), 0 lost.** All 276 move off `v_readfirstlane_b32`: 129 translate, and the rest stop at `unproven packed mesh signature rows` 43, `v_cvt_f32_f16` 24 (C1), `mesh SAVEEXEC else arm is not vector-only` 22, `unsupported packed vertex export` 20, `mesh EXEC write inside a lane-skip block` 18, `unbound numeric SGPR` 16, heap-slot provenance 2, `mesh SAVEEXEC then arm lacks an EXECZ skip` 2. No other program changes. Counts only; request bytes stay local. ## Checks Windows 11 build 26300, MSVC (VS Build Tools 14.44), SDK/DXC 10.0.26100. `ctest --preset pr` on this commit (on `main` `8cb022db`): 349/351 pass, `native_direct_mesh` included. The two local failures, `native_compute_implicit_lod_controls` and `native_wave_virtual_derivative_controls`, are the local SDK validator 1.7 vs DXIL 1.8 and fail on `main` too. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3955:upstream-pr/3955'
git switch 'upstream-pr/3955'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3955'
git switch 'upstream-pr/3955'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3955'
git switch 'upstream-pr/3955'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3955'
git switch 'main'
git merge --squash 'upstream-pr/3955'
git switch 'main'
git merge --ff-only 'upstream-pr/3955'
git switch 'main'
git merge 'upstream-pr/3955'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3955
No description provided.