startup: accept the early exit of a kill in the slot 57 pixel stage (Part of #2413) #2816

Merged
mumba17 merged 2 commits from upstream-pr/2824 into main 2026-11-26 12:06:08 +00:00
mumba17 commented 2026-11-26 11:57:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-11-26T11:57:18Z.


Change

Part of #2413.

A slot 57 colour pixel stage whose only null export is the early exit of a kill was refused with slot 57 pixel stage mixes the null export with another export. LLVM SILateBranchLowering and Mesa ACO place that exit after the program's s_endpgm:

exp mrt0 ... done vm
s_endpgm
.exit:
exp null off, off, off, off done vm
s_endpgm

kill_exit_block in tools/startup/gfx2hlsl.py accepts the block when it holds the program's one null export, is the last two instructions, follows an s_endpgm, and every branch into it enters with EXEC zero:

  • s_cbranch_execz, or
  • the demote form: s_cbranch_scc0 directly after s_cselect_b32 exec_lo, exec_lo, 0 / s_cselect_b64 exec, exec, 0, with no branch landing on the s_cbranch_scc0. s_cselect leaves SCC, so when the branch is taken, the instruction before it has just set EXEC to 0.

All other mixed forms keep the existing refusal. The general pixel lowering is unchanged: the null export writes nothing and keeps its vm discard.

Verification

Head 546e9b22 on 410f6004 (developed on 700522ef). Windows 11 build 26300.9974, RTX 3090 driver 32.0.16.1664, DXC 10.0.26100, Python venv from requirements-dev.txt.

  • python -B tests/startup_mesh57_depth_only_check.py: ok. Both forms translate with SV_Target0 and the discard. Ten near misses stay refused: fall-through into the null export, a block no branch reaches, entry by s_branch, an exit export without vm, another instruction in the block; for the demote form, no s_cselect, an s_cselect that keeps EXEC, one into another register, an instruction between select and branch, and s_cbranch_scc1.
  • Negative control: the same check on unpatched 700522ef fails the acceptance cases with the mixed-export message.
  • startup_mesh57_skeleton_check.py killexit <dxc> offscreen_check {warp,hardware}: both pairs match the CPU rasteriser with the two killed triangles dropped (pixels=1024 mismatches=0) on WARP and RTX 3090. The same mesh with the pixel stage that does not kill differs at exactly the 115 killed pixels. Without the fix the check fails at translation.
  • python -B tests/startup_mesh57_skeleton_check.py, docs_links_check.py, bidi_controls_check.py: ok.
  • ctest --test-dir out/build/release --no-tests=error -j 1 -R "mesh57|mesh_cbv_order|startup_gfx2hlsl" --output-on-failure on the pre-rebase base: 323/324. The one failure, startup_gfx2hlsl_float_transcendental_hardware (v_log_f32 one ULP off on RTX 3090), failed identically on unpatched 700522ef and is fixed on main by #2814.
  • After rebasing onto 410f6004: ctest ... -j 1 -R "mesh57|mesh_cbv_order|float_transcendental": 26/26, including startup_mesh57_skeleton_kill_exit_{warp,hardware}.
  • The Python checks listed in windows.yml through tools/run_checks_parallel.py -j 10: 223 ok, 2 capability skips (startup_run_sh_check, startup_build_rev_check). 11 scripts need arguments that the workflow passes and my listing did not (for example mesh_entry_check.py), so they were not run that way.

Local evidence (counts only)

In a local capture, 97 slot 57 requests (95 distinct pixel programs, colour stages with 2 to 6 targets) stopped at this check: 89 enter the exit by s_cbranch_execz only, 6 also by the demote s_cbranch_scc0. With the change, all 97 move to mesh-stage refusals tracked in #2413 (execz blocks 71, group-index exchange 15, loops 11), so this PR adds no complete translation by itself. No capture data is included.

Not covered

  • A draw through the runtime: no runtime path loads slot 57 pairs yet (#2413 R1).
  • Other mixed null-export forms.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated docs (docs/experiments.md, slot 57 depth-only section).
  • I did not include game files, dumps, distribution links or secrets.

This change was AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6626139404 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2824). Originally posted by [mumba17](https://github.com/mumba17) on 2026-11-26T11:57:18Z. --- ## Change Part of #2413. A slot 57 colour pixel stage whose only null export is the early exit of a kill was refused with `slot 57 pixel stage mixes the null export with another export`. LLVM `SILateBranchLowering` and Mesa ACO place that exit after the program's `s_endpgm`: ``` exp mrt0 ... done vm s_endpgm .exit: exp null off, off, off, off done vm s_endpgm ``` `kill_exit_block` in `tools/startup/gfx2hlsl.py` accepts the block when it holds the program's one null export, is the last two instructions, follows an `s_endpgm`, and every branch into it enters with EXEC zero: - `s_cbranch_execz`, or - the demote form: `s_cbranch_scc0` directly after `s_cselect_b32 exec_lo, exec_lo, 0` / `s_cselect_b64 exec, exec, 0`, with no branch landing on the `s_cbranch_scc0`. `s_cselect` leaves SCC, so when the branch is taken, the instruction before it has just set EXEC to 0. All other mixed forms keep the existing refusal. The general pixel lowering is unchanged: the null export writes nothing and keeps its `vm` discard. ## Verification Head 546e9b22 on 410f6004 (developed on 700522ef). Windows 11 build 26300.9974, RTX 3090 driver 32.0.16.1664, DXC 10.0.26100, Python venv from `requirements-dev.txt`. - `python -B tests/startup_mesh57_depth_only_check.py`: ok. Both forms translate with `SV_Target0` and the discard. Ten near misses stay refused: fall-through into the null export, a block no branch reaches, entry by `s_branch`, an exit export without `vm`, another instruction in the block; for the demote form, no `s_cselect`, an `s_cselect` that keeps EXEC, one into another register, an instruction between select and branch, and `s_cbranch_scc1`. - Negative control: the same check on unpatched 700522ef fails the acceptance cases with the mixed-export message. - `startup_mesh57_skeleton_check.py killexit <dxc> offscreen_check {warp,hardware}`: both pairs match the CPU rasteriser with the two killed triangles dropped (`pixels=1024 mismatches=0`) on WARP and RTX 3090. The same mesh with the pixel stage that does not kill differs at exactly the 115 killed pixels. Without the fix the check fails at translation. - `python -B tests/startup_mesh57_skeleton_check.py`, `docs_links_check.py`, `bidi_controls_check.py`: ok. - `ctest --test-dir out/build/release --no-tests=error -j 1 -R "mesh57|mesh_cbv_order|startup_gfx2hlsl" --output-on-failure` on the pre-rebase base: 323/324. The one failure, `startup_gfx2hlsl_float_transcendental_hardware` (`v_log_f32` one ULP off on RTX 3090), failed identically on unpatched 700522ef and is fixed on main by #2814. - After rebasing onto 410f6004: `ctest ... -j 1 -R "mesh57|mesh_cbv_order|float_transcendental"`: 26/26, including `startup_mesh57_skeleton_kill_exit_{warp,hardware}`. - The Python checks listed in `windows.yml` through `tools/run_checks_parallel.py -j 10`: 223 ok, 2 capability skips (`startup_run_sh_check`, `startup_build_rev_check`). 11 scripts need arguments that the workflow passes and my listing did not (for example `mesh_entry_check.py`), so they were not run that way. ## Local evidence (counts only) In a local capture, 97 slot 57 requests (95 distinct pixel programs, colour stages with 2 to 6 targets) stopped at this check: 89 enter the exit by `s_cbranch_execz` only, 6 also by the demote `s_cbranch_scc0`. With the change, all 97 move to mesh-stage refusals tracked in #2413 (execz blocks 71, group-index exchange 15, loops 11), so this PR adds no complete translation by itself. No capture data is included. ## Not covered - A draw through the runtime: no runtime path loads slot 57 pairs yet (#2413 R1). - Other mixed null-export forms. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated docs (`docs/experiments.md`, slot 57 depth-only section). - [x] I did not include game files, dumps, distribution links or secrets. This change was AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-26 13:03:04 +00:00
tedin7 commented 2026-11-26 13:03:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:05:56Z.

Review: COMMENTED


Review of head fafa1134 (author's merge of main into 546e9b22; the PR's own diff is unchanged).

Checked:

  • kill_exit_block in tools/startup/gfx2hlsl.py: accepts only one null export that is the last two instructions, follows an s_endpgm, is done vm, and is entered only by s_cbranch_execz or the demote s_cselect ... exec, 0 + s_cbranch_scc0 form. Other mixed forms keep the refusal. Logic is correct.
  • No overlap: #2606/#2520/#2421 cover the null-export-only stage; #2783/#2785 touch EXEC-zero blocks in other stages and do not touch this exit.
  • Test guards the behavior: startup_mesh57_skeleton_check.py killexit is a real D3D12 draw compared with the CPU rasteriser with the killed triangles dropped (pixels=1024 mismatches=0), and the same mesh without the kill differs at exactly the killed pixels, so discarded pixels are covered. WARP and hardware tests are registered in CMake next to the sibling depth tests.
  • Mutations run (each made the check fail): s_branch accepted as an entry (1 FAIL); bool(entries) removed (1 FAIL).
  • Small gap, not a blocker: removing the "no branch lands on the s_cbranch_scc0" condition (not in targets) is NOT caught by any test. A near miss with a branch into the s_cbranch_scc0 would close it.

Commands run: python3 -B tests/startup_mesh57_depth_only_check.py, python3 -B tests/startup_mesh57_skeleton_check.py, python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py, git diff --check origin/main...HEAD (all ok); Win2025 dev+release on fafa1134 (receipt follows). Real-GPU run not available (RunPod stopped).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6073841217 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2824#pullrequestreview-6073841217). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T12:05:56Z. **Review:** COMMENTED --- Review of head fafa1134 (author's merge of main into 546e9b22; the PR's own diff is unchanged). Checked: - `kill_exit_block` in `tools/startup/gfx2hlsl.py`: accepts only one null export that is the last two instructions, follows an `s_endpgm`, is `done vm`, and is entered only by `s_cbranch_execz` or the demote `s_cselect ... exec, 0` + `s_cbranch_scc0` form. Other mixed forms keep the refusal. Logic is correct. - No overlap: #2606/#2520/#2421 cover the null-export-only stage; #2783/#2785 touch EXEC-zero blocks in other stages and do not touch this exit. - Test guards the behavior: `startup_mesh57_skeleton_check.py killexit` is a real D3D12 draw compared with the CPU rasteriser with the killed triangles dropped (`pixels=1024 mismatches=0`), and the same mesh without the kill differs at exactly the killed pixels, so discarded pixels are covered. WARP and hardware tests are registered in CMake next to the sibling depth tests. - Mutations run (each made the check fail): `s_branch` accepted as an entry (1 FAIL); `bool(entries)` removed (1 FAIL). - Small gap, not a blocker: removing the "no branch lands on the `s_cbranch_scc0`" condition (`not in targets`) is NOT caught by any test. A near miss with a branch into the `s_cbranch_scc0` would close it. Commands run: `python3 -B tests/startup_mesh57_depth_only_check.py`, `python3 -B tests/startup_mesh57_skeleton_check.py`, `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py`, `git diff --check origin/main...HEAD` (all ok); Win2025 dev+release on fafa1134 (receipt follows). Real-GPU run not available (RunPod stopped). AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 13:03:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:05:57Z.


Win2025 WARP receipt for head fafa1134 after the author's merge of main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit fafa113494fcb490581532969b821bb7deb7d2aa:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2): 1.26s (configure 1.88s)
    • Test (ctest --preset dev -R 'mesh57|mesh_cbv_order' --parallel 6 --no-tests=error --output-on-failure): 22/23 passed (4.09s: mesh_cbv_order_warp 1.14s, mesh_cbv_order_hardware 1.13s, startup_mesh57_loop_warp 0.58s, startup_mesh57_skeleton_depth_hardware 0.60s, startup_mesh57_skeleton 1.74s, startup_mesh57_loop_hardware 0.56s, startup_mesh57_formatted_load_hardware 0.62s, startup_mesh57_formatted_load_warp 0.62s, startup_mesh57_skeleton_exchange_warp 2.73s, startup_mesh57_lane_spill_hardware 0.51s, startup_mesh57_skeleton_depth_warp 0.59s, startup_mesh57_lane_spill_warp 0.53s, startup_mesh57_depth_only 0.33s, startup_mesh57_lane_spill 0.30s, startup_mesh57_skeleton_wave_shift_hardware 0.54s, startup_mesh57_skeleton_draw_warp 3.38s, startup_mesh57_skeleton_wave_shift_warp 0.54s, startup_mesh57_skeleton_draw_hardware 3.43s, startup_mesh57_loop 0.25s, startup_mesh57_loop_refusal 0.23s, startup_mesh57_skeleton_exchange_hardware 0.27s, startup_mesh57_skeleton_kill_exit_hardware 0.56s, startup_mesh57_skeleton_kill_exit_warp 0.52s); skipped (capability, not a pass): startup_mesh57_skeleton_exchange_hardware
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2): 4.10s (configure 1.85s)
    • Test (ctest --preset release -R 'mesh57|mesh_cbv_order' --parallel 6 --no-tests=error --output-on-failure): 22/23 passed (3.93s: startup_mesh57_formatted_load_hardware 0.60s, mesh_cbv_order_warp 1.02s, startup_mesh57_skeleton_depth_hardware 0.53s, startup_mesh57_skeleton_depth_warp 0.59s, startup_mesh57_skeleton 1.67s, startup_mesh57_loop_hardware 0.57s, startup_mesh57_formatted_load_warp 0.62s, startup_mesh57_loop_warp 0.55s, startup_mesh57_lane_spill_warp 0.52s, startup_mesh57_skeleton_exchange_warp 2.47s, startup_mesh57_lane_spill_hardware 0.49s, startup_mesh57_skeleton_wave_shift_hardware 0.50s, startup_mesh57_skeleton_wave_shift_warp 0.52s, startup_mesh57_lane_spill 0.31s, startup_mesh57_loop_refusal 0.20s, startup_mesh57_loop 0.24s, startup_mesh57_depth_only 0.33s, startup_mesh57_skeleton_draw_warp 3.19s, startup_mesh57_skeleton_draw_hardware 3.20s, startup_mesh57_skeleton_exchange_hardware 0.28s, startup_mesh57_skeleton_kill_exit_hardware 0.60s, startup_mesh57_skeleton_kill_exit_warp 0.53s, mesh_cbv_order_hardware 0.81s); skipped (capability, not a pass): startup_mesh57_skeleton_exchange_hardware
  • Windows Python checks: tests/startup_mesh57_depth_only_check.py ok (0.2s), tests/startup_mesh57_skeleton_check.py ok (1.0s)
  • sccache: 4/6 hits; wall 19.5s

Note: the single non-pass in each run is startup_mesh57_skeleton_exchange_hardware, Skipped (exit 77, the VM has no hardware adapter). New tests startup_mesh57_skeleton_kill_exit_warp and _hardware passed in dev and release. Real-GPU run not available (RunPod stopped).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7191563623 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2824#issuecomment-7191563623). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T12:05:57Z. --- Win2025 WARP receipt for head fafa1134 after the author's merge of main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `fafa113494fcb490581532969b821bb7deb7d2aa`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2`): `1.26s` (configure `1.88s`) - Test (`ctest --preset dev -R 'mesh57|mesh_cbv_order' --parallel 6 --no-tests=error --output-on-failure`): **22/23 passed** (`4.09s`: `mesh_cbv_order_warp` `1.14s`, `mesh_cbv_order_hardware` `1.13s`, `startup_mesh57_loop_warp` `0.58s`, `startup_mesh57_skeleton_depth_hardware` `0.60s`, `startup_mesh57_skeleton` `1.74s`, `startup_mesh57_loop_hardware` `0.56s`, `startup_mesh57_formatted_load_hardware` `0.62s`, `startup_mesh57_formatted_load_warp` `0.62s`, `startup_mesh57_skeleton_exchange_warp` `2.73s`, `startup_mesh57_lane_spill_hardware` `0.51s`, `startup_mesh57_skeleton_depth_warp` `0.59s`, `startup_mesh57_lane_spill_warp` `0.53s`, `startup_mesh57_depth_only` `0.33s`, `startup_mesh57_lane_spill` `0.30s`, `startup_mesh57_skeleton_wave_shift_hardware` `0.54s`, `startup_mesh57_skeleton_draw_warp` `3.38s`, `startup_mesh57_skeleton_wave_shift_warp` `0.54s`, `startup_mesh57_skeleton_draw_hardware` `3.43s`, `startup_mesh57_loop` `0.25s`, `startup_mesh57_loop_refusal` `0.23s`, `startup_mesh57_skeleton_exchange_hardware` `0.27s`, `startup_mesh57_skeleton_kill_exit_hardware` `0.56s`, `startup_mesh57_skeleton_kill_exit_warp` `0.52s`); skipped (capability, not a pass): `startup_mesh57_skeleton_exchange_hardware` - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2`): `4.10s` (configure `1.85s`) - Test (`ctest --preset release -R 'mesh57|mesh_cbv_order' --parallel 6 --no-tests=error --output-on-failure`): **22/23 passed** (`3.93s`: `startup_mesh57_formatted_load_hardware` `0.60s`, `mesh_cbv_order_warp` `1.02s`, `startup_mesh57_skeleton_depth_hardware` `0.53s`, `startup_mesh57_skeleton_depth_warp` `0.59s`, `startup_mesh57_skeleton` `1.67s`, `startup_mesh57_loop_hardware` `0.57s`, `startup_mesh57_formatted_load_warp` `0.62s`, `startup_mesh57_loop_warp` `0.55s`, `startup_mesh57_lane_spill_warp` `0.52s`, `startup_mesh57_skeleton_exchange_warp` `2.47s`, `startup_mesh57_lane_spill_hardware` `0.49s`, `startup_mesh57_skeleton_wave_shift_hardware` `0.50s`, `startup_mesh57_skeleton_wave_shift_warp` `0.52s`, `startup_mesh57_lane_spill` `0.31s`, `startup_mesh57_loop_refusal` `0.20s`, `startup_mesh57_loop` `0.24s`, `startup_mesh57_depth_only` `0.33s`, `startup_mesh57_skeleton_draw_warp` `3.19s`, `startup_mesh57_skeleton_draw_hardware` `3.20s`, `startup_mesh57_skeleton_exchange_hardware` `0.28s`, `startup_mesh57_skeleton_kill_exit_hardware` `0.60s`, `startup_mesh57_skeleton_kill_exit_warp` `0.53s`, `mesh_cbv_order_hardware` `0.81s`); skipped (capability, not a pass): `startup_mesh57_skeleton_exchange_hardware` - **Windows Python checks**: `tests/startup_mesh57_depth_only_check.py` ok (`0.2s`), `tests/startup_mesh57_skeleton_check.py` ok (`1.0s`) - `sccache`: 4/6 hits; wall `19.5s` Note: the single non-pass in each run is startup_mesh57_skeleton_exchange_hardware, Skipped (exit 77, the VM has no hardware adapter). New tests startup_mesh57_skeleton_kill_exit_warp and _hardware passed in dev and release. Real-GPU run not available (RunPod stopped). AI-assisted; commands listed were executed locally.
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!2816
No description provided.