tests: add refusal and mutation tests for gfx1013_compute_clear #3684

Manually merged
github merged 1 commit from github-bot/gh-3682 into main 2026-12-01 03:13:02 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-12-01 01:22 UTC · original
Ammmae0x:tests/gfx1013-compute-clear → main · +1676 −0 · 5 files · 1 commits · merged 2026-12-01 03:12 UTC

Refs #1149

Adds refusal and mutation tests for x2w::replay_group_clear (src/gfx1013_compute_clear.cpp), with zero edits to existing files (5 new files only, +1676/−0; source and src/shader_compute_request.cpp untouched).

  • tests/gfx1013_compute_clear_check.cpp: calls replay_group_clear directly on synthetic req_<key>.c67 requests built in per-case temp directories (removed on every exit), with the root signature serialized by D3D12SerializeVersionedRootSignature. No GPU, no device, no dxc.exe. 5 valid programs (sorted/deduped clears, two descriptor tables, non-zero entry offset, prefetch/clause/waitcnt no-ops, descriptor invalidation followed by a valid rewrite) and 33 refusals, each pinning its exact std::runtime_error substring including the byte offset for loop refusals.
  • tests/cmake/gfx1013_compute_clear.cmake: builds the check from the test plus src/gfx1013_compute_clear.cpp and src/shader_compute_request.cpp, linking only d3d12 (both D3D12 entry points used live in d3d12.lib); registers one CTest test per case plus gfx1013_compute_clear_all, and 5 WILL_FAIL TRUE configure-time copy mutations mirroring era_gpu_alias_open_base_control.
  • tests/gfx1013_compute_clear_meta_check.py + tests/checks/python-linux/gfx1013_compute_clear.txt + docs/experiments/gfx1013-compute-clear.md: Linux contract audit plus a Python transliteration of the replay; 38 cases, 8/8 mutations killed (5 CMake controls + 3 model-only).

Linux (head c2cdfc84, base origin/main e8179e28):

  • meta check: PASS: gfx1013 compute clear: 38 cases, 8/8 mutations killed
  • run_checks_parallel.py --from-dir tests/checks/python-linux: 80/80
  • form/docs/bidi: pass (199 Markdown files/769 links, 2794 files)
  • py_compile, diff --check clean, merge-tree exits 0 against origin/main da804b9c

Windows Verification (c2cdfc842307babd379fe8bdd69e4fe0cbe1fe0f)

