[TEST-W64G-TIER-C-INVARIANTS] Check known graphics outputs before skipping or saving a reference #1191

Open
github-bot wants to merge 1 commit from github-bot/gh-1191 into main AGit
Owner

@⁠titoreinaldo on GitHub · 2026-11-24 19:56 UTC · original
titoreinaldo:contrib/w64-invariant-checks → main · +55 −14 · 2 files · 1 commits · open

Claimed in the coordination issue as: TEST-W64G-TIER-C-INVARIANTS (claim in #14)

Depends on: #1060 (overlap in the runner and reference tests). This branch is based directly on 6293c1c4. #1060 selects the draw to compare with a saved reference. This change checks the known output values of each draw.

What and why

The hand-written Tier C fixtures define some output words for every subgroup width. For example, the third word of ps_w64_c_lane_id must be the pixel’s x coordinate. The runner could accept a draw and reference that agreed on a wrong coordinate. It could also skip a bad single-width draw or save it as a new reference.

Check the fixture-defined words before the reference comparison, skip, or export. Words marked None may still vary by subgroup width. CPU replay covers a matching bad reference, a wrong default draw, single-width results and preservation of an existing good reference.

Tested

On Windows 11 Pro 26H2 build 26300.9974, I rebuilt vk_harness and translated the 29 graphics fixtures and two support shaders. All 31 passed spirv-val (LLVM 23.1.6, SPIRV-Tools 2026.4). I selected each physical adapter separately and confirmed its name in the harness output.

GPU and driver 29 unmodified cases, before and after Wrong x in a 64×64 draw
NVIDIA GeForce RTX 3070 eGPU, 610.88 (32 lanes) 17 passed, 0 failed, 12 skipped 4,032/4,096 wrong, detected
Intel Arc Graphics, 101.8132 (8–32 lanes) 5 passed, 0 failed, 24 skipped 4,032/4,096 wrong, detected

In a scratch copy of ps_w64_c_lane_id.asm, I changed the third exported word from v2 (x) to v8 (zero). On both adapters the original runner skipped it without a reference and returned ok with a reference containing the same wrong x. This patch exits 1 in both cases. The unmodified shader had all 4,096 x values correct. I constructed the cross-width reference from the four readback words per pixel, adding 32 to the lane ID for pixels with x >= 32. Neither adapter runs native wave64.

  • python -I tests/test_w64_graphics_reference.py -v — 6 passed. The added checks reproduce the bug on the base commit.
  • Focused pytest run over the reference, arguments, probe, fixture and wave64 tests — 169 passed, 34 subtests passed.
  • python -I scripts/run_semantic_tests.py -j 8 tests/semantic — 6,168 tests across 470 files, zero failed files (753 seconds).
  • python -I scripts/check_no_game_data.py runtime/test/shaders/w64_graphics.py tests/test_w64_graphics_reference.py and git diff --check passed.
Hardware commands (PowerShell)

$work is a scratch fixture directory. $build contains the locally built vk_harness.exe.

$names = python -I -c "import runpy; f=runpy.run_path('runtime/test/shaders/w64_graphics.py')['FIXTURES']; print(*sorted(set(f) | {'vs_ids','ps_live_width'}), sep=chr(10))"
$env:LEONIDA_W64_EMULATE = '0'
python -I runtime/test/shaders/build.py $work @names
$env:VK_LOADER_DRIVERS_SELECT = 'nv*'
$env:LEONIDA_VK_DEVICE = 'NVIDIA GeForce RTX 3070'
python -I runtime/test/shaders/w64_graphics.py $work $build
$env:VK_LOADER_DRIVERS_SELECT = '*igvk*'
$env:LEONIDA_VK_DEVICE = 'Intel(R) Arc(TM) Graphics'
python -I runtime/test/shaders/w64_graphics.py $work $build

For the negative control, rebuild the scratch shader, run the checker with ps_w64_c_lane_id as its last argument, and repeat with W64G_REF pointing to the constructed reference.

GPUs tested: NVIDIA GeForce RTX 3070 eGPU and Intel Arc Graphics, as listed above.

AI-assisted: yes, OpenAI Codex.

Checklist

  • Based on upstream main and merges cleanly with the tested base.
  • One change to the test runner with regression coverage.
  • Only independently written source and synthetic inputs.
  • Translator rule documentation: N/A, the translator is unchanged.
**@⁠titoreinaldo** on GitHub · 2026-11-24 19:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1191) `titoreinaldo:contrib/w64-invariant-checks` → `main` · +55 −14 · 2 files · 1 commits · open Claimed in the coordination issue as: TEST-W64G-TIER-C-INVARIANTS ([claim in #14](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) Depends on: #1060 (overlap in the runner and reference tests). This branch is based directly on `6293c1c4`. #1060 selects the draw to compare with a saved reference. This change checks the known output values of each draw. ### What and why The hand-written Tier C fixtures define some output words for every subgroup width. For example, the third word of `ps_w64_c_lane_id` must be the pixel’s x coordinate. The runner could accept a draw and reference that agreed on a wrong coordinate. It could also skip a bad single-width draw or save it as a new reference. Check the fixture-defined words before the reference comparison, skip, or export. Words marked `None` may still vary by subgroup width. CPU replay covers a matching bad reference, a wrong default draw, single-width results and preservation of an existing good reference. ### Tested On Windows 11 Pro 26H2 build 26300.9974, I rebuilt `vk_harness` and translated the 29 graphics fixtures and two support shaders. All 31 passed `spirv-val` (LLVM 23.1.6, SPIRV-Tools 2026.4). I selected each physical adapter separately and confirmed its name in the harness output. | GPU and driver | 29 unmodified cases, before and after | Wrong x in a 64×64 draw | | --- | --- | --- | | NVIDIA GeForce RTX 3070 eGPU, 610.88 (32 lanes) | 17 passed, 0 failed, 12 skipped | 4,032/4,096 wrong, detected | | Intel Arc Graphics, 101.8132 (8–32 lanes) | 5 passed, 0 failed, 24 skipped | 4,032/4,096 wrong, detected | In a scratch copy of `ps_w64_c_lane_id.asm`, I changed the third exported word from `v2` (x) to `v8` (zero). On both adapters the original runner skipped it without a reference and returned `ok` with a reference containing the same wrong x. This patch exits 1 in both cases. The unmodified shader had all 4,096 x values correct. I constructed the cross-width reference from the four readback words per pixel, adding 32 to the lane ID for pixels with `x >= 32`. Neither adapter runs native wave64. - `python -I tests/test_w64_graphics_reference.py -v` — 6 passed. The added checks reproduce the bug on the base commit. - Focused pytest run over the reference, arguments, probe, fixture and wave64 tests — 169 passed, 34 subtests passed. - `python -I scripts/run_semantic_tests.py -j 8 tests/semantic` — 6,168 tests across 470 files, zero failed files (753 seconds). - `python -I scripts/check_no_game_data.py runtime/test/shaders/w64_graphics.py tests/test_w64_graphics_reference.py` and `git diff --check` passed. <details><summary>Hardware commands (PowerShell)</summary> `$work` is a scratch fixture directory. `$build` contains the locally built `vk_harness.exe`. ```powershell $names = python -I -c "import runpy; f=runpy.run_path('runtime/test/shaders/w64_graphics.py')['FIXTURES']; print(*sorted(set(f) | {'vs_ids','ps_live_width'}), sep=chr(10))" $env:LEONIDA_W64_EMULATE = '0' python -I runtime/test/shaders/build.py $work @names $env:VK_LOADER_DRIVERS_SELECT = 'nv*' $env:LEONIDA_VK_DEVICE = 'NVIDIA GeForce RTX 3070' python -I runtime/test/shaders/w64_graphics.py $work $build $env:VK_LOADER_DRIVERS_SELECT = '*igvk*' $env:LEONIDA_VK_DEVICE = 'Intel(R) Arc(TM) Graphics' python -I runtime/test/shaders/w64_graphics.py $work $build ``` For the negative control, rebuild the scratch shader, run the checker with `ps_w64_c_lane_id` as its last argument, and repeat with `W64G_REF` pointing to the constructed reference. </details> GPUs tested: NVIDIA GeForce RTX 3070 eGPU and Intel Arc Graphics, as listed above. AI-assisted: yes, OpenAI Codex. ### Checklist - [x] Based on upstream `main` and merges cleanly with the tested base. - [x] One change to the test runner with regression coverage. - [x] Only independently written source and synthetic inputs. - Translator rule documentation: N/A, the translator is unchanged.
Check partition-invariant words against the fixture expectation even when both widths or the saved reference share the same wrong value. Reject an invalid single-width draw before it can replace a reference.

Reproduced with synthetic fragment readbacks on Windows on an RTX 3070 and Intel Arc Graphics. Codex-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:42:09 +00:00
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:08 UTC · original

Recommendation: [MERGE]

Reasoning: The w64 graphics runner checks the known per-draw output words (e.g. the lane-id x coordinate) of the Tier C fixtures before skipping or saving a reference, so a wrong draw can no longer match a wrong reference. Small test-harness change with tests. It overlaps #1060 in the runner, so the second to land may need a rebase. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 3/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1191#issuecomment-7143099780) **Recommendation:** [MERGE] **Reasoning:** The w64 graphics runner checks the known per-draw output words (e.g. the lane-id x coordinate) of the Tier C fixtures before skipping or saving a reference, so a wrong draw can no longer match a wrong reference. Small test-harness change with tests. It overlaps #1060 in the runner, so the second to land may need a rebase. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 3/10
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1191/head:github-bot/gh-1191'
git switch 'github-bot/gh-1191'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1191'
git switch 'github-bot/gh-1191'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1191'
git switch 'github-bot/gh-1191'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1191'
git switch 'main'
git merge --squash 'github-bot/gh-1191'
git switch 'main'
git merge --ff-only 'github-bot/gh-1191'
git switch 'main'
git merge 'github-bot/gh-1191'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.