startup: lower the first active lane of a pixel stage in gfx2hlsl (Refs #2618) #2846
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2854"
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 RenzoWit35 on 2026-11-26T14:24:14Z.
Change
This implements the FIX claim in https://github.com/R0Y00/Xbox2Windows/issues/2618#issuecomment-7193852709 (the F rows, for example M500-01/070). Refs #2618.
On main,
tools/startup/gfx2hlsl.pyfoldss_ff1_i32_b32 sD, exec_loonly at compute dispatch entry (#2389). It refuses the instruction in a pixel stage with "s_ff1_i32_b32 of exec_lo outside compute". A pixelv_readlane_b32accepts only a constant spill lane.The pair
s_ff1_i32_b32 sD, exec_lo/v_readlane_b32 sX, vY, sDreadsvYfrom the lowest lane in EXEC. In a pixel stage it now becomesWaveReadLaneFirst(vY)over the active lanes of the desktop wave. This uses the packing contract of the #2835 wave reductions: a correct program cannot depend on which pixel the console puts first.Stage.first_active_lane(called fromop_s_ff1_i32_b32) turnssDinto a symbol with no run-time value. The desktop numbers its lanes in its own way. Each read ofsDup to its next write must be the lane select of av_readlane_b32; any other read is refused by name (a shift, a copy to another SGPR, a move to a VGPR).Stage.read_first_lane(called fromop_v_readlane_b32) emitssX = WaveReadLaneFirst(vY);.s_ff1and at each readlane, with nos_wqmbefore them. On the console the helper lanes are then out of EXEC, and on the desktop wave operations leave them out.v_writelane_b32spill VGPR as the readlane source;exec_hior the 64-bitexec. The decoder prints wave32 syntax, and in wave64exec_lois half the wave.Not covered: pixel stages with branches, wave64, and other first-lane forms such as
v_mbcntcompared withsD, ors_ff1of a copy of EXEC. Whether the F rows stop at this exact pair still needs a replay against the captured requests by someone with capture access.Verification
Commit
037eaf1b, rebased on5a41adba. Windows 11 build 26300, VS Build Tools 2026 (MSVC 14.51), DXC 1.8.2502, Python 3.14. WARP 10.0.26100.9818. The D3D12 debug layer is not installed on this machine (debug_layer=unavailable).WaveActiveMinof the pixel id, not by the intrinsic under test. Four planted errors fail against the reference:python-linuxlist (tools/run_checks_parallel.py --from-dir tests/checks/python-linuxplus the inline list), run locally on Windows, has no failures. Two checks skip on Windows (startup_run_sh_check,startup_build_rev_check).pixel-binaryjob runs it. Every fixture's words decode back to its source text with the repository disassembler.WARP runs 4-lane waves, so on WARP the reference separates only covered lanes from helper lanes within a quad. Only
startup_gfx2hlsl_pixel_first_lane_hardwareon an adapter with wider waves picks a first lane across quads. I have no discrete GPU result to report.Evidence and follow-up
tests/cmake/startup_gfx2hlsl_pixel_first_lane.cmake,tests/checks/python-linux/startup_gfx2hlsl_pixel_first_lane.txt,tests/checks/pixel-binary/startup_gfx2hlsl_pixel_first_lane.txt.docs/experiments/startup-gfx2hlsl-pixel-first-lane.md, plus a bullet indocs/startup-runtime.mdafter the wave reductions bullet.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T14:29:13Z.
Review: COMMENTED
Review of head
037eaf1b(comment only).What I checked:
first_active_lane/read_first_laneintools/startup/gfx2hlsl.py: the pairs_ff1_i32_b32 sD, exec_lo+v_readlane_b32 sX, vY, sDbecomesWaveReadLaneFirst(vY). Guards look right: straight-line pixel stage only, EXEC must be the entry mask, nos_wqm, lane-number reads other than the readlane select are refused, spill VGPRs are refused, vs/ms stay refused.startup_gfx2hlsl_pixel_first_lane_check.pyfail (refused: a program with branches). Removing theexec_higuard does not fail it, because the decoder already refusesexec_hiearlier (operand 'exec_hi'), so that guard is currently redundant (not a blocker).startup_gfx2hlsl_wave_reduce_check.pystill passes; docs and CMake wiring follow the existing pattern.Commands executed locally:
python3 -B tests/startup_gfx2hlsl_pixel_first_lane_check.py: PASSpython3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,git diff --check origin/main...HEAD: cleanNot verified: real-GPU run not available (RunPod stopped). The PR cites #2618 and the startup path; I cannot check on the game itself, so the merge stays with MasterDomino or @R0Y00.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T14:29:12Z.
Win2025 WARP receipt for head
037eaf1b.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
037eaf1b37288d23edf5c7d7dcadedbdd98bcc0c:--preset dev):ctest -R startup_gfx2hlsl_pixel_first_lane: 3/3 passed (_controls,_warp,_hardware)./O2(--preset release): same filter, 3/3 passed.tests/startup_gfx2hlsl_pixel_first_lane_check.pyok,tests/startup_gfx2hlsl_wave_reduce_check.pyok._hardwaretest ran on the VM's adapter.AI-assisted; commands listed were executed locally.