test_cvt_norm_mods_probe: compute the expected f16 sweep once per op in FakeOracle (TEST-CVT-NORM-SWEEP-CACHE) #2064
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2064"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by amine23012004 on 2026-11-25T19:21:13Z.
Claimed in the coordination issue as: TEST-CVT-NORM-SWEEP-CACHE
What and why
FakeOracle.runintests/test_cvt_norm_mods_probe.pycalledpr.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 thebad_wordandwave64_diffmutations never reach the cache. The tool and its reference model are unchanged.The
checkjob 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.main9f9a7c5f; merges cleanly with #1638, which edits the same test file elsewhere.GPUs tested: n/a (test-only change, no GPU used)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by MSedgeMC on 2026-11-25T19:45:23Z.
Review: APPROVED
Verified on the PR branch: python3 -m unittest tests.test_cvt_norm_mods_probe -> 14 tests OK (2 skips). Measured effect: main runs the same suite in 19.4 s, the PR branch in 2.6 s — caching expected_sweep_words once per op removes the repeated exact-rational 65,536-input computation in FakeOracle. The cache returns a slice copy, so a bad-word mutation cannot poison later callers. Advisory: branch carries ~34 older commits not on main; rebase before merge.
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:12:05Z.
#2064 | head
1847fa73c1c80c89c099413f30dcbbfc50132fb0|python3 -I tests/test_cvt_norm_mods_probe.py -v| red: 14 passed | green: 14 passed | Green on both trees, test runtime reduced in sampleThis changes caching inside the test file itself. For a separate timing check I also ran the untouched main file with the same compiler tools. All 14 tests ran on each tree, including the assembly checks. Unittest reported 12.259 s on untouched main and 2.805 s after merge (one timing sample per tree).
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:58:51Z.
Merged, thank you @amine23012004! This PR (test_cvt_norm_mods_probe: compute the expected f16 sweep once per op in FakeOracle (TEST-CVT-NORM-SWEEP-CACHE)) was checked by zmasi or sodove and then by our own local run of its tests with main merged in, and it passed cleanly, so it went in with its reviewed batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.