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

Manually merged
github merged 1 commit from gh-pr/111/head into gh-pr/111/base 2026-12-01 20:10:13 +00:00
Owner

@⁠Androtim on GitHub · 2026-11-29 11:40 UTC · original
Androtim:feat/iter112-gfx10-reject-oob-scalar-dest → main · +35 −2 · 1 files · 1 commits · merged 2026-11-29 12:06 UTC

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** on GitHub · 2026-11-29 11:40 UTC · [original](https://github.com/Androtim/MiniVI/pull/111) `Androtim:feat/iter112-gfx10-reject-oob-scalar-dest` → `main` · +35 −2 · 1 files · 1 commits · merged 2026-11-29 12:06 UTC ## 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`
Reject VOP3 compare and v_readlane_b32 / v_readfirstlane_b32 8-bit scalar destination encodings >= 128 during GFX10 decoding instead of treating them as parked scalar IDs later in IR unspilling.

Adapted from cool_fox commit 200319b9 (GPL-3.0).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:10:11 +00:00
github manually merged commit d91d8e7c93 into gh-pr/111/base 2026-12-01 20:10:13 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-11-29 12:03 UTC · original

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).

**@⁠Androtim** on GitHub · 2026-11-29 12:03 UTC · [original](https://github.com/Androtim/MiniVI/pull/111#issuecomment-7255539453) <!-- 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`)._
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!111
No description provided.