shader: prove spill-slot reads across branches in the startup translator #2516

Merged
NiiRoZz merged 9 commits from upstream-pr/2524 into main 2026-11-26 02:29:45 +00:00
NiiRoZz commented 2026-11-25 19:47:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T19:47:35Z.


Refs #2125

What changes

tools/startup/gfx2hlsl.py lowers the constant-lane SGPR spill pair v_writelane_b32 vN, sM, k / v_readlane_b32 sD, vN, k to one scalar per (VGPR, lane) (item E). Until now a pixel stage with any branch was refused with v_writelane_b32 needs straight-line code to prove write-before-read. This PR replaces that requirement with a proof that works with control flow.

  • spill_reaching runs a forward must-dataflow over the basic blocks joined_registers already builds. A slot counts as written at a join only if it is written on every incoming edge (intersection). The writes that can supply it are the union over those edges, iterated to a fixed point so that a later write in a loop body reaches the loop head through the back edge.
  • joined_registers(with_cfg=True) also returns the block graph and, for each s_cbranch_*, the blocks of the region it already computed (from the branch to its immediate post-dominator, or the loop range for a backward branch).
  • During the pass, the translator records the conditional branches it proves uniform (an SCC branch with scc_uniform; execz/vccz and the nz forms never are).

Soundness argument

The slot variable is assigned on the pixel's own path. The hardware lane holds the last write on the wave's path: both instructions ignore EXEC, so a write runs whenever the wave runs it. The pixel's path and the wave's path agree except inside the region of a branch that is not proven uniform. There the wave also runs blocks this pixel skips, or, for vccnz/execnz, skips blocks this pixel runs.

  • One reaching write. Every path into the read ran that write, so the slot behaves like one more scalar register. It is accepted unless the write lies in a non-uniform region that the read is outside. That case is a loop or arm the wave can run again after this pixel has left it.
  • Several reaching writes (a join of values). Which write supplies the value depends on the path. The read is accepted only if no reaching write lies in any non-uniform region; then every pixel takes the wave's path through the writes. The reload keeps a constant only if every write stored the same constant, and it is not marked uniform, the same way the SGPR join code drops registers written on a forward arm.
  • Rules that carry over unchanged. The constant lane 0..31, no other use of the VGPR, a plain-SGPR destination, the pixel-stage-only restriction, and the lane-mask, m0 and descriptor checks on the stored value all apply as before. The descriptor check on the stored value uses sym, which handles joins. The lane-mask check (masks) still follows program order, not the joins (not changed here).
  • Lane spelling. Lanes are keyed by value, so 3 and 0x3 are one slot.

Each shape that is not proven keeps its own refusal:

  • v_readlane_b32 reads vN lane k with no v_writelane_b32 of it on some path. This covers another lane written on another path.
  • ... written later in a loop (loop-carried).
  • ... outside the region of the branch at <off> that writes it, which is not proven uniform.
  • v_readlane_b32 joins <n> writes of vN lane k, one inside the region of the branch at <off>, which is not proven uniform.
  • ... from a v_writelane_b32 that was not translated.
  • A stage with branches and no block graph (a unit probe that skips translate()) keeps the original straight-line refusal.

Measured

On a local set of 79 vertex/pixel requests, the first refusal was this one under a development translator. That translator has changes that are not merged.

count
Reach this refusal first on main (base) 32
Stop earlier on main: v_fma_mix_f32 39
Stop earlier on main: numeric use of a joined symbol 8
Pass this refusal with the change 32 of 32
Next refusal of those 32: source sN holds a lane mask or descriptor (all 30: a descriptor is spilled) 30
Next refusal of those 32: spill VGPR also used as a vector 2
Translate end to end after the change 0 of 79

