f16_trans_sweep: harden CLI tokens, atomic JSON writes, and oracle result count guards #1646
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1646"
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 IlyassRS3 on 2026-11-25T06:58:22Z.
Item ID:
F16-TRANS-SWEEP-JSON-AND-GUARDSClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155318176
Summary
Harden CLI parsing, JSON report writing, and oracle result validation in
tools/f16_trans_sweep.py:--ops/--modes/--waves/--hw-archguards: reject empty/trailing comma tokens (v_exp_f16,,keep16,,flush16,32,), deduplicate repeated ops/modes/waves in first-seen order so 65,536-input sweeps aren't run redundantly, and reject empty/whitespace--hw-arch.validate_json_path()& atomicwrite_json_report():O_WRONLY), serialize withallow_nan=Falseand a trailing LF, write non-regular targets like/dev/nulldirectly, and publish regular files atomically viatempfile.mkstemp+file_mode.published_mode+replace_retry.replace.RuntimeErrorincheck_modes()whenlen(got) != len(kernels)or a probe returns an empty word list (instead of crashing withIndexError).RuntimeErrorinsweep()whenlen(got) != len(kernels)(instead of returning a truncated array that crashes inclassify()).tests/test_f16_trans_sweep.py): added 3 test methods covering malformed/duplicate selections, empty--hw-arch, atomic/trailing-LF/NaN/symlink//dev/nullwrites, and short/empty oracle result handling.Verification
python3 -W error -I tests/test_f16_trans_sweep.py -v: 17 passed, 2 skipped (AMD clang / hardware absent)main:ran=19 failures=2 errors=9 (skipped=2)python3 -I tests/test_text_write_line_endings.py: 3/3 passedpython3 -I scripts/check_no_game_data.py tools/f16_trans_sweep.py tests/test_f16_trans_sweep.py: passedpython3 -m compileall -q tools/f16_trans_sweep.py tests/test_f16_trans_sweep.py: passedImported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T06:58:33Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T08:16:26Z.
Independent verification (Windows, Python 3.11.9
-I): diff vs merge-base reviewed — comma-token rejection + first-seen dedup for--ops/--modes/--waves, empty--hw-archguard, symlink-awarevalidate_json_path/write_json_report(O_WRONLY probe,allow_nan=False, trailing LF, mkstemp+published_mode+replace_retry),RuntimeErrorguards on short oracle results — all present.test_f16_trans_sweep.py19 tests OK (2 skips, matches body),--self-testok, CLI probes reject--ops "v_exp_f16,"and--hw-arch " ", compileall + line-endings +check_no_game_dataclean. AI-assisted verification.Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T11:27:28Z.
#1646 | head
e7192663f70ae6ebfa9028e8aaa877408f9a68d6|python3 -I tests/test_f16_trans_sweep.py -v,py -3.12 -I tests/test_f16_trans_sweep.py -v| red: 19 run, 2 failures, 9 errors, 1 class skipped (Linux) / 20 run, 2 failures, 9 errors (Windows) | green: 19 passed, 1 class skipped (Linux) / 20 passed (Windows) | Red → green. Live Radeon case passed on both treesThe PR’s live gfx1036 test passed on both trees, comparing the f16 exponential sweep in wave32 and wave64 and checking exact results for selected integer inputs. The baseline failures were in other tests.
Copied the PR tests onto clean main
4a54aedcb6b66525e0c9f72a6ea10263337c9141for the baseline, then merged that main into the recorded PR head and reran those files. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Native Windows used Python 3.12.10. Windows HIP used AMD Radeon(TM) Graphics, gfx1036, driver 32.0.21045.29003. The WSL run skipped the optional native-hardware case. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:45:05Z.
Merged, thank you @IlyassRS3! This PR (f16_trans_sweep: harden CLI tokens, atomic JSON writes, and oracle result count guards) passed its own tests with main merged in during sodove's verification of this shader batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.