Skip to content

tools: add differential fuzzer for 32-bit and 16-bit integer VALU ops (valu_int_diff.py) - #2820

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
eyyun:feat/valu-int-diff
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
eyyun:feat/valu-int-diff

Conversation

@eyyun

@eyyun eyyun commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted.

Adds tools/valu_int_diff.py and tests/test_valu_int_diff.py (standard library only, no game data): a differential fuzzer comparing an independent AMD RDNA2 ISA reference model against tools/rdna2spirv.py + tests/semantic/spirv_mini_interp.py across 71 32-bit integer, bitfield, SAD/lerp, 16-bit op_sel, and packed-16bit VALU instructions (including clamp and SGPR/inline/literal sources).

Testing

Tested on Windows 11 (no game data, Vulkan SDK 1.4.363.0):

  • python -I tools/valu_int_diff.py --programs 200 --seed 1 --spirv-val -> 200 pass, 0 mismatch
  • python -I tools/valu_int_diff.py --programs 1000 --seed 2 -> 1000 pass, 0 mismatch
  • python -I tools/valu_int_diff.py --self-test -> self-test OK
  • python -I tests/test_valu_int_diff.py -v -> 3/3 OK
  • python -I tests/test_text_write_line_endings.py -> 2/2 OK
  • python -I tests/test_tool_startup.py -> 2/2 OK

@Yourrespawn

Copy link
Copy Markdown
Contributor

Independent reproduction on Windows 11 Pro 10.0.26200, Python 3.12.10 (dde25ff6): pass.

  • --self-test: OK
  • tests/test_valu_int_diff.py: 3/3 OK
  • Author's run reproduced: --programs 200 --seed 1 --spirv-val → 200 pass, 0 mismatch
  • Fresh seed at 10× scale: --programs 2000 --seed 42 --spirv-val → 2000 pass, 0 mismatch

2200 programs total on top of the author's runs, all validated through spirv-val, zero divergence between the ISA reference model and rdna2spirv.py + spirv_mini_interp.py.

One framing note for future testers: unlike #2749 (sad_diff.py, which pins measured gfx1036 oracle rows), this tool has no hardware mode — it checks reference-model vs interpreter agreement only, so a GPU run adds no signal. The cross-vendor datapoint that matters here is the environment/interpreter one above.

AI-assisted (ZCode agent): builds and runs executed by a coding agent on this machine.

@padhossein

Copy link
Copy Markdown
Contributor

Independent extra fuzzer seeds (dde25ff6). I ran two additional deterministic seeds (2026 and 65537), 140 programs each with up to 24 ops and --spirv-val on Linux. Both completed 140/140 with zero mismatches or validation failures. The self-test and all three focused unit tests also passed. Synthetic input only.

AI-assisted (Codex).

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on the PR head: python -I tests/test_valu_int_diff.py -> 3/3 OK; --programs 200 --seed 1 --spirv-val -> 200/200, --programs 1000 --seed 2 -> 1000/1000; --self-test OK; tests/test_tool_startup.py -> 2/2. The mutation control (changing the unsigned add-clamp constant) fails 2/3, so the suite catches a real clamp regression. Synthetic programs only; no game data or absolute paths. Approve.

@Marukooh

Copy link
Copy Markdown
Contributor

Tested dde25ff6 on CachyOS Linux, Python 3.14. tests/test_valu_int_diff.py: 3 passed.

In addition to the unit file, a fresh integer differential run with --programs 32 --seed 2026 --max-ops 8 --spirv-val passed 32/32 with no mismatches.

AI-assisted, synthetic inputs only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants