Skip to content

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

Merged
tedin7 merged 2 commits into
R0Y00:mainfrom
mumba17:startup/mesh57-null-early-exit
Nov 26, 2026
Merged

tedin7 merged 2 commits into
R0Y00:mainfrom
mumba17:startup/mesh57-null-early-exit

Conversation

@mumba17

@mumba17 mumba17 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

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 546e9b2 on 410f600 (developed on 700522e). 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 700522e 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 700522e and is fixed on main by tests: accept 4 ulps for v_log_f32 in the transcendental fixture #2814.
  • After rebasing onto 410f600: 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

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

mumba17 and others added 2 commits November 26, 2026 12:51
…Part of R0Y00#2413)

A slot 57 colour pixel stage whose only null export is the early exit LLVM
SILateBranchLowering and Mesa ACO place after the program's s_endpgm was
refused as a mixed null export. kill_exit_block accepts that block when it is
`exp null off, off, off, off done vm` then the final s_endpgm, and every
branch into it enters with EXEC zero: s_cbranch_execz, or s_cbranch_scc0
directly after s_cselect exec, exec, 0 (the demote form). All other mixed
forms stay refused with the existing message.

Checks: startup_mesh57_depth_only_check.py (both forms plus ten near misses)
and startup_mesh57_skeleton_kill_exit_{warp,hardware}, which draw both pairs
against a CPU rasteriser without the killed triangles; the pair without the
kill must differ at the 115 killed pixels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head fafa113 (author's merge of main into 546e9b2; 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 fafa113 (receipt follows). Real-GPU run not available (RunPod stopped).

AI-assisted; commands listed were executed locally.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Win2025 WARP receipt for head fafa113 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.

@tedin7
tedin7 merged commit d4dfe97 into R0Y00:main Nov 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants