mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:35:53 +01:00
[PR #1809] wave_diff: validate cross-lane/mask operands, EXEC=0 dsts, DS offsets, and immutability (WAVE-DIFF-REF-VALIDATION) #1822
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1822
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1809
Author: @ShotTechOp
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/wave-diff-ref-validation📝 Commits (1)
30e5b8bwave_diff: validate cross-lane/mask operands, EXEC=0 dsts, DS offsets, and immutability (WAVE-DIFF-REF-VALIDATION)📊 Changes
2 files changed (+106 additions, -11 deletions)
View changed files
📝
tests/test_wave_diff.py(+53 -0)📝
tools/wave_diff.py(+53 -11)📄 Description
Summary
Claimed in #1608 as
WAVE-DIFF-REF-VALIDATION: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162135689Hardens
tools/wave_diff.py(WaveRef) so malformed or unsupported cross-lane and whole-mask operands raisecf_ref.Unsupportedinstead of silently reading the low register, flipping sign bits, skipping destination validation underEXEC == 0, raising unhandledValueError, or mutating the caller's parsed instruction dicts:abs/negmodifiers:_vsrc()requires a single VGPR (n == 1) with noabs/negmodifiers acrossv_readlane_b32,v_readfirstlane_b32,ds_bpermute_b32, andv_permlane16/x16_b32._scalar_int_src(),_lane_sel(),_count_src(), ands_not_b32/b64rejectabs/negmodifiers and unexpected instruction modifiers.EXEC == 0or referenced source lanes are off:_check_vgpr_dst()upfront inv_writelane_b32,ds_bpermute_b32, andv_permlane16/x16_b32so invalid destinations (s6,v[2:3]) cannot slip through when no lanes write.ds_bpermute_b32offset:modifiers:offset:modifiers, non-integer values (raisescf_ref.Unsupportedinstead ofValueError), and values outside the 16-bit unsigned DS offset range (0..65535).info["insns"]inWaveRef.__init__:enc/pcinstead of mutating caller-owned dicts in place.Independent of
#1780(tools/cf_ref.py); zero PR dependencies.Testing
Environment: Windows 11 x64, Python 3.12.10, CPU-only (no GPU or game files; based on
0d80bc5).main(0d80bc5):python -m unittest tests.test_wave_diff.Reference->FAILED (failures=24, errors=1)python -I tests/test_wave_diff.py-> 16/16 OK (including canaries and seeded wave32/wave64 fuzz runs)python -m compileall -q tools/wave_diff.py tests/test_wave_diff.py-> exit 0python -I scripts/check_no_game_data.py tools/wave_diff.py tests/test_wave_diff.py-> exit 0git diff --check-> cleanAI-assisted: yes (Antigravity). Synthetic inputs only; no game data.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.