ir::build: a scalar code past the registers is not an index past unspill's table #325
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/325"
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 avatarmanz/VIctory-7900XTX. Originally posted by illuminatedfellow on 2026-11-26T16:52:14Z.
ir::build→unspillmarks the scalar codes a program uses inused: [bool; 128], but an instruction's effects can name a scalar code up to 255 — e.g. a VOP3-encoded compare whosesdstfield holds a constant's code (0xD4C5A8D7: sdst 215). That panics with index out of bounds (ir.rs:336) instead of returning a translation error, and a panic during translation takes the process down.usedis now 256 wide, likestoresandothernext to it; with that, these programs come back as ordinary errors.How it was found: fuzzing the whole translation on Linux — mutated instruction arrays from the crate's own tests plus random words, run through
ir::build,structure,resource::track,io::raiseandlowerwith overflow checks on. About 1,400 of 3,000,000 programs hit this one; it was the only panic class without an open fix. With this change and #308, 800,000 further programs ran without a panic.Test:
scalar_codes_past_the_registers_do_not_panic(three of the smallest crashing programs, each with av_writelane_b32so the parking search runs). It fails without the change (ir.rs:336) and passes with it;cargo test -p victory-shader210 passed on Linux.Relation to #268: #268 returns early from
unspillwhen nothing is parked, which hides the three bare programs but not ones that park a scalar — with #268 alone the test still panics (ir.rs:341). The two changes don't overlap textually.The other panic class the fuzzer found (
debug_assert!(self.s.threads.is_none() || self.console_lanes)incross_lane, fromv_cndmask_b32on a numeric lane mask) is fixed by #308 — noted there.(Written with Claude Opus 5.5.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.