fix: the Rust RDNA 2 interpreter refuses a register group past v255 instead of aborting #437
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/437"
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 LooperSalty/AnyXboxX. Originally posted by Luke-Ervin on 2026-11-26T18:46:47Z.
Change
The Rust reference interpreter (
crates/anyxboxx-rdna2-ref) now returns its operand error when a VGPR group runs past v255, instead of aborting.A 64-bit vector result is written to
vdst,vdst + 1; withvdst = 255there is no second register. Five places indexedwave.vfor such a group without checking where it ends, and the binary aborted (index out of bounds: the len is 256 but the index is 256; the release profile aborts on panic):wide.rsdiv.rsv_div_scale/fmas/fixup_f64vop3_forms.rsv_mad_u64_u32(v_mad_i64_i32shares the code but is refused earlier in both models, for its signed carry)sad.rs(×2)v_qsad_pk_u16_u8,v_mqsad_pk_u16_u8; 128-bit result and 128-bit source S2 ofv_mqsad_u32_u8(four registers, from v253)The crate already answers this case on the source side:
compare::read64returnsError::Operandfor a 64-bit source pair at v255, and the memory, image, typed-buffer and LDS code check their groups the same way. These five sites were missing the check.Wave::vgpr_group(first, count)returnsfirstwhen thecountregisters exist,Error::Operandotherwise.read64, the check is inside the lane loop: with no active lane the instruction still does nothing and succeeds. Programs that ran before run exactly as they did; only the aborts change.Left open, for the maintainers: the Python model raises
IndexErrorin all of these cases (an uncaught list index, after writing the low half of the result in the first active lane), which the parity harness does not turn into an error line, so the two models cannot be compared on these programs yet. Whether the Python should raiseUntranslatedthere, with the Rust following, is not decided here. The new test states the current pairing (error operand/IndexError) explicitly, and is named for what it checks (..._is_an_operand_error_in_rust), so a later change has to update it on purpose.docs/rust-full-status.mdanddocs/fr/rust-full-status.mdrecord the finding. No README row or test-count change (1904 collected, still1900+).Linked issue: none.
Verification
Run on Linux (Ubuntu, Python 3.13, Rust 1.98.1), on top of
mainatf088a43, and again merged with the newestmain(74dfb48) and with #402 and #403 (1458 passed, 449 skipped), withanyxboxx-rdna2-refandanyxboxx-pebuilt bycargo build --release -p anyxboxx-rdna2-ref -p anyxboxx-pe:Reproduction before the fix (input to
anyxboxx-rdna2-ref):lanes 32,scc 0,primitive 0,program D70100FF 02020481 BF810000(v_ashrrev_i64 v[255:256], 1, v[2:3]). The process aborted atwide.rs:251; it now printserror operand.Not run (the 449 skipped tests): everything that needs Windows, the C++ runtime,
dxcor a GPU, and the Rust crates that only build for Windows;cargo test --workspacefor the same reason. No Windows machine was available. The change is bounds checking on aVec. No game was run.Oracle and test data
v_ashrrev_i64withvdst = 255). The generator's VOP3 encoder keepsvdstbelow 255 only for names ending in_f64, so the 64-bit shifts, the VOP3 forms ofv_cvt_f64_*and the SAD forms can still be drawn with a destination group past v255; the 300 seeded programs happen not to.assert_same. For the refused cases there is no shared error line yet (see "Left open").test_a_register_group_past_v255_is_an_operand_error_in_rustfails on the old binary, whose process aborts. It runs 15 programs across the five sites: eleven 64-bit results (nine VOP3, two VOP1), the 128-bit result ofv_mqsad_u32_u8, the 64-bit S2 pair of the two packed SAD forms and the 128-bit S2 ofv_mqsad_u32_u8. The source registers are filled first with values that differ by lane and register, so the programs that fit write non-zero results that both models must agree on. Rust unit tests:a_register_group_must_end_at_v255(wave.rs) anda_64_bit_result_at_v255_is_refused_without_mutation(wide.rs).Checklist
E_NOTIMPL), never a fake success.test_readme_sync.pychecks it). No README change needed.This change was made with AI assistance (Claude Code): the bug was found, fixed and tested by the AI as described above. It was not tested on Windows.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CVSn4bUDfLBFvceKVLPSX5
Imported from LooperSalty/AnyXboxX. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T18:47:00Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
2c116aeℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.