Shape of the 79 pixel programs (a decode-only count, separate from the translator):

  • All but one are acyclic. They contain dozens to over a hundred s_cbranch_execz, a few SCC branches and in some cases one vccz.

  • One program has lane operations inside a loop.

  • Of 5994 spill reads:

    • 5616 have their reaching writes and the read inside a common non-uniform region.
    • 208 are outside every such region.
    • 106 have the write outside and the read inside.
    • 64 (in 12 programs) join two writes of the same SGPR, one inside an execz region, after the join.

    This count assumed every SCC branch is uniform; it is not what the translator refused. In census mode the translator reports the joined-write refusal in 4 programs (4 reads). Most other reads in these programs stop at a refused write first.

  • None of the 79 vertex programs contains v_writelane_b32 or v_readlane_b32.

  • In census mode (every instruction, approximate after the first refusal), these programs also show:

    • a descriptor or lane mask as the stored value, in 45 programs, and reads of those refused writes;
    • lanes 32 and up (wave64), in 44 programs;
    • vcc_lo/vcc_hi as the stored value;
    • non-SGPR read destinations;
    • spill VGPRs also used as vectors.

    All are existing refusals, unchanged here.

Tests

Head: 5c84039f. Windows 11, Python 3 from out/pe-env.

python -B tests/startup_gfx2hlsl_spill_branches_check.py

PASS. The check covers:

  • 6 accepted shapes, each with its exact emitted lines: two arms of a uniform branch with different and with equal constants; a write before a non-uniform branch read inside its region and after the join; a write and read inside one non-uniform region; a uniform loop; 3 and 0x3 as one slot.
  • 7 refusals, each with its exact reason.
  • The straight-line refusal for a stage without a block graph.
  • One whole pixel stage generated through Pipeline.hlsl_ps(): the slot is declared once and assigned on both arms of a uniform branch before the read after the join.
  • 6 translator mutations, each turning at least one control red: union instead of intersection at joins, one pass instead of the fixed point, lanes keyed by their spelling, no single-write region rule, no joined-write region rule, every branch counted as uniform.
for t in tests/startup_translator_check.py tests/startup_gfx2hlsl_*_check.py tests/docs_links_check.py tests/bidi_controls_check.py; do
  python -B "$t" || echo "FAIL $t"
done

All passed: 70 passed, 0 failed (translator check, 67 gfx2hlsl checks, docs links, bidi controls). This includes the unchanged startup_gfx2hlsl_sgpr_spill_check.py.

git diff --check against the base is clean; all files are LF.

Not done / hypothesis

  • No CMake build, ctest, GPU draw or title run. Translation only: the new shapes have no WARP or hardware readback yet.
  • How exactly the translator emits the per-pixel model of execz/vccz is taken from the existing code. The soundness argument assumes that model: a pixel skips a block only through a branch, and SALU and lane writes on its path run regardless of its EXEC bit.
  • The lane-mask test on the stored value still follows program order across joins. Checked in the code: the join handling in translate() does not update masks.
  • A backward branch's region is its textual block range, so a loop block laid out after the back branch is outside it.
  • The uniform flag of a single write is carried to reads past joins on the pixel-path/wave-path argument alone.
  • The stored value is only as right as the existing per-pixel SGPR model and scc_uniform.
  • The generated HLSL was not compiled.
  • Vertex stages stay refused (pixel stages only).