Commit: c2cdfc842307babd379fe8bdd69e4fe0cbe1fe0f (merge-tree upstream/main HEAD -> e83bf2ae, exit 0; git diff --check clean)
dev: cmake --build --preset dev --target gfx1013_compute_clear_check ... && ctest --preset dev --no-tests=error -R '^gfx1013_compute_clear' --output-on-failure -> 44/44 passed (1.79s; 38 cases + all + 5/5 mutations killed)
release: cmake --build --preset release --target gfx1013_compute_clear_check ... && ctest --preset release --no-tests=error -R '^gfx1013_compute_clear' --output-on-failure -> 44/44 passed (1.19s; 38 cases + all + 5/5 mutations killed)
Direct binary (dev & release): PASS: gfx1013_compute_clear: 38/38 cases passed
Checks: gfx1013_compute_clear_meta_check.py (38 cases, 8/8 mutations killed), form_coverage_check.py, docs_links_check.py (199 files, 769 links), bidi_controls_check.py (2794 files) -> passed

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-12-01 01:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3682) `Ammmae0x:tests/gfx1013-compute-clear` → `main` · +1676 −0 · 5 files · 1 commits · merged 2026-12-01 03:12 UTC Refs #1149 Adds refusal and mutation tests for `x2w::replay_group_clear` (`src/gfx1013_compute_clear.cpp`), with zero edits to existing files (5 new files only, +1676/−0; source and `src/shader_compute_request.cpp` untouched). - `tests/gfx1013_compute_clear_check.cpp`: calls `replay_group_clear` directly on synthetic `req_<key>.c67` requests built in per-case temp directories (removed on every exit), with the root signature serialized by `D3D12SerializeVersionedRootSignature`. No GPU, no device, no dxc.exe. 5 valid programs (sorted/deduped clears, two descriptor tables, non-zero entry offset, prefetch/clause/waitcnt no-ops, descriptor invalidation followed by a valid rewrite) and 33 refusals, each pinning its exact `std::runtime_error` substring including the byte offset for loop refusals. - `tests/cmake/gfx1013_compute_clear.cmake`: builds the check from the test plus `src/gfx1013_compute_clear.cpp` and `src/shader_compute_request.cpp`, linking only `d3d12` (both D3D12 entry points used live in `d3d12.lib`); registers one CTest test per case plus `gfx1013_compute_clear_all`, and 5 `WILL_FAIL TRUE` configure-time copy mutations mirroring `era_gpu_alias_open_base_control`. - `tests/gfx1013_compute_clear_meta_check.py` + `tests/checks/python-linux/gfx1013_compute_clear.txt` + `docs/experiments/gfx1013-compute-clear.md`: Linux contract audit plus a Python transliteration of the replay; 38 cases, 8/8 mutations killed (5 CMake controls + 3 model-only). Linux (head `c2cdfc84`, base `origin/main` `e8179e28`): - meta check: `PASS: gfx1013 compute clear: 38 cases, 8/8 mutations killed` - `run_checks_parallel.py --from-dir tests/checks/python-linux`: 80/80 - form/docs/bidi: pass (199 Markdown files/769 links, 2794 files) - py_compile, diff --check clean, merge-tree exits 0 against `origin/main` `da804b9c` ### Windows Verification (`c2cdfc842307babd379fe8bdd69e4fe0cbe1fe0f`) ```text Commit: c2cdfc842307babd379fe8bdd69e4fe0cbe1fe0f (merge-tree upstream/main HEAD -> e83bf2ae, exit 0; git diff --check clean) dev: cmake --build --preset dev --target gfx1013_compute_clear_check ... && ctest --preset dev --no-tests=error -R '^gfx1013_compute_clear' --output-on-failure -> 44/44 passed (1.79s; 38 cases + all + 5/5 mutations killed) release: cmake --build --preset release --target gfx1013_compute_clear_check ... && ctest --preset release --no-tests=error -R '^gfx1013_compute_clear' --output-on-failure -> 44/44 passed (1.19s; 38 cases + all + 5/5 mutations killed) Direct binary (dev & release): PASS: gfx1013_compute_clear: 38/38 cases passed Checks: gfx1013_compute_clear_meta_check.py (38 cases, 8/8 mutations killed), form_coverage_check.py, docs_links_check.py (199 files, 769 links), bidi_controls_check.py (2794 files) -> passed ``` AI-assisted. <!-- WIN-VERIFY: passed | sha=c2cdfc842307babd379fe8bdd69e4fe0cbe1fe0f | targets=gfx1013_compute_clear_check gfx1013_compute_clear_entry_offset_mut gfx1013_compute_clear_sa24_mut gfx1013_compute_clear_s_and_literal_mut gfx1013_compute_clear_store_offset_mut gfx1013_compute_clear_empty_stores_mut | ctest=^gfx1013_compute_clear | release=true -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 01:25:50 +00:00
Author
Owner

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

Reviewed c2cdfc84 by reading the diff; not built or run.

