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

Merged
EdenBendheim merged 1 commit from upstream-pr/453 into main 2026-11-24 08:52:29 +00:00
EdenBendheim commented 2026-11-24 05:40:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-11-24T05:40:15Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466780336 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/453). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-11-24T05:40:15Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T08:52:25Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7126670213 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/453#issuecomment-7126670213). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T08:52:25Z. --- 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 reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!453
No description provided.