Merge of current main at dc94afac: one conflict in tools/startup/gfx2hlsl.py (both sides' lines kept). Re-run at that head: the new check, startup_translator_check.py and every no-argument startup_gfx2hlsl_*_check.py, all exit 0.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6612408230 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2524). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T19:47:35Z. --- Refs #2125 ## What changes `tools/startup/gfx2hlsl.py` lowers the constant-lane SGPR spill pair `v_writelane_b32 vN, sM, k` / `v_readlane_b32 sD, vN, k` to one scalar per (VGPR, lane) (item E). Until now a pixel stage with any branch was refused with `v_writelane_b32 needs straight-line code to prove write-before-read`. This PR replaces that requirement with a proof that works with control flow. - `spill_reaching` runs a forward must-dataflow over the basic blocks `joined_registers` already builds. A slot counts as written at a join only if it is written on every incoming edge (intersection). The writes that can supply it are the union over those edges, iterated to a fixed point so that a later write in a loop body reaches the loop head through the back edge. - `joined_registers(with_cfg=True)` also returns the block graph and, for each `s_cbranch_*`, the blocks of the region it already computed (from the branch to its immediate post-dominator, or the loop range for a backward branch). - During the pass, the translator records the conditional branches it proves uniform (an SCC branch with `scc_uniform`; `execz`/`vccz` and the `nz` forms never are). ## Soundness argument The slot variable is assigned on the pixel's own path. The hardware lane holds the last write on the wave's path: both instructions ignore EXEC, so a write runs whenever the wave runs it. The pixel's path and the wave's path agree except inside the region of a branch that is not proven uniform. There the wave also runs blocks this pixel skips, or, for `vccnz`/`execnz`, skips blocks this pixel runs. - **One reaching write.** Every path into the read ran that write, so the slot behaves like one more scalar register. It is accepted unless the write lies in a non-uniform region that the read is outside. That case is a loop or arm the wave can run again after this pixel has left it. - **Several reaching writes (a join of values).** Which write supplies the value depends on the path. The read is accepted only if no reaching write lies in any non-uniform region; then every pixel takes the wave's path through the writes. The reload keeps a constant only if every write stored the same constant, and it is not marked uniform, the same way the SGPR join code drops registers written on a forward arm. - **Rules that carry over unchanged.** The constant lane 0..31, no other use of the VGPR, a plain-SGPR destination, the pixel-stage-only restriction, and the lane-mask, `m0` and descriptor checks on the stored value all apply as before. The descriptor check on the stored value uses `sym`, which handles joins. The lane-mask check (`masks`) still follows program order, not the joins (not changed here). - **Lane spelling.** Lanes are keyed by value, so `3` and `0x3` are one slot. Each shape that is not proven keeps its own refusal: - `v_readlane_b32 reads vN lane k with no v_writelane_b32 of it on some path`. This covers another lane written on another path. - `... written later in a loop (loop-carried)`. - `... outside the region of the branch at <off> that writes it, which is not proven uniform`. - `v_readlane_b32 joins <n> writes of vN lane k, one inside the region of the branch at <off>, which is not proven uniform`. - `... from a v_writelane_b32 that was not translated`. - A stage with branches and no block graph (a unit probe that skips `translate()`) keeps the original straight-line refusal. ## Measured On a local set of 79 vertex/pixel requests, the first refusal was this one under a development translator. That translator has changes that are not merged. | | count | |---|---:| | Reach this refusal first on main (base) | 32 | | Stop earlier on main: `v_fma_mix_f32` | 39 | | Stop earlier on main: numeric use of a joined symbol | 8 | | Pass this refusal with the change | 32 of 32 | | Next refusal of those 32: `source sN holds a lane mask or descriptor` (all 30: a descriptor is spilled) | 30 | | Next refusal of those 32: spill VGPR also used as a vector | 2 | | Translate end to end after the change | 0 of 79 | Shape of the 79 pixel programs (a decode-only count, separate from the translator): - All but one are acyclic. They contain dozens to over a hundred `s_cbranch_execz`, a few SCC branches and in some cases one `vccz`. - One program has lane operations inside a loop. - Of 5994 spill reads: - 5616 have their reaching writes and the read inside a common non-uniform region. - 208 are outside every such region. - 106 have the write outside and the read inside. - 64 (in 12 programs) join two writes of the same SGPR, one inside an `execz` region, after the join. This count assumed every SCC branch is uniform; it is not what the translator refused. In census mode the translator reports the joined-write refusal in 4 programs (4 reads). Most other reads in these programs stop at a refused write first. - None of the 79 vertex programs contains `v_writelane_b32` or `v_readlane_b32`. - In census mode (every instruction, approximate after the first refusal), these programs also show: - a descriptor or lane mask as the stored value, in 45 programs, and reads of those refused writes; - lanes 32 and up (wave64), in 44 programs; - `vcc_lo`/`vcc_hi` as the stored value; - non-SGPR read destinations; - spill VGPRs also used as vectors. All are existing refusals, unchanged here. ## Tests Head: `5c84039f`. Windows 11, Python 3 from `out/pe-env`. ``` python -B tests/startup_gfx2hlsl_spill_branches_check.py ``` PASS. The check covers: - 6 accepted shapes, each with its exact emitted lines: two arms of a uniform branch with different and with equal constants; a write before a non-uniform branch read inside its region and after the join; a write and read inside one non-uniform region; a uniform loop; `3` and `0x3` as one slot. - 7 refusals, each with its exact reason. - The straight-line refusal for a stage without a block graph. - One whole pixel stage generated through `Pipeline.hlsl_ps()`: the slot is declared once and assigned on both arms of a uniform branch before the read after the join. - 6 translator mutations, each turning at least one control red: union instead of intersection at joins, one pass instead of the fixed point, lanes keyed by their spelling, no single-write region rule, no joined-write region rule, every branch counted as uniform. ``` for t in tests/startup_translator_check.py tests/startup_gfx2hlsl_*_check.py tests/docs_links_check.py tests/bidi_controls_check.py; do python -B "$t" || echo "FAIL $t" done ``` All passed: 70 passed, 0 failed (translator check, 67 gfx2hlsl checks, docs links, bidi controls). This includes the unchanged `startup_gfx2hlsl_sgpr_spill_check.py`. `git diff --check` against the base is clean; all files are LF. ## Not done / hypothesis - No CMake build, ctest, GPU draw or title run. Translation only: the new shapes have no WARP or hardware readback yet. - How exactly the translator emits the per-pixel model of `execz`/`vccz` is taken from the existing code. The soundness argument assumes that model: a pixel skips a block only through a branch, and SALU and lane writes on its path run regardless of its EXEC bit. - The lane-mask test on the stored value still follows program order across joins. Checked in the code: the join handling in `translate()` does not update `masks`. - A backward branch's region is its textual block range, so a loop block laid out after the back branch is outside it. - The `uniform` flag of a single write is carried to reads past joins on the pixel-path/wave-path argument alone. - The stored value is only as right as the existing per-pixel SGPR model and `scc_uniform`. - The generated HLSL was not compiled. - Vertex stages stay refused (pixel stages only). Merge of current main at `dc94afac`: one conflict in `tools/startup/gfx2hlsl.py` (both sides' lines kept). Re-run at that head: the new check, `startup_translator_check.py` and every no-argument `startup_gfx2hlsl_*_check.py`, all exit 0. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tedin7 commented 2026-11-25 20:04:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:01:26Z.

Review: COMMENTED


Review of head dc94afac (comment only, not merging).

What is good:

  • The must-dataflow (intersection of written slots at joins, union of reaching writes, fixed point for loops) is clearly explained, and the new fixture check covers refusals, a whole pixel stage and 6 translator mutations.
  • Wiring is complete: CMake test, .github/workflows/windows.yml Python-check list, AGENTS.md and docs/experiments.md are all updated. No other open or merged PR covers this slice (searched writelane / spill / branches).

What is missing (why I do not merge):

  • This changes how a shader lowering behaves around control flow, but there is no D3D12 WARP readback against a CPU reference. The PR body says so ("No CMake build, ctest, GPU draw ... The generated HLSL was not compiled."). A string/translation check alone does not prove the per-pixel model of execz/vccz and non-uniform regions that the soundness argument relies on. Please add a dispatch/draw test, with warp and hardware variants next to startup_gfx2hlsl_sgpr_spill_*, that runs at least: a uniform branch with writes on both arms, a non-uniform branch where one pixel skips the write, and a loop with a write in the body. Compare every pixel with an integer reference.
  • .github/workflows/windows.yml is touched (one line in the Python-check list). The PR's own CI run should show the new check executing; please confirm it in the job log.
  • The "Not done" list admits several assumptions are taken from existing code (the execz/vccz per-pixel model, uniform carried past joins). Those are exactly what a readback would verify.

Commands run (Linux, exact head):

  • python3 -B tests/startup_gfx2hlsl_spill_branches_check.py: PASS
  • python3 -B tests/startup_gfx2hlsl_sgpr_spill_check.py: PASS
  • python3 -B tests/startup_translator_check.py: 0 failed
  • python3 tests/docs_links_check.py and python3 tests/bidi_controls_check.py: ok
  • git diff --check origin/main...HEAD: clean
  • Mutation: join intersection changed to union in spill_reaching (gfx2hlsl.py:4515): the new check goes red (KeyError), restored afterwards.

No Win2025 run done, since the readback test does not exist yet. The merge stays with MasterDomino or @R0Y00 once a readback is added.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6064143182 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2524#pullrequestreview-6064143182). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T20:01:26Z. **Review:** COMMENTED --- Review of head dc94afac (comment only, not merging). What is good: - The must-dataflow (intersection of written slots at joins, union of reaching writes, fixed point for loops) is clearly explained, and the new fixture check covers refusals, a whole pixel stage and 6 translator mutations. - Wiring is complete: CMake test, `.github/workflows/windows.yml` Python-check list, AGENTS.md and docs/experiments.md are all updated. No other open or merged PR covers this slice (searched writelane / spill / branches). What is missing (why I do not merge): - This changes how a shader lowering behaves around control flow, but there is no D3D12 WARP readback against a CPU reference. The PR body says so ("No CMake build, ctest, GPU draw ... The generated HLSL was not compiled."). A string/translation check alone does not prove the per-pixel model of `execz`/`vccz` and non-uniform regions that the soundness argument relies on. Please add a dispatch/draw test, with warp and hardware variants next to `startup_gfx2hlsl_sgpr_spill_*`, that runs at least: a uniform branch with writes on both arms, a non-uniform branch where one pixel skips the write, and a loop with a write in the body. Compare every pixel with an integer reference. - `.github/workflows/windows.yml` is touched (one line in the Python-check list). The PR's own CI run should show the new check executing; please confirm it in the job log. - The "Not done" list admits several assumptions are taken from existing code (the `execz`/`vccz` per-pixel model, `uniform` carried past joins). Those are exactly what a readback would verify. Commands run (Linux, exact head): - `python3 -B tests/startup_gfx2hlsl_spill_branches_check.py`: PASS - `python3 -B tests/startup_gfx2hlsl_sgpr_spill_check.py`: PASS - `python3 -B tests/startup_translator_check.py`: 0 failed - `python3 tests/docs_links_check.py` and `python3 tests/bidi_controls_check.py`: ok - `git diff --check origin/main...HEAD`: clean - Mutation: join intersection changed to union in `spill_reaching` (gfx2hlsl.py:4515): the new check goes red (KeyError), restored afterwards. No Win2025 run done, since the readback test does not exist yet. The merge stays with MasterDomino or @R0Y00 once a readback is added. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-25 21:01:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T20:10:11Z.


Please keep the dataflow controls and add a source-built pixel readback before merge. Use two uniform branch choices that write distinguishable values to the same slot, then reload and export the selected bits after the join. Both choices should render on WARP and on a physical GPU. A deliberately wrong opposite-arm reference must differ. Keep the existing missing-write and divergent/unproved region refusals, so a green draw cannot mask a provenance error.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7173283304 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2524#issuecomment-7173283304). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T20:10:11Z. --- Please keep the dataflow controls and add a source-built pixel readback before merge. Use two uniform branch choices that write distinguishable values to the same slot, then reload and export the selected bits after the join. Both choices should render on WARP and on a physical GPU. A deliberately wrong opposite-arm reference must differ. Keep the existing missing-write and divergent/unproved region refusals, so a green draw cannot mask a provenance error.
tedin7 commented 2026-11-25 23:01:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T22:56:59Z.

Review: COMMENTED


Review of head e9e2b543 (merge of main on top of the reviewed change; the PR's own diff is unchanged since dc94afac).

Not ready to merge: the pixel readback that @R0Y00 asked for on 2026-11-25 is still missing.

What is missing

  • The PR body says "Translation only; no draw was run", and the only new test is tests/startup_gfx2hlsl_spill_branches_check.py (text and refusal controls through Stage.translate()). The CMake entry startup_gfx2hlsl_spill_branches runs that Python file only; there is no offscreen_check draw next to it, unlike the sibling startup_gfx2hlsl_sgpr_spill_${adapter} tests in CMakeLists.txt.
  • Requested: two uniform branch choices that write distinguishable values to the same slot, reload and export the selected bits after the join, on WARP and on a physical GPU, plus a deliberately wrong opposite-arm reference that must differ. Keep the existing dataflow controls and refusals.
  • Suggested place: extend tests/startup_gfx2hlsl_sgpr_spill_check.py (same draw harness, same packed-position OR pattern) or add startup_gfx2hlsl_spill_branches_${adapter} draws with SKIP_RETURN_CODE 77, and wire them in windows.yml/AGENTS.md like the existing entries.

What I checked (all Linux, in a clean worktree of the exact head)

  • python3 -B tests/startup_gfx2hlsl_spill_branches_check.py: PASS; the six translator mutations (union at joins, one pass instead of fixed point, lane keyed by spelling, each region rule removed, all branches uniform) each turn at least one control red.
  • python3 tests/docs_links_check.py: 19 files, 499 links OK.
  • python3 tests/bidi_controls_check.py: OK.
  • git diff --check origin/main...HEAD: clean.
  • The change to .github/workflows/windows.yml is one added test path in an existing list; the PR's own CI run needs to exercise it.
  • Not run: Win2025 (no readback exists yet to run). CI was still pending when I looked.

Once the draw test exists I can run it on Win2025 dev+release and re-check for merge.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6066122950 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2524#pullrequestreview-6066122950). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T22:56:59Z. **Review:** COMMENTED --- Review of head e9e2b543 (merge of main on top of the reviewed change; the PR's own diff is unchanged since dc94afac). **Not ready to merge: the pixel readback that @R0Y00 asked for on 2026-11-25 is still missing.** What is missing - The PR body says "Translation only; no draw was run", and the only new test is `tests/startup_gfx2hlsl_spill_branches_check.py` (text and refusal controls through `Stage.translate()`). The CMake entry `startup_gfx2hlsl_spill_branches` runs that Python file only; there is no `offscreen_check` draw next to it, unlike the sibling `startup_gfx2hlsl_sgpr_spill_${adapter}` tests in `CMakeLists.txt`. - Requested: two uniform branch choices that write distinguishable values to the same slot, reload and export the selected bits after the join, on WARP and on a physical GPU, plus a deliberately wrong opposite-arm reference that must differ. Keep the existing dataflow controls and refusals. - Suggested place: extend `tests/startup_gfx2hlsl_sgpr_spill_check.py` (same draw harness, same packed-position OR pattern) or add `startup_gfx2hlsl_spill_branches_${adapter}` draws with `SKIP_RETURN_CODE 77`, and wire them in `windows.yml`/`AGENTS.md` like the existing entries. What I checked (all Linux, in a clean worktree of the exact head) - `python3 -B tests/startup_gfx2hlsl_spill_branches_check.py`: PASS; the six translator mutations (union at joins, one pass instead of fixed point, lane keyed by spelling, each region rule removed, all branches uniform) each turn at least one control red. - `python3 tests/docs_links_check.py`: 19 files, 499 links OK. - `python3 tests/bidi_controls_check.py`: OK. - `git diff --check origin/main...HEAD`: clean. - The change to `.github/workflows/windows.yml` is one added test path in an existing list; the PR's own CI run needs to exercise it. - Not run: Win2025 (no readback exists yet to run). CI was still pending when I looked. Once the draw test exists I can run it on Win2025 dev+release and re-check for merge. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 03:02:57 +00:00
tedin7 commented 2026-11-26 03:03:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:13:39Z.


Added the pixel readback asked for above, on top of a merge of main (no rebase).

What changed (tests/startup_gfx2hlsl_spill_branches_check.py, CMakeLists.txt, docs/experiments.md):

  • New draw mode: two uniform SCC choices write different binary32 words to the same slot (v10 lane 3), the join reloads it and exports it OR-ed with the packed screen position. All 16x16 pixels must equal the selected arm, with FXC 5_1 and DXC 6_0.
  • Negative control: each choice drawn against the opposite arm's reference must mismatch.
  • New binary mode checks the fixture words against llvm-mc. The existing dataflow controls, refusals and the 6 translator mutations are unchanged.
  • CTest: startup_gfx2hlsl_spill_branches_warp and _hardware.

Verification (Win2025, dev and release, patch applied on the previous head):

  • x2w_pipe.py win2025 2524 --patch <diff> --regex 'startup_gfx2hlsl_spill_branches|startup_gfx2hlsl_sgpr_spill' --wait 7200
  • 6/6 passed in both passes: startup_gfx2hlsl_spill_branches, _warp, _hardware, and startup_gfx2hlsl_sgpr_spill_controls/_warp/_hardware.
  • Linux: the check with no arguments (PASS), binary with llvm-mc (PASS), tests/docs_links_check.py, tests/bidi_controls_check.py, git diff --check.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7180587327 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2524#issuecomment-7180587327). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T02:13:39Z. --- Added the pixel readback asked for above, on top of a merge of main (no rebase). What changed (`tests/startup_gfx2hlsl_spill_branches_check.py`, `CMakeLists.txt`, `docs/experiments.md`): - New `draw` mode: two uniform SCC choices write different binary32 words to the same slot (`v10` lane 3), the join reloads it and exports it OR-ed with the packed screen position. All 16x16 pixels must equal the selected arm, with FXC 5_1 and DXC 6_0. - Negative control: each choice drawn against the opposite arm's reference must mismatch. - New `binary` mode checks the fixture words against llvm-mc. The existing dataflow controls, refusals and the 6 translator mutations are unchanged. - CTest: `startup_gfx2hlsl_spill_branches_warp` and `_hardware`. Verification (Win2025, dev and release, patch applied on the previous head): - `x2w_pipe.py win2025 2524 --patch <diff> --regex 'startup_gfx2hlsl_spill_branches|startup_gfx2hlsl_sgpr_spill' --wait 7200` - 6/6 passed in both passes: `startup_gfx2hlsl_spill_branches`, `_warp`, `_hardware`, and `startup_gfx2hlsl_sgpr_spill_controls`/`_warp`/`_hardware`. - Linux: the check with no arguments (PASS), `binary` with llvm-mc (PASS), `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `git diff --check`. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 03:03:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:26:47Z.


Merged origin/main into this branch (no rebase, no force-push). The only conflict was two neighbouring attribute lines in tools/startup/gfx2hlsl.py; both sides kept. CMake and doc lists merged cleanly. The change itself is untouched, so the earlier Win2025 PASS still applies.

Commands executed locally:

  • git merge origin/main (twice, main moved once during the work)
  • python3 -m py_compile tools/startup/gfx2hlsl.py
  • python3 -B tests/startup_gfx2hlsl_spill_branches_check.py -> PASS

Auto-merge (squash) is re-enabled.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7180811301 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2524#issuecomment-7180811301). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T02:26:47Z. --- Merged `origin/main` into this branch (no rebase, no force-push). The only conflict was two neighbouring attribute lines in `tools/startup/gfx2hlsl.py`; both sides kept. CMake and doc lists merged cleanly. The change itself is untouched, so the earlier Win2025 PASS still applies. Commands executed locally: - `git merge origin/main` (twice, main moved once during the work) - `python3 -m py_compile tools/startup/gfx2hlsl.py` - `python3 -B tests/startup_gfx2hlsl_spill_branches_check.py` -> PASS Auto-merge (squash) is re-enabled. 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!2516
No description provided.