shader_diff: exercise scalar addition and carry (s_add_u32) #453

Merged
leonida/mandy
EdenBendheim merged 1 commit from ubiq/shader-diff-scalar-add into main 2026-11-24 08:52:29 +00:00

Pull request successfully merged and closed

EdenBendheim commented 2026-11-24 05:40:15 +00:00

Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7123163799

What changed

  • tools/shader_diff.py: Generate s_add_u32 from seeded SGPRs by default and add --ops filtering for focused runs and replay, exporting both the running sum and scc carry into the two least-recently-written export VGPRs so both CPU oracles compare them.
  • tests/test_shader_diff_scalar_add.py & tests/test_shader_diff.py: Deterministic synthetic tests covering default generation, --ops s_add_u32 replay, ordinary addition, 32-bit wraparound (0xffffffff + 1, 0xffffffff + 2), negative mismatch control, and updated fixture seeds preserving register-allocation boundary coverage.

Testing & Disclosure

  • AI-assisted: Implemented with Codex (gpt-6.2-sol) and reviewed with Codex (gpt-6.2-astra).
  • Environment: macOS 27.3, Apple M1 Max (CPU-only, synthetic programs, zero game data).
  • Verified on ubiquitarianism/leonida main (8f481cf16): pytest tests/test_shader_diff.py (20/20), test_shader_diff_exit.py (18/18), test_shader_diff_scalar_add.py (4/4), 10/10 --ops s_add_u32 runs, 3/3 self-test canaries, check_no_game_data.py, LF check — all passed.
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7123163799 ### What changed - **`tools/shader_diff.py`**: Generate `s_add_u32` from seeded SGPRs by default and add `--ops` filtering for focused runs and replay, exporting both the running sum and `scc` carry into the two least-recently-written export VGPRs so both CPU oracles compare them. - **`tests/test_shader_diff_scalar_add.py` & `tests/test_shader_diff.py`**: Deterministic synthetic tests covering default generation, `--ops s_add_u32` replay, ordinary addition, 32-bit wraparound (`0xffffffff + 1`, `0xffffffff + 2`), negative mismatch control, and updated fixture seeds preserving register-allocation boundary coverage. ### Testing & Disclosure - **AI-assisted:** Implemented with Codex (`gpt-6.2-sol`) and reviewed with Codex (`gpt-6.2-astra`). - **Environment:** macOS 27.3, Apple M1 Max (CPU-only, synthetic programs, zero game data). - **Verified on `ubiquitarianism/leonida` `main` (`8f481cf16`):** `pytest tests/test_shader_diff.py` (20/20), `test_shader_diff_exit.py` (18/18), `test_shader_diff_scalar_add.py` (4/4), 10/10 `--ops s_add_u32` runs, 3/3 self-test canaries, `check_no_game_data.py`, LF check — all passed.
QemmHD commented 2026-11-24 08:52:25 +00:00

Merging. Why merged: the shader differential runner now covers scalar add and carry (s_add_u32), and replay commands include --ops.
Why it's good: test-harness only; on main 1c93c86: shader_diff tests 38 -> 42 (11 fail without the change); repo-consistency set 563/563.

AI-assisted (Claude Code, Claude Opus 5.5).

Merging. Why merged: the shader differential runner now covers scalar add and carry (s_add_u32), and replay commands include --ops. Why it's good: test-harness only; on main 1c93c86: shader_diff tests 38 -> 42 (11 fail without the change); repo-consistency set 563/563. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.