vrel_diff: reject malformed --ops tokens, guard compare() lane/word counts, handle shrink Skip, and tighten RefError checks #1661
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1661"
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-25T07:26:48Z.
Item ID:
VREL-DIFF-CLI-COMPARE-AND-REFClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155832832
Summary
--opsvalidation (tools/vrel_diff.py): checkargs.ops is not None(previously--ops ""silently ran all ops and--ops " , "crashed withIndexError), reject empty/trailing comma tokens, and deduplicate op tokens preserving order.compare()): reject mismatched lane counts (previouslygot == []silently returnedNoneas a false pass) and non-32-word lane payloads (previouslyIndexError).run_suite()): catch transientSkipwhen re-evaluating the shrunk program and fall back to the original mismatch detail.State,step(),rel(),events()): raiseRefErrorinstead ofIndexError/ValueError/TypeErroron empty tokens, wrong operand counts, non-integerv_writelane_b32lane indices, and uninitializedm0inevents().tests/test_vrel_diff.py): add 4 regression tests covering all of the above.Verification
python3 -W error -I tests/test_vrel_diff.py -v: 23 passed, 0 failed (2.569s).main: ran=23, failures=8, errors=11.python3 -m compileall -q tools/vrel_diff.py tests/test_vrel_diff.py,python3 -I tests/test_text_write_line_endings.py,python3 -I scripts/check_no_game_data.py: all pass.AI-assisted: yes
GPUs tested: none (CPU unit tests with
spirv_wave_interp; no game data)Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T07:26:58Z.
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-25T09:27:54Z.
Independent verification (Windows, Python 3.11.9
-I -W error):--opsgated onis not None(empty/blank/comma tokens now exit 2, order-preserving dedup), compare() lane/word-count guards replace IndexError/false-pass, transient Skip fallback in run_suite, RefError tightening across scalar/vreg/set_scalar/rel/events — all match claims.test_vrel_diff.py23 OK;--self-testcanaries ok; bad-CLI probes exit 2; compileall + line-endings + check_no_game_data clean. (Minor pre-existing nit: malformed internal rel line could ValueError in events(), unreachable from user input.) AI-assisted verification.Imported from ubiquitarianism/leonida. Originally posted by ShotTechOp on 2026-11-25T16:33:38Z.
Spotted one pre-existing bug in \ ools/vrel_diff.py's
el()\ while auditing the *_diff.py\ references: \dst = st.index(st.vreg(d) + do)\ runs unconditionally before \elif op == 'v_movrels_b32':, even though \_movrels_b32\ is in \WHOLE_M0\ (\do = so = m0) and only offsets the source VGPR, never the destination. So a valid \_movrels_b32 v25, v5\ with \m0 = 10\ raises \RefError: VGPR index 35 outside v0..v31\ instead of reading \15\ into \25. Worth moving \dst = st.index(st.vreg(d) + do)\ into the branches that actually offset \d\ (or setting \do = 0\ for \_movrels_b32).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:47:14Z.
Red/green:
pytest tests/test_vrel_diff.pyfails on main (19 failed, 19 passed, 8 subtests passed) and passes on head0f7b01b7cdmerged with main (23 passed, 23 subtests passed).Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
d48a957bbin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)