tests: add unit and mutation tests for gfx1013_isa #3688

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

@⁠Ammmae0x on GitHub · 2026-12-01 01:41 UTC · original
Ammmae0x:tests/gfx1013-isa → main · +1321 −0 · 5 files · 1 commits · merged 2026-12-01 03:12 UTC

Refs #1149

Direct unit and mutation tests for x2w::gfx1013::instruction (src/gfx1013_isa.cpp), with zero edits to existing files (5 new files only, +1321/-0; portable C++17 needing only tests/gfx1013_isa_check.cpp + src/gfx1013_isa.cpp).

  • tests/gfx1013_isa_check.cpp: 80 cases, no-arg runs all, optional <case> arg, loud FAIL: <case>: ... with exit 1. All 20 forms with exact opcode, size and name (VOP3 native 0x202, all 3 fallbacks to VOPC/VOP2/VOP1, empty name for 0x200; VINTRP 4 bytes; MTBUF bit 3 from (word(1) >> 18) & 8; MIMG bit 7 and NSA sizes 8/12/16/20); extensions on 233/234/249/250/255 for VOP1/VOP2/VOPC, VOP2 madmk/madak/fmamk/fmaak without src 255, SOP 255 incl. src1, SOPK s_setreg_imm32_b32, VOP3/VOP3P literal 255 in src0/src1/src2; non-zero pc slicing; 17 refusals pinning exact messages (misaligned pc, empty/short code, truncated extension words incl. MIMG NSA=1 and MTBUF, reserved FLAT segment, unknown formats 0x39/0x3b/0x3f). Includes <initializer_list>, MSVC /W4 clean intent.
  • tests/cmake/gfx1013_isa.cmake: per-case tests + gfx1013_isa_all + 5 WILL_FAIL TRUE configure-time copy mutations mirroring era_gpu_alias_open_base_control (mtbuf_bit3, mimg_nsa, vop3_fallback, vop2_madmk, flat_segment).
  • tests/gfx1013_isa_meta_check.py + tests/checks/python-linux/gfx1013_isa.txt + docs/experiments/gfx1013-isa.md: contract audit + compile & run the real C++ check with g++ -std=c++17 on Linux + all 5 CMake mutations, plus a Python transliteration model with 8/8 mutations killed (5 CMake + 3 model-only: ext_src255, sopk_setreg, vop3_literal).

Linux (this host, base origin/main 1a9ccbc4):

  • meta check: PASS: gfx1013 isa: 80 cases, 5/5 real C++ mutations killed, 8/8 model mutations killed
  • run_checks_parallel.py --from-dir tests/checks/python-linux: all 80 checks passed
  • form/docs/bidi pass (198 files/765 links, 2793 files), py_compile pass, diff --check clean, merge-tree exits 0, zero personal paths

Windows Verification (70dd849bfeda1beddf28c29b9857cfb6224cb2f2)

Commit: 70dd849bfeda1beddf28c29b9857cfb6224cb2f2 (merge-tree upstream/main HEAD -> dacd18ec, exit 0; git diff --check clean)
dev: cmake --build --preset dev --target gfx1013_isa_check ... && ctest --preset dev --no-tests=error -R '^gfx1013_isa' --output-on-failure -> 86/86 passed (1.52s; 80 cases + all + 5/5 mutations killed)
release: cmake --build --preset release --target gfx1013_isa_check ... && ctest --preset release --no-tests=error -R '^gfx1013_isa' --output-on-failure -> 86/86 passed (1.49s; 80 cases + all + 5/5 mutations killed)
Direct binary (dev & release): PASS: gfx1013_isa: 80/80 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:41 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3686) `Ammmae0x:tests/gfx1013-isa` → `main` · +1321 −0 · 5 files · 1 commits · merged 2026-12-01 03:12 UTC Refs #1149 Direct unit and mutation tests for `x2w::gfx1013::instruction` (`src/gfx1013_isa.cpp`), with zero edits to existing files (5 new files only, +1321/-0; portable C++17 needing only `tests/gfx1013_isa_check.cpp` + `src/gfx1013_isa.cpp`). - `tests/gfx1013_isa_check.cpp`: 80 cases, no-arg runs all, optional `<case>` arg, loud `FAIL: <case>: ...` with exit 1. All 20 forms with exact opcode, size and name (VOP3 native `0x202`, all 3 fallbacks to VOPC/VOP2/VOP1, empty name for `0x200`; VINTRP 4 bytes; MTBUF bit 3 from `(word(1) >> 18) & 8`; MIMG bit 7 and NSA sizes 8/12/16/20); extensions on 233/234/249/250/255 for VOP1/VOP2/VOPC, VOP2 madmk/madak/fmamk/fmaak without src 255, SOP 255 incl. src1, SOPK `s_setreg_imm32_b32`, VOP3/VOP3P literal 255 in src0/src1/src2; non-zero pc slicing; 17 refusals pinning exact messages (misaligned pc, empty/short code, truncated extension words incl. MIMG NSA=1 and MTBUF, reserved FLAT segment, unknown formats 0x39/0x3b/0x3f). Includes `<initializer_list>`, MSVC /W4 clean intent. - `tests/cmake/gfx1013_isa.cmake`: per-case tests + `gfx1013_isa_all` + 5 WILL_FAIL TRUE configure-time copy mutations mirroring `era_gpu_alias_open_base_control` (mtbuf_bit3, mimg_nsa, vop3_fallback, vop2_madmk, flat_segment). - `tests/gfx1013_isa_meta_check.py` + `tests/checks/python-linux/gfx1013_isa.txt` + `docs/experiments/gfx1013-isa.md`: contract audit + compile & run the real C++ check with `g++ -std=c++17` on Linux + all 5 CMake mutations, plus a Python transliteration model with 8/8 mutations killed (5 CMake + 3 model-only: ext_src255, sopk_setreg, vop3_literal). Linux (this host, base `origin/main` 1a9ccbc4): - meta check: `PASS: gfx1013 isa: 80 cases, 5/5 real C++ mutations killed, 8/8 model mutations killed` - `run_checks_parallel.py --from-dir tests/checks/python-linux`: all 80 checks passed - form/docs/bidi pass (198 files/765 links, 2793 files), py_compile pass, diff --check clean, merge-tree exits 0, zero personal paths ### Windows Verification (`70dd849bfeda1beddf28c29b9857cfb6224cb2f2`) ```text Commit: 70dd849bfeda1beddf28c29b9857cfb6224cb2f2 (merge-tree upstream/main HEAD -> dacd18ec, exit 0; git diff --check clean) dev: cmake --build --preset dev --target gfx1013_isa_check ... && ctest --preset dev --no-tests=error -R '^gfx1013_isa' --output-on-failure -> 86/86 passed (1.52s; 80 cases + all + 5/5 mutations killed) release: cmake --build --preset release --target gfx1013_isa_check ... && ctest --preset release --no-tests=error -R '^gfx1013_isa' --output-on-failure -> 86/86 passed (1.49s; 80 cases + all + 5/5 mutations killed) Direct binary (dev & release): PASS: gfx1013_isa: 80/80 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=70dd849bfeda1beddf28c29b9857cfb6224cb2f2 | targets=gfx1013_isa_check gfx1013_isa_mtbuf_bit3_mut gfx1013_isa_mimg_nsa_mut gfx1013_isa_vop3_fallback_mut gfx1013_isa_vop2_madmk_mut gfx1013_isa_flat_segment_mut | ctest=^gfx1013_isa | release=true -->
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 01:43:48 +00:00
Author
Owner

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

