tests: add refusal and mutation tests for gfx1013_vertex_id #3691

Manually merged
github merged 1 commit from github-bot/gh-3689 into gh-pr/3689/base 2026-12-01 03:13:36 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-12-01 01:50 UTC · original
Ammmae0x:tests/gfx1013-vertex-id → main · +2382 −0 · 5 files · 1 commits · merged 2026-12-01 03:12 UTC

Refs #1149

Direct, portable C++17 tests for x2w::translate_gfx1013_vertex_id and x2w::translate_gfx1013_buffered_vertex (src/gfx1013_vertex_id.cpp), with zero edits to existing files (5 new files only, +2382/-0). No GPU, no device, no dxc.exe and no Windows header is needed: the check links only tests/gfx1013_vertex_id_check.cpp + src/gfx1013_vertex_id.cpp.

What landed — commit 008bd7f0, 54 cases in tests/gfx1013_vertex_id_check.cpp (no-arg + <case> / --case <case>, loud FAIL: <case>: ... to stderr):

  • 11 valid unbuffered programs: inline ints 128..192, negative ints 193..208 (192u - sel, two's-complement patterns), float constants 240..247, literal 255, v_mov / v_cvt_f32_i32 / v_lshlrev / v_and / d54b FMA without modifiers, pos/param0 export masks with disabled lanes (reg=128) as 0.0, prefetch/priority skips, param1 absent.
  • 15 valid buffered programs: ud3 cbuffer, s_mov_b32/s_mov_b64, s_or_b32 vertex high (0x9380ff00 + 0x80000), s_load_dwordx4 on the vb_table and root tables 0/1 (table 1 at offset 32), s_load_dwordx16 (0xf4300000), 2- and 3-dword vertex tbuffer/buffer loads (0xe0342000/0xe03c2000), v_rsqrt_f32, d503 add modifiers, VOP2 (3, 4, 5, 8, 37, 43), param1 export (0xf8000210) with exact bindings (srv N buf vb 0 / table T OFF).
  • 28 refusals, each pinning the exact "<reason> at vertex byte <addr>" text: truncated instruction, undefined VGPR, unresolved scalar input, unsupported input selector (248 and 254), invalid buffer descriptor range, unexpected buffer descriptor, overwritten buffer descriptor, unsupported scalar load offset, scalar load register range, expected vertex stream zero, unresolved root table, unsupported vertex load operands, vertex load destination range, invalid scalar destination, unsupported scalar pair, unsupported scalar move, unsupported vertex address high word, unsupported add modifiers, unsupported FMA modifiers (buffered neg-mask 0x18000000 vs unbuffered 0xf8000000), duplicate vertex export, unexpected disabled export operand, incomplete exports or trailing instructions, unsupported vertex instruction, missing endpgm.

tests/cmake/gfx1013_vertex_id.cmake registers the check (C++17, no Windows library) with one CTest entry per case plus gfx1013_vertex_id_all, and 5 WILL_FAIL TRUE configure-time copy mutations of src/gfx1013_vertex_id.cpp, mirroring era_gpu_alias_open_base_control: drop overwritten buffer descriptor check, drop offset % 32 in unresolved root table, widen unbuffered FMA mask to 0x18000000, drop unexpected disabled export operand, drop trailing-instructions pc != code.size().

tests/gfx1013_vertex_id_meta_check.py + tests/checks/python-linux/gfx1013_vertex_id.txt audit the contract, the C++ check, the CMake fragment and the note; run a Python transliteration of the translator over all 54 cases; compile and run the real C++ check with g++ -std=c++17; compile each CMake mutation copy the same way and run its control case; and run a model mutation audit (7 mutations: the 5 CMake controls plus vertex-stream-zero and scalar-pair guards). docs/experiments/gfx1013-vertex-id.md documents the cases, controls and Windows run.

Linux verification (this host cannot run Windows CTest or MSVC, so Windows verification is pending):

  • tests/gfx1013_vertex_id_meta_check.py: PASS: gfx1013 vertex id: 54 cases, 5/5 real C++ mutations killed, 7/7 model mutations killed
  • tools/run_checks_parallel.py --from-dir tests/checks/python-linux: all 80 checks passed
  • tests/form_coverage_check.py: passed; tests/docs_links_check.py: Checked 198 Markdown files and 765 links; tests/bidi_controls_check.py: Checked 2793 tracked source, script and build/CI files: no bidirectional controls
  • py_compile passed, git diff --check clean, merge-tree exits 0, zero personal paths in the diff.

Caught in development: 0xc0800000 is 3229614080u, not 3238002688u; and the param1 export in the buffered case reads v1 after the vertex-load temporaries, so its first lane is r3, not r0.

Windows Verification (008bd7f010c08b5ce18673323d753adc6734327a)

Commit: 008bd7f010c08b5ce18673323d753adc6734327a (merge-tree upstream/main HEAD -> 26656fd2, exit 0)
dev: cmake --build --preset dev --target gfx1013_vertex_id_check ... && ctest --preset dev --no-tests=error -R '^gfx1013_vertex_id' --output-on-failure -> 60/60 passed (1.49s; 54 cases + all + 5/5 mutations killed)
release: cmake --build --preset release --target gfx1013_vertex_id_check ... && ctest --preset release --no-tests=error -R '^gfx1013_vertex_id' --output-on-failure -> 60/60 passed (1.27s; 54 cases + all + 5/5 mutations killed)
Direct binary (dev & release): PASS: gfx1013_vertex_id: 54/54 cases passed
Checks: form_coverage_check.py, docs_links_check.py (199 files, 770 links), bidi_controls_check.py (2796 files) -> passed

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-12-01 01:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3689) `Ammmae0x:tests/gfx1013-vertex-id` → `main` · +2382 −0 · 5 files · 1 commits · merged 2026-12-01 03:12 UTC Refs #1149 Direct, portable C++17 tests for `x2w::translate_gfx1013_vertex_id` and `x2w::translate_gfx1013_buffered_vertex` (`src/gfx1013_vertex_id.cpp`), with zero edits to existing files (5 new files only, +2382/-0). No GPU, no device, no dxc.exe and no Windows header is needed: the check links only `tests/gfx1013_vertex_id_check.cpp` + `src/gfx1013_vertex_id.cpp`. **What landed** — commit `008bd7f0`, 54 cases in `tests/gfx1013_vertex_id_check.cpp` (no-arg + `<case>` / `--case <case>`, loud `FAIL: <case>: ...` to stderr): - 11 valid unbuffered programs: inline ints 128..192, negative ints 193..208 (`192u - sel`, two's-complement patterns), float constants 240..247, literal `255`, `v_mov` / `v_cvt_f32_i32` / `v_lshlrev` / `v_and` / `d54b` FMA without modifiers, `pos`/`param0` export masks with disabled lanes (`reg=128`) as `0.0`, prefetch/priority skips, `param1` absent. - 15 valid buffered programs: `ud3` cbuffer, `s_mov_b32`/`s_mov_b64`, `s_or_b32` vertex high (`0x9380ff00` + `0x80000`), `s_load_dwordx4` on the `vb_table` and root tables 0/1 (table 1 at offset 32), `s_load_dwordx16` (`0xf4300000`), 2- and 3-dword vertex `tbuffer`/`buffer` loads (`0xe0342000`/`0xe03c2000`), `v_rsqrt_f32`, `d503` add modifiers, VOP2 (3, 4, 5, 8, 37, 43), `param1` export (`0xf8000210`) with exact `bindings` (`srv N buf vb 0` / `table T OFF`). - 28 refusals, each pinning the exact `"<reason> at vertex byte <addr>"` text: `truncated instruction`, `undefined VGPR`, `unresolved scalar input`, `unsupported input selector` (248 and 254), `invalid buffer descriptor range`, `unexpected buffer descriptor`, `overwritten buffer descriptor`, `unsupported scalar load offset`, `scalar load register range`, `expected vertex stream zero`, `unresolved root table`, `unsupported vertex load operands`, `vertex load destination range`, `invalid scalar destination`, `unsupported scalar pair`, `unsupported scalar move`, `unsupported vertex address high word`, `unsupported add modifiers`, `unsupported FMA modifiers` (buffered neg-mask `0x18000000` vs unbuffered `0xf8000000`), `duplicate vertex export`, `unexpected disabled export operand`, `incomplete exports or trailing instructions`, `unsupported vertex instruction`, `missing endpgm`. `tests/cmake/gfx1013_vertex_id.cmake` registers the check (C++17, no Windows library) with one CTest entry per case plus `gfx1013_vertex_id_all`, and 5 `WILL_FAIL TRUE` configure-time copy mutations of `src/gfx1013_vertex_id.cpp`, mirroring `era_gpu_alias_open_base_control`: drop `overwritten buffer descriptor` check, drop `offset % 32` in `unresolved root table`, widen unbuffered FMA mask to `0x18000000`, drop `unexpected disabled export operand`, drop trailing-instructions `pc != code.size()`. `tests/gfx1013_vertex_id_meta_check.py` + `tests/checks/python-linux/gfx1013_vertex_id.txt` audit the contract, the C++ check, the CMake fragment and the note; run a Python transliteration of the translator over all 54 cases; compile and run the real C++ check with `g++ -std=c++17`; compile each CMake mutation copy the same way and run its control case; and run a model mutation audit (7 mutations: the 5 CMake controls plus vertex-stream-zero and scalar-pair guards). `docs/experiments/gfx1013-vertex-id.md` documents the cases, controls and Windows run. **Linux verification** (this host cannot run Windows CTest or MSVC, so Windows verification is pending): - `tests/gfx1013_vertex_id_meta_check.py`: `PASS: gfx1013 vertex id: 54 cases, 5/5 real C++ mutations killed, 7/7 model mutations killed` - `tools/run_checks_parallel.py --from-dir tests/checks/python-linux`: `all 80 checks passed` - `tests/form_coverage_check.py`: passed; `tests/docs_links_check.py`: `Checked 198 Markdown files and 765 links`; `tests/bidi_controls_check.py`: `Checked 2793 tracked source, script and build/CI files: no bidirectional controls` - `py_compile` passed, `git diff --check` clean, merge-tree exits 0, zero personal paths in the diff. Caught in development: `0xc0800000` is `3229614080u`, not `3238002688u`; and the `param1` export in the buffered case reads `v1` after the vertex-load temporaries, so its first lane is `r3`, not `r0`. ### Windows Verification (`008bd7f010c08b5ce18673323d753adc6734327a`) ```text Commit: 008bd7f010c08b5ce18673323d753adc6734327a (merge-tree upstream/main HEAD -> 26656fd2, exit 0) dev: cmake --build --preset dev --target gfx1013_vertex_id_check ... && ctest --preset dev --no-tests=error -R '^gfx1013_vertex_id' --output-on-failure -> 60/60 passed (1.49s; 54 cases + all + 5/5 mutations killed) release: cmake --build --preset release --target gfx1013_vertex_id_check ... && ctest --preset release --no-tests=error -R '^gfx1013_vertex_id' --output-on-failure -> 60/60 passed (1.27s; 54 cases + all + 5/5 mutations killed) Direct binary (dev & release): PASS: gfx1013_vertex_id: 54/54 cases passed Checks: form_coverage_check.py, docs_links_check.py (199 files, 770 links), bidi_controls_check.py (2796 files) -> passed ``` AI-assisted. <!-- WIN-VERIFY: passed | sha=008bd7f010c08b5ce18673323d753adc6734327a | targets=gfx1013_vertex_id_check gfx1013_vertex_id_overwritten_buffer_descriptor_mut gfx1013_vertex_id_unresolved_root_table_mut gfx1013_vertex_id_fma_modifiers_mut gfx1013_vertex_id_disabled_export_mut gfx1013_vertex_id_trailing_instructions_mut | ctest=^gfx1013_vertex_id | release=true -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 01:55:38 +00:00
Author
Owner

