docs/shader_validation.md: document tools/d16_image_probe.py and tools/semantic_mutants.py (DOC-SHADER-VAL-D16-MUTANTS) #1782

Manually merged
github merged 1 commit from gh-pr/1782/head into gh-pr/1782/base 2026-11-26 10:04:58 +00:00
Owner

@⁠ShotTechOp on GitHub · 2026-11-25 12:03 UTC · original
ShotTechOp:docs/shader-validation-d16-and-mutants → main · +44 −0 · 1 files · 1 commits · merged 2026-11-25 21:27 UTC

Summary

Claimed in #1608 as DOC-SHADER-VAL-D16-MUTANTS: #1608

Documents two existing shader-validation tools in docs/shader_validation.md that were not yet mentioned anywhere in docs/:

  1. tools/d16_image_probe.py (placed right after its buffer-load counterpart tools/d16_format_probe.py):
    • Summarizes the image_load, point image_sample_lz, and bilinear image_sample_lz (--frac) paths across unorm8, snorm8, unorm16, snorm16, float16, and float32 (f16 halfway ties).
    • Lists CLI options (--formats, --waves, --frac, --json, --hw-arch, --self-test), exit codes (0/1/2/77), and its unit test suite tests/test_d16_image_probe.py.
  2. tools/semantic_mutants.py (placed right before ## Coverage plan and cost):
    • Summarizes op-scoped one-line mutation testing of tools/rdna2spirv.py against a tests/semantic test file via LEONIDA_TOOLS_DIR (same hook as tests/semantic/test_mutations.py).
    • Uses existing tests/semantic/test_alu_sad.py with --op v_sad_u8 (no stale hardcoded --lines range), lists selectors (--op, --function, --lines), --list, --timeout, exit codes (0/1/2), and tests/test_semantic_mutants.py.

Zero line overlap with open #1605 (which deduplicates lines 1998–2184).

Testing

Environment: Windows 11 x64, Python 3.12.10, CPU-only (no GPU or game files; based on 0d80bc5).

  • python -I tools/d16_image_probe.py --self-test -> self-test ok
  • python -I tools/semantic_mutants.py tests/semantic/test_alu_sad.py --op v_sad_u8 --list -> lists 31 mutants cleanly (exit 0)
  • python -m unittest discover -s tests -p "test_docs_*.py" -> all doc-integrity suites pass
  • python -I scripts/check_no_game_data.py docs/shader_validation.md -> exit 0
  • git diff --check -> clean

AI-assisted: yes (Antigravity). Docs-only; no game data.

**@⁠ShotTechOp** on GitHub · 2026-11-25 12:03 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1782) `ShotTechOp:docs/shader-validation-d16-and-mutants` → `main` · +44 −0 · 1 files · 1 commits · merged 2026-11-25 21:27 UTC ## Summary Claimed in #1608 as `DOC-SHADER-VAL-D16-MUTANTS`: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 Documents two existing shader-validation tools in `docs/shader_validation.md` that were not yet mentioned anywhere in `docs/`: 1. **`tools/d16_image_probe.py`** (placed right after its buffer-load counterpart `tools/d16_format_probe.py`): - Summarizes the `image_load`, point `image_sample_lz`, and bilinear `image_sample_lz` (`--frac`) paths across `unorm8`, `snorm8`, `unorm16`, `snorm16`, `float16`, and `float32` (f16 halfway ties). - Lists CLI options (`--formats`, `--waves`, `--frac`, `--json`, `--hw-arch`, `--self-test`), exit codes (`0`/`1`/`2`/`77`), and its unit test suite `tests/test_d16_image_probe.py`. 2. **`tools/semantic_mutants.py`** (placed right before `## Coverage plan and cost`): - Summarizes op-scoped one-line mutation testing of `tools/rdna2spirv.py` against a `tests/semantic` test file via `LEONIDA_TOOLS_DIR` (same hook as `tests/semantic/test_mutations.py`). - Uses existing `tests/semantic/test_alu_sad.py` with `--op v_sad_u8` (no stale hardcoded `--lines` range), lists selectors (`--op`, `--function`, `--lines`), `--list`, `--timeout`, exit codes (`0`/`1`/`2`), and `tests/test_semantic_mutants.py`. Zero line overlap with open `#1605` (which deduplicates lines 1998–2184). ## Testing Environment: Windows 11 x64, Python 3.12.10, CPU-only (no GPU or game files; based on `0d80bc5`). - `python -I tools/d16_image_probe.py --self-test` -> `self-test ok` - `python -I tools/semantic_mutants.py tests/semantic/test_alu_sad.py --op v_sad_u8 --list` -> lists 31 mutants cleanly (exit 0) - `python -m unittest discover -s tests -p "test_docs_*.py"` -> all doc-integrity suites pass - `python -I scripts/check_no_game_data.py docs/shader_validation.md` -> exit 0 - `git diff --check` -> clean AI-assisted: yes (Antigravity). Docs-only; no game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:04:57 +00:00
github manually merged commit 7ea654f9ac into gh-pr/1782/base 2026-11-26 10:04:58 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 19:04 UTC · original

Reviewed 7ea654f9a: ran on both trees tests/test_d16_image_probe.py (Ran 13, OK, 2 GPU tests skipped), tests/test_semantic_mutants.py (21/23; the 2 failures are the SourceOption tests needing git ls-files, which is not available here - identical on main), the documented commands d16_image_probe.py --self-test (ok), --hw-arch gfx1031 --json (exit 77, no GPU here), semantic_mutants.py --op v_sad_u8 --list (31 mutants) plus the full run (30 of 31 caught, 1 SURVIVED, matching the doc's equivalence caveat), the 12 docs linters (all OK) and check_no_game_data on the page (clean). One accuracy fix: the new section enumerates the compared rules as rte, f32_rte and their toward-zero and denormal-flushing variants, but classify() compares 10 rules including mul_rte/mul_rte_flush (the reciprocal-multiply reading), also present in the JSON report; adding mul_rte would make it exact. Every other claim matches the code.

AI-assisted review.

Recommendation: Fix first

**@⁠PierreEbele** on GitHub · 2026-11-25 19:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1782#issuecomment-7171791172) Reviewed 7ea654f9a: ran on both trees tests/test_d16_image_probe.py (Ran 13, OK, 2 GPU tests skipped), tests/test_semantic_mutants.py (21/23; the 2 failures are the SourceOption tests needing `git ls-files`, which is not available here - identical on main), the documented commands d16_image_probe.py --self-test (ok), --hw-arch gfx1031 --json (exit 77, no GPU here), semantic_mutants.py --op v_sad_u8 --list (31 mutants) plus the full run (30 of 31 caught, 1 SURVIVED, matching the doc's equivalence caveat), the 12 docs linters (all OK) and check_no_game_data on the page (clean). One accuracy fix: the new section enumerates the compared rules as rte, f32_rte and their toward-zero and denormal-flushing variants, but classify() compares 10 rules including mul_rte/mul_rte_flush (the reciprocal-multiply reading), also present in the JSON report; adding mul_rte would make it exact. Every other claim matches the code. AI-assisted review. **Recommendation:** Fix first
This discussion has been locked. Commenting is limited to contributors.
No description provided.