shader(gfx10): reject out-of-range VALU scalar destinations at decode #111

Merged
Androtim merged 1 commit from upstream-pr/111 into main 2026-11-29 12:06:42 +00:00
Androtim commented 2026-11-29 11:40:13 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T11:40:13Z.


Summary

  • Reject out-of-range (>= 128) 8-bit scalar destinations on VOP3 compares and v_readlane_b32 / v_readfirstlane_b32 during GFX10 instruction decoding in crates/victory-shader/src/gfx10/mod.rs.
  • Add a_scalar_destination_past_the_registers_is_refused unit test covering both VOP3 compare and VOP1 v_readfirstlane_b32 encodings.
  • Adapted from cool_fox commit 200319b9 (GPL-3.0).

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy -> asset policy: 303 files ok
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib --locked -- gfx10:: -> 17 passed; 0 failed
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings -> 0 warnings
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings -> 0 warnings
<!-- greyfinch-sync:Androtim/MiniVI:issue:5550343744 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/111). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T11:40:13Z. --- ## Summary - Reject out-of-range (`>= 128`) 8-bit scalar destinations on `VOP3` compares and `v_readlane_b32` / `v_readfirstlane_b32` during GFX10 instruction decoding in `crates/victory-shader/src/gfx10/mod.rs`. - Add `a_scalar_destination_past_the_registers_is_refused` unit test covering both `VOP3` compare and `VOP1` `v_readfirstlane_b32` encodings. - Adapted from `cool_fox` commit `200319b9` (GPL-3.0). ## Verification - `cargo +1.98.1-x86_64-pc-windows-gnu xtask policy` -> `asset policy: 303 files ok` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib --locked -- gfx10::` -> `17 passed; 0 failed` - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings` -> `0 warnings` - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings` -> `0 warnings`
Androtim commented 2026-11-29 12:03:49 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T12:03:49Z.


Automated triage for the maintainers (not an approval).

Verdict: merge-candidate · CI (check): passing

Review Summary

Looks clean and well-scoped.

  • Decoder invariant enforced: In crates/victory-shader/src/gfx10/mod.rs, instruction() now rejects 8-bit VALU scalar destinations >= 128 via scalar_destination_past_registers() for Encoding::Vop3 compares (opcode < 0x100) and v_readlane_b32 / v_readfirstlane_b32 (w0 & 0xFF), as well as Encoding::Vop1 v_readfirstlane_b32 ((w0 >> 17) & 0xFF).
  • Matches IR contract: Aligns the decoder with Operand::Scalar in crates/victory-shader/src/gfx10/fields.rs, which reserves codes 0..=127 for machine scalar registers and 128.. for IR parked scalars (crate::ir::PARKED). (VOP3B carry-out sdst is already 7-bit, so it cannot exceed 127.)
  • Tests & CI: The new a_scalar_destination_past_the_registers_is_refused test covers both VOP3 compare (v_cmp_tru_f16 dst 133 vs 106/VCC) and VOP1 (v_readfirstlane_b32 dst 128 vs s16) encodings, and CI is passing.

No blocking issues found; ready for maintainer merge.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7255539453 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/111#issuecomment-7255539453). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-29T12:03:49Z. --- <!-- minivi-triage v1 head=d91d8e7c93e40e2eb503cda8667df5a94903f86d verdict=merge-candidate ci=passing at=2026-11-29T12:04:22Z --> Automated triage for the maintainers (not an approval). **Verdict:** `merge-candidate` · **CI (`check`):** `passing` ### Review Summary Looks clean and well-scoped. - **Decoder invariant enforced**: In `crates/victory-shader/src/gfx10/mod.rs`, `instruction()` now rejects 8-bit VALU scalar destinations `>= 128` via `scalar_destination_past_registers()` for `Encoding::Vop3` compares (`opcode < 0x100`) and `v_readlane_b32` / `v_readfirstlane_b32` (`w0 & 0xFF`), as well as `Encoding::Vop1` `v_readfirstlane_b32` (`(w0 >> 17) & 0xFF`). - **Matches IR contract**: Aligns the decoder with `Operand::Scalar` in `crates/victory-shader/src/gfx10/fields.rs`, which reserves codes `0..=127` for machine scalar registers and `128..` for IR parked scalars (`crate::ir::PARKED`). (VOP3B carry-out `sdst` is already 7-bit, so it cannot exceed 127.) - **Tests & CI**: The new `a_scalar_destination_past_the_registers_is_refused` test covers both VOP3 compare (`v_cmp_tru_f16` dst `133` vs `106`/VCC) and VOP1 (`v_readfirstlane_b32` dst `128` vs `s16`) encodings, and CI is passing. No blocking issues found; ready for maintainer merge. --- _Generated with Antigravity CLI (`agy`)._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Androtim/MiniVI!111
No description provided.