mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:15:51 +01:00
[PR #1913] wint_diff: model v_mbcnt/v_writelane operands and validate masks, pairs, op_sel, and arity (WINT-DIFF-REF-VALIDATION) #1922
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#1922
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/1913
Author: @ShotTechOp
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/wint-diff-ref-validation📝 Commits (1)
395bbc1wint_diff: model v_mbcnt/v_writelane operands and validate masks, pairs, op_sel, and arity (WINT-DIFF-REF-VALIDATION)📊 Changes
2 files changed (+226 additions, -38 deletions)
View changed files
📝
tests/test_wint_diff.py(+77 -0)📝
tools/wint_diff.py(+149 -38)📄 Description
Claimed in #1608 as
WINT-DIFF-REF-VALIDATION(https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7167118909).What and why
tools/wint_diff.py's whole-wave integer VALU reference interpreter had two semantic shortcuts and accepted malformed operands silently (or raised rawValueError/KeyError/IndexError/TypeErrorinstead ofRefError):v_mbcnt_lo_u32_b32/v_mbcnt_hi_u32_b32semantics (step): previously hardcoded to write[min(lane, 32)]/[v0 + max(0, lane - 32)]unconditionally intov0, ignoring the destination VGPR, bitmasksrc0, addendsrc1, andEXEC. Both now computepopcount(src0 & mask_below_lane) + src1into the named destination VGPR for active lanes only (cross-checked againstrdna2spirv.py).v_writelane_b32semantics (step): previously indexedv[args[0][1:]][int(args[2])] = st.sget(args[1]), rejecting inline constants (7), crashing on SGPR lane selectors (s5) or out-of-wave lane indices (32in wave32), and accepting SGPR destinations. It now evaluates scalar/immediatesrc0andsrc1, wraps lane selection modst.wave, and validates a VGPR destination.op_sel, and arity validation (State,step):s_mov_b32now rejects VGPR destinations/sources and wave32exec_hi.State.mask/State.set_maskenforce wave-matching mask operands (sN/vcc_loin wave32,s[N:N+1]/vccin wave64) and consecutive pairs.v_cmp_*/v_cmpx_*reject unknown compare predicates withRefErrorinstead ofKeyError.CARRYrequires 5 operands for_ci_forms and 4 otherwise (previously a missing carry-in silently defaulted to0).MAD64validates consecutive VGPR pairsv[N:N+1],OPS16validatesop_sellength (nsrc + 1), and all VGPR destinations reject non-VGPR tokens instead of stripping character 0.Verification (Windows 11 x64, Python 3.12.10, no GPU / no game data)
origin/mainb0f3d39)python -I tests/test_wint_diff.pytools/wint_diff.py(negative control)python -I tools/wint_diff.py --self-testpython -m compileall -q tools/wint_diff.py tests/test_wint_diff.pypython -I scripts/check_no_game_data.py tools/wint_diff.py tests/test_wint_diff.pygit diff --checkAI-assisted: yes. Synthetic unit tests only; no game data, no GPU required.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.