@⁠lukaslw-lab on GitHub · 2026-12-01 02:59 UTC · original · approved these changes

Reviewed 008bd7f0 by reading the diff; not built or run.

Verdict: approve. The 54 cases cover both translators and every refusal message they throw, and the five C++ controls each drop a real guard. The SHOULD can follow later. No MUST.

  • SHOULD Two of the seven "killed" mutations (vertex_stream_zero, scalar_pair, tests/gfx1013_vertex_id_meta_check.py:380-385) only change the Python transliteration. Their anchors exist once in src/gfx1013_vertex_id.cpp (:113, :142-143), and the meta check already compiles the other five mutants with g++ (:922). Applying these two to the real source the same way, or as CMake controls, would make "7/7 killed" a claim about the C++. It would also catch drift between the 958-line model and the translators.
  • Checked, no finding:
    • All 25 distinct refusal messages in src/gfx1013_vertex_id.cpp are pinned by a case with the at vertex byte <addr> suffix.
    • The valid cases pin the exact HLSL and bindings for both the unbuffered and buffered paths, including the 193..208 two's-complement selectors, the vb_table / root-table loads (table 1 at offset 32) and the param1 export.
    • Each CMake anchor appears once and stops with FATAL_ERROR if it is lost. The FMA control narrows only the unbuffered mask, so the buffered path stays a positive case. The fixture writes no files, and no existing file changes.