Verdict: approve. The cases and the five C++ controls reach the guards they name in replay_group_clear. The three SHOULDs can follow later. No MUST.

  • SHOULD The temporary directory name is fixed per case: %TEMP%\gfx1013_compute_clear_<case>, removed in both the constructor and the destructor (tests/gfx1013_compute_clear_check.cpp:224-235). Under ctest -j, three processes use the same directory: gfx1013_compute_clear_refuse_sa24_wrong, gfx1013_compute_clear_all, and gfx1013_compute_clear_sa24_mut, which runs that same case. So do dev and release runs at the same time. One process's remove_all can delete the req_*.c67 parts another is reading. That gives flaky failures, and a WILL_FAIL control could pass for the wrong reason. A per-process suffix (PID or a random tag) closes it.
  • SHOULD compute_key (tests/gfx1013_compute_clear_check.cpp:158-169) copies the request hash with the revision hard-coded as "x2w-startup-shader-29cs". read_compute_request checks the key, so the next compute revision bump makes all 38 cases fail on a key mismatch. CI never runs them, so nobody would notice. x2w::compute_request_key is public (src/shader_compute_request.h:13), and the check already links that file. Calling it removes the copy.
  • SHOULD The check needs D3D12, so the Linux meta check cannot compile it. The three model-only mutations (load_imm, mbcnt_hi_src, store_bin, tests/gfx1013_compute_clear_meta_check.py:234-238) are therefore checked only against the Python model. Their anchors exist in src/gfx1013_compute_clear.cpp, so three more CMake controls like (a)–(e) would make "8/8 killed" true for the C++.
  • Checked, no finding: each CMake anchor stops with FATAL_ERROR when it disappears. Each control's described failure matches its edit; the entry-offset mutant refuses at byte 2 with a different message, which the exact-substring match catches. No existing file changes.

Tests: 5 valid + 33 refusal cases prove the replay's accepted shapes and each pinned refusal message. The 5 *_mut controls prove the entry alignment, sa[24], the s_and_b32 literal, store offset alignment and the empty-store guard are each needed. CI ran none of them at this head: the Windows pr filter (CMakePresets.json) excludes gfx1013_compute_clear*, and Linux runs only the contract audit and model. The C++ evidence is the author's local dev + release run (44/44).

**@⁠lukaslw-lab** on GitHub · 2026-12-01 02:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3682#pullrequestreview-6124127130) · **approved these changes** Reviewed `c2cdfc84` by reading the diff; not built or run. **Verdict: approve.** The cases and the five C++ controls reach the guards they name in `replay_group_clear`. The three SHOULDs can follow later. No MUST. - **SHOULD** The temporary directory name is fixed per case: `%TEMP%\gfx1013_compute_clear_<case>`, removed in both the constructor and the destructor (`tests/gfx1013_compute_clear_check.cpp:224-235`). Under `ctest -j`, three processes use the same directory: `gfx1013_compute_clear_refuse_sa24_wrong`, `gfx1013_compute_clear_all`, and `gfx1013_compute_clear_sa24_mut`, which runs that same case. So do dev and release runs at the same time. One process's `remove_all` can delete the `req_*.c67` parts another is reading. That gives flaky failures, and a `WILL_FAIL` control could pass for the wrong reason. A per-process suffix (PID or a random tag) closes it. - **SHOULD** `compute_key` (`tests/gfx1013_compute_clear_check.cpp:158-169`) copies the request hash with the revision hard-coded as `"x2w-startup-shader-29cs"`. `read_compute_request` checks the key, so the next compute revision bump makes all 38 cases fail on a key mismatch. CI never runs them, so nobody would notice. `x2w::compute_request_key` is public (`src/shader_compute_request.h:13`), and the check already links that file. Calling it removes the copy. - **SHOULD** The check needs D3D12, so the Linux meta check cannot compile it. The three model-only mutations (`load_imm`, `mbcnt_hi_src`, `store_bin`, `tests/gfx1013_compute_clear_meta_check.py:234-238`) are therefore checked only against the Python model. Their anchors exist in `src/gfx1013_compute_clear.cpp`, so three more CMake controls like (a)–(e) would make "8/8 killed" true for the C++. - Checked, no finding: each CMake anchor stops with FATAL_ERROR when it disappears. Each control's described failure matches its edit; the entry-offset mutant refuses at byte 2 with a different message, which the exact-substring match catches. No existing file changes. Tests: 5 valid + 33 refusal cases prove the replay's accepted shapes and each pinned refusal message. The 5 `*_mut` controls prove the entry alignment, `sa[24]`, the `s_and_b32` literal, store offset alignment and the empty-store guard are each needed. CI ran none of them at this head: the Windows `pr` filter (`CMakePresets.json`) excludes `gfx1013_compute_clear*`, and Linux runs only the contract audit and model. The C++ evidence is the author's local dev + release run (44/44).
github manually merged commit 1b46645d17 into main 2026-12-01 03:13:02 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.