tests: add unit and mutation tests for gfx1013_compute_ir #3686

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

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

Refs #1149

Adds direct unit and mutation tests for x2w::decode_local_data and x2w::expand_gfx1013_compute (src/gfx1013_compute_ir.cpp), with zero edits to existing files (5 new files only). The check is portable C++17 and links only src/gfx1013_compute_ir.cpp: no GPU, no device, no dxc.exe and no Windows header is needed.

What landed (commit 915e568f, branch tests/gfx1013-compute-ir from origin/main 1a9ccbc4):

  • tests/gfx1013_compute_ir_check.cpp: 83 cases, no-arg or single-case. 40 valid decodes (16 RMW atomics incl. return-old forms, 10 reads, 6 writes, 8 read2/write2 pairs with exact byte_offset and data_register), 11 decode refusals (GDS/mask, unsupported opcode 0x3e; opcode 0xff is a valid read_b128, not a refusal), 20 valid expansions (lower/uppercase hex, CRLF and missing trailing newline, halfword odd-address guards, d16/d16_hi bitfields, VOP2 literal and inline-constant forms incl. the 193..208 two's-complement wrap, all 7 VOP2 opcodes) and 12 expansion refusals, every refusal pinning its exact substring.
  • tests/cmake/gfx1013_compute_ir.cmake: registers the check (C++17, no Windows library) with one CTest entry per case plus gfx1013_compute_ir_all, and 5 WILL_FAIL TRUE configure-time copy mutations (GDS mask, unsupported DS opcode, register-tuple bound, unsupported VOP2 opcode, inline-negative mapping).
  • tests/gfx1013_compute_ir_meta_check.py + tests/checks/python-linux/gfx1013_compute_ir.txt: contract audit plus a Python transliteration over all 83 cases; compiles and runs the real C++ check with g++ -std=c++17 and compiles each of the 5 CMake mutation copies the same way, running each control case (must fail); 8/8 model mutations killed.
  • docs/experiments/gfx1013-compute-ir.md: cases, controls and runs.

Linux verification (this host, g++ 13.3.0, /tmp/pe-env Python 3.12.3):

  • tests/gfx1013_compute_ir_meta_check.py: PASS: gfx1013 compute ir: 83 cases, 5/5 real C++ mutations killed, 8/8 model mutations killed
  • g++ -std=c++17 -Isrc -Wall -Wextra tests/gfx1013_compute_ir_check.cpp src/gfx1013_compute_ir.cpp: 83/83 cases passed (only pre-existing -Wmissing-field-initializers warning in src/gfx1013_compute_ir.cpp:16, untouched source)
  • tools/run_checks_parallel.py --from-dir tests/checks/python-linux: all 80 checks passed
  • tests/form_coverage_check.py, tests/docs_links_check.py (198 Markdown files, 765 links), tests/bidi_controls_check.py: pass
  • git diff --check clean; git merge-tree --write-tree origin/main HEAD exits 0; zero personal paths

Windows Verification (915e568f95703232e74aa34dee31620d01c4421a)

Commit: 915e568f95703232e74aa34dee31620d01c4421a (merge-tree upstream/main HEAD -> 57b37416, exit 0; git diff --check clean)
dev: cmake --build --preset dev --target gfx1013_compute_ir_check ... && ctest --preset dev --no-tests=error -R '^gfx1013_compute_ir' --output-on-failure -> 89/89 passed (1.57s; 83 cases + all + 5/5 mutations killed)
release: cmake --build --preset release --target gfx1013_compute_ir_check ... && ctest --preset release --no-tests=error -R '^gfx1013_compute_ir' --output-on-failure -> 89/89 passed (1.54s; 83 cases + all + 5/5 mutations killed)
Direct binary (dev & release): PASS: gfx1013_compute_ir: 83/83 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:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3684) `Ammmae0x:tests/gfx1013-compute-ir` → `main` · +2169 −0 · 5 files · 1 commits · merged 2026-12-01 03:12 UTC Refs #1149 Adds direct unit and mutation tests for `x2w::decode_local_data` and `x2w::expand_gfx1013_compute` (`src/gfx1013_compute_ir.cpp`), with zero edits to existing files (5 new files only). The check is portable C++17 and links only `src/gfx1013_compute_ir.cpp`: no GPU, no device, no dxc.exe and no Windows header is needed. What landed (commit 915e568f, branch `tests/gfx1013-compute-ir` from `origin/main` 1a9ccbc4): - `tests/gfx1013_compute_ir_check.cpp`: 83 cases, no-arg or single-case. 40 valid decodes (16 RMW atomics incl. return-old forms, 10 reads, 6 writes, 8 read2/write2 pairs with exact `byte_offset` and `data_register`), 11 decode refusals (GDS/mask, unsupported opcode 0x3e; opcode 0xff is a valid read_b128, not a refusal), 20 valid expansions (lower/uppercase hex, CRLF and missing trailing newline, halfword odd-address guards, d16/d16_hi bitfields, VOP2 literal and inline-constant forms incl. the 193..208 two's-complement wrap, all 7 VOP2 opcodes) and 12 expansion refusals, every refusal pinning its exact substring. - `tests/cmake/gfx1013_compute_ir.cmake`: registers the check (C++17, no Windows library) with one CTest entry per case plus `gfx1013_compute_ir_all`, and 5 `WILL_FAIL TRUE` configure-time copy mutations (GDS mask, unsupported DS opcode, register-tuple bound, unsupported VOP2 opcode, inline-negative mapping). - `tests/gfx1013_compute_ir_meta_check.py` + `tests/checks/python-linux/gfx1013_compute_ir.txt`: contract audit plus a Python transliteration over all 83 cases; compiles and runs the real C++ check with `g++ -std=c++17` and compiles each of the 5 CMake mutation copies the same way, running each control case (must fail); 8/8 model mutations killed. - `docs/experiments/gfx1013-compute-ir.md`: cases, controls and runs. Linux verification (this host, g++ 13.3.0, /tmp/pe-env Python 3.12.3): - `tests/gfx1013_compute_ir_meta_check.py`: PASS: gfx1013 compute ir: 83 cases, 5/5 real C++ mutations killed, 8/8 model mutations killed - `g++ -std=c++17 -Isrc -Wall -Wextra tests/gfx1013_compute_ir_check.cpp src/gfx1013_compute_ir.cpp`: 83/83 cases passed (only pre-existing `-Wmissing-field-initializers` warning in `src/gfx1013_compute_ir.cpp:16`, untouched source) - `tools/run_checks_parallel.py --from-dir tests/checks/python-linux`: all 80 checks passed - `tests/form_coverage_check.py`, `tests/docs_links_check.py` (198 Markdown files, 765 links), `tests/bidi_controls_check.py`: pass - `git diff --check` clean; `git merge-tree --write-tree origin/main HEAD` exits 0; zero personal paths ### Windows Verification (`915e568f95703232e74aa34dee31620d01c4421a`) ```text Commit: 915e568f95703232e74aa34dee31620d01c4421a (merge-tree upstream/main HEAD -> 57b37416, exit 0; git diff --check clean) dev: cmake --build --preset dev --target gfx1013_compute_ir_check ... && ctest --preset dev --no-tests=error -R '^gfx1013_compute_ir' --output-on-failure -> 89/89 passed (1.57s; 83 cases + all + 5/5 mutations killed) release: cmake --build --preset release --target gfx1013_compute_ir_check ... && ctest --preset release --no-tests=error -R '^gfx1013_compute_ir' --output-on-failure -> 89/89 passed (1.54s; 83 cases + all + 5/5 mutations killed) Direct binary (dev & release): PASS: gfx1013_compute_ir: 83/83 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=915e568f95703232e74aa34dee31620d01c4421a | targets=gfx1013_compute_ir_check gfx1013_compute_ir_gds_mask_mut gfx1013_compute_ir_unsupported_opcode_mut gfx1013_compute_ir_register_tuple_mut gfx1013_compute_ir_vop2_opcode_mut gfx1013_compute_ir_inline_negative_mut | ctest=^gfx1013_compute_ir | release=true -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 01:43:40 +00:00
Author
Owner

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

Reviewed 915e568f by reading the diff; not built or run.

Verdict: approve. The 83 cases follow the decode and expansion paths in src/gfx1013_compute_ir.cpp, and each of the five C++ controls drops a guard that its control case reaches. The SHOULD can follow later. No MUST.

  • SHOULD Three of the eight "killed" mutations (literal_length, vop2_source, unknown_pragma, tests/gfx1013_compute_ir_meta_check.py:272-277) only flip flags in the Python transliteration. Their anchors each appear once in the source (e.g. gfx1013_compute_ir.cpp:140, :216). The meta check already compiles the other five mutants with g++ (:749), so applying these three the same way, or as CMake controls, would make "8/8 killed" a claim about the C++ rather than the model.
  • Checked, no finding: the register-tuple control uses the exact boundary, a read_b64 into v255, so 255 + 2 > 257 is false. The inline-negative control pins the 193..208 two's-complement mapping (:150). Read2/write2 cases check byte_offset and data_register. Opcode 0xff is correctly a valid read_b128, not a refusal. No existing file changes.

Tests: 51 decode + 32 expansion cases prove accepted shapes and each pinned refusal substring. The five *_mut controls prove the GDS mask, the DS opcode refusal, the tuple bound, the VOP2 opcode refusal and the inline-negative mapping 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_compute_ir* tests, so the MSVC evidence is the author's dev + release run (89/89).

**@⁠lukaslw-lab** on GitHub · 2026-12-01 02:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3684#pullrequestreview-6124131672) · **approved these changes** Reviewed `915e568f` by reading the diff; not built or run. **Verdict: approve.** The 83 cases follow the decode and expansion paths in `src/gfx1013_compute_ir.cpp`, and each of the five C++ controls drops a guard that its control case reaches. The SHOULD can follow later. No MUST. - **SHOULD** Three of the eight "killed" mutations (`literal_length`, `vop2_source`, `unknown_pragma`, `tests/gfx1013_compute_ir_meta_check.py:272-277`) only flip flags in the Python transliteration. Their anchors each appear once in the source (e.g. `gfx1013_compute_ir.cpp:140`, `:216`). The meta check already compiles the other five mutants with g++ (`:749`), so applying these three the same way, or as CMake controls, would make "8/8 killed" a claim about the C++ rather than the model. - Checked, no finding: the register-tuple control uses the exact boundary, a `read_b64` into v255, so 255 + 2 > 257 is false. The inline-negative control pins the 193..208 two's-complement mapping (`:150`). Read2/write2 cases check `byte_offset` and `data_register`. Opcode 0xff is correctly a valid `read_b128`, not a refusal. No existing file changes. Tests: 51 decode + 32 expansion cases prove accepted shapes and each pinned refusal substring. The five `*_mut` controls prove the GDS mask, the DS opcode refusal, the tuple bound, the VOP2 opcode refusal and the inline-negative mapping 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_compute_ir*` tests, so the MSVC evidence is the author's dev + release run (89/89).
github manually merged commit 3483339697 into main 2026-12-01 03:13:02 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.