Reviewed 70dd849b by reading the diff; not built or run.

Verdict: approve. The cases follow every branch of instruction() and the five C++ mutations each drop a real guard; the one SHOULD can follow later. No MUST.

  • SHOULD Three of the eight "killed" mutations (ext_src255, sopk_setreg, vop3_literal, tests/gfx1013_isa_meta_check.py:259-265) only flip flags in the Python transliteration (decode(), :293). They show that the model notices the change, but not that the C++ check does. All three already have unique text anchors in src/gfx1013_isa.cpp (:44, :71, :91), and the meta check already compiles the other five mutants with g++ (:542). Applying these three to the real source the same way, or as three more CMake controls, would make "8/8 killed" a claim about the C++. It would also catch drift between the 581-line model and the decoder.
  • Checked, no finding: the case table covers all 20 forms, the extension rule for each source (233/234/249/250/255, madmk/madak/fmamk/fmaak, SOP src0/src1, s_setreg_imm32_b32, VOP3/VOP3P src0–2), the MTBUF opcode bit 3 from word 1, MIMG bit 7 and NSA 1–3, and all three throw sites (gfx1013_isa.cpp:31/101/128), with exact messages and non-zero pc. The harness fails on an unknown case name, so a renamed case cannot pass silently. The new files are picked up by the existing tests/cmake/*.cmake glob and the python-linux list, and no existing file changes.

Tests: the 80 cases plus gfx1013_isa_all prove the decoder's form, opcode, size, name and refusal on synthetic words. The five *_mut controls prove the MTBUF bit, the NSA count, the VOP3 fallback, madmk and the FLAT segment guard 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++. Windows builds the targets, but the pr preset filter (CMakePresets.json) runs none of the gfx1013_isa* tests, so MSVC coverage is the author's local dev + release run (86/86).

**@⁠lukaslw-lab** on GitHub · 2026-12-01 02:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3686#pullrequestreview-6124113870) · **approved these changes** Reviewed `70dd849b` by reading the diff; not built or run. **Verdict: approve.** The cases follow every branch of `instruction()` and the five C++ mutations each drop a real guard; the one SHOULD can follow later. No MUST. - **SHOULD** Three of the eight "killed" mutations (`ext_src255`, `sopk_setreg`, `vop3_literal`, `tests/gfx1013_isa_meta_check.py:259-265`) only flip flags in the Python transliteration (`decode()`, `:293`). They show that the model notices the change, but not that the C++ check does. All three already have unique text anchors in `src/gfx1013_isa.cpp` (`:44`, `:71`, `:91`), and the meta check already compiles the other five mutants with g++ (`:542`). Applying these three to the real source the same way, or as three more CMake controls, would make "8/8 killed" a claim about the C++. It would also catch drift between the 581-line model and the decoder. - Checked, no finding: the case table covers all 20 forms, the extension rule for each source (233/234/249/250/255, madmk/madak/fmamk/fmaak, SOP src0/src1, `s_setreg_imm32_b32`, VOP3/VOP3P src0–2), the MTBUF opcode bit 3 from word 1, MIMG bit 7 and NSA 1–3, and all three throw sites (`gfx1013_isa.cpp:31/101/128`), with exact messages and non-zero pc. The harness fails on an unknown case name, so a renamed case cannot pass silently. The new files are picked up by the existing `tests/cmake/*.cmake` glob and the `python-linux` list, and no existing file changes. Tests: the 80 cases plus `gfx1013_isa_all` prove the decoder's form, opcode, size, name and refusal on synthetic words. The five `*_mut` controls prove the MTBUF bit, the NSA count, the VOP3 fallback, madmk and the FLAT segment guard 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++. Windows builds the targets, but the `pr` preset filter (`CMakePresets.json`) runs none of the `gfx1013_isa*` tests, so MSVC coverage is the author's local dev + release run (86/86).
github manually merged commit 8df63051c0 into main 2026-12-01 03:13:02 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.