Tests: the cases prove the accepted HLSL and bindings and each refusal substring. The *_mut controls prove the overwritten-descriptor, root-table alignment, FMA-modifier, disabled-export and trailing-instruction guards are each needed. CI at this head: Linux ran the meta check, which compiles and runs the real check and the five mutants with g++. The Windows pr filter (CMakePresets.json) runs none of the gfx1013_vertex_id* tests, so the MSVC evidence is the author's dev + release run (60/60).

**@⁠lukaslw-lab** on GitHub · 2026-12-01 02:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3689#pullrequestreview-6124373991) · **approved these changes** Reviewed `008bd7f0` by reading the diff; not built or run. **Verdict: approve.** The 54 cases cover both translators and every refusal message they throw, and the five C++ controls each drop a real guard. The SHOULD can follow later. No MUST. - **SHOULD** Two of the seven "killed" mutations (`vertex_stream_zero`, `scalar_pair`, `tests/gfx1013_vertex_id_meta_check.py:380-385`) only change the Python transliteration. Their anchors exist once in `src/gfx1013_vertex_id.cpp` (`:113`, `:142-143`), and the meta check already compiles the other five mutants with g++ (`:922`). Applying these two to the real source the same way, or as CMake controls, would make "7/7 killed" a claim about the C++. It would also catch drift between the 958-line model and the translators. - Checked, no finding: - All 25 distinct refusal messages in `src/gfx1013_vertex_id.cpp` are pinned by a case with the `at vertex byte <addr>` suffix. - The valid cases pin the exact HLSL and `bindings` for both the unbuffered and buffered paths, including the 193..208 two's-complement selectors, the `vb_table` / root-table loads (table 1 at offset 32) and the `param1` export. - Each CMake anchor appears once and stops with FATAL_ERROR if it is lost. The FMA control narrows only the unbuffered mask, so the buffered path stays a positive case. The fixture writes no files, and no existing file changes. Tests: the cases prove the accepted HLSL and bindings and each refusal substring. The `*_mut` controls prove the overwritten-descriptor, root-table alignment, FMA-modifier, disabled-export and trailing-instruction guards are each needed. CI at this head: Linux ran the meta check, which compiles and runs the real check and the five mutants with g++. The Windows `pr` filter (`CMakePresets.json`) runs none of the `gfx1013_vertex_id*` tests, so the MSVC evidence is the author's dev + release run (60/60).
github-bot changed target branch from main to gh-pr/3689/base 2026-12-01 03:13:35 +00:00
github manually merged commit 008bd7f010 into gh-pr/3689/base 2026-12-01 03:13:36 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.