[PR #2064] test_cvt_norm_mods_probe: compute the expected f16 sweep once per op in FakeOracle (TEST-CVT-NORM-SWEEP-CACHE) #2070

Open
opened 2026-11-26 21:19:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2064
Author: @amine23012004
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: test-cvt-norm-sweep-cache


📝 Commits (1)

  • 1847fa7 test_cvt_norm_mods_probe: compute the expected f16 sweep once per op in FakeOracle

📊 Changes

1 file changed (+12 additions, -1 deletions)

View changed files

📝 tests/test_cvt_norm_mods_probe.py (+12 -1)

📄 Description

Claimed in the coordination issue as: TEST-CVT-NORM-SWEEP-CACHE

What and why

FakeOracle.run in tests/test_cvt_norm_mods_probe.py called pr.expected_sweep_words(op) for every sweep kernel it ran. That function is the exact rational reference model over all 65,536 f16 inputs, about 1.2-1.6 s a call, and the fake runs cover many kernels (two ops, both waves, every VOP3 modifier, two halves, plus the MODE variants), several times per file. The file took 98 s on its own, and over 300 s when run next to other tests on a 4-core machine.

This change computes the sweep once per op in a module-level cache (_sweep_words). Each kernel still gets a sliced copy, so the bad_word and wave64_diff mutations never reach the cache. The tool and its reference model are unchanged.

The check job runs the roughly 500 standard-library test files one after another under a 15-minute timeout, so this file used a noticeable share of it.

Tested

  • python3 -I tests/test_cvt_norm_mods_probe.py: 14 tests OK, 98 s before, 22-24 s after on a busy machine, and 28 s before, 6 s after on an idle one (Linux, Python 3.14.8, Intel i7-8650U, CPU only). One sweep also measured at 1.23 s under Python 3.12.15, so this is not a 3.14 slowdown.
  • python3 -m compileall -q, python3 -I scripts/check_no_game_data.py tests/test_cvt_norm_mods_probe.py, python3 -I tests/test_text_write_line_endings.py: OK.
  • Based on main 9f9a7c5f; merges cleanly with #1638, which edits the same test file elsewhere.
  • Not run on Windows.

GPUs tested: n/a (test-only change, no GPU used)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2064 **Author:** [@amine23012004](https://github.com/amine23012004) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `test-cvt-norm-sweep-cache` --- ### 📝 Commits (1) - [`1847fa7`](https://github.com/ubiquitarianism/leonida/commit/1847fa73c1c80c89c099413f30dcbbfc50132fb0) test_cvt_norm_mods_probe: compute the expected f16 sweep once per op in FakeOracle ### 📊 Changes **1 file changed** (+12 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_cvt_norm_mods_probe.py` (+12 -1) </details> ### 📄 Description Claimed in the coordination issue as: TEST-CVT-NORM-SWEEP-CACHE ### What and why `FakeOracle.run` in `tests/test_cvt_norm_mods_probe.py` called `pr.expected_sweep_words(op)` for every sweep kernel it ran. That function is the exact rational reference model over all 65,536 f16 inputs, about 1.2-1.6 s a call, and the fake runs cover many kernels (two ops, both waves, every VOP3 modifier, two halves, plus the MODE variants), several times per file. The file took 98 s on its own, and over 300 s when run next to other tests on a 4-core machine. This change computes the sweep once per op in a module-level cache (`_sweep_words`). Each kernel still gets a sliced copy, so the `bad_word` and `wave64_diff` mutations never reach the cache. The tool and its reference model are unchanged. The `check` job runs the roughly 500 standard-library test files one after another under a 15-minute timeout, so this file used a noticeable share of it. ### Tested - `python3 -I tests/test_cvt_norm_mods_probe.py`: 14 tests OK, **98 s before, 22-24 s after** on a busy machine, and **28 s before, 6 s after** on an idle one (Linux, Python 3.14.8, Intel i7-8650U, CPU only). One sweep also measured at 1.23 s under Python 3.12.15, so this is not a 3.14 slowdown. - `python3 -m compileall -q`, `python3 -I scripts/check_no_game_data.py tests/test_cvt_norm_mods_probe.py`, `python3 -I tests/test_text_write_line_endings.py`: OK. - Based on `main` `9f9a7c5f`; merges cleanly with #1638, which edits the same test file elsewhere. - Not run on Windows. GPUs tested: n/a (test-only change, no GPU used) AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#2070
No description provided.