Shaders: VOP1 no-source ops stay one dword #473

Open
davutsimsekk wants to merge 1 commit from upstream-pr/473 into main
davutsimsekk commented 2026-11-25 01:20:37 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by davutsimsekk on 2026-11-25T01:20:37Z.


v_nop, v_pipeflush and v_clrexcp take no source, but the VOP1 decoder treated the 9-bit field as a source and added a literal/SDWA/DPP extension word whenever it matched 0xFF, 0xF9, 0xFA, 0xE9 or 0xEA. The field is a shader hash there (see fields.rs), so such a hash made the decoder consume the next instruction as an extension and misalign or fail.

These three opcodes are now always one dword; every other VOP1 is unchanged.

Test

vop1_without_operands_has_no_extension_word decodes v_nop and v_pipeflush with hash-like low bits and checks the next instruction is still s_endpgm at offset 4. On main decoding fails.

  • cargo test -p victory-shader --lib vop1_without_operands_has_no_extension_word: 1 passed
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean
  • rustfmt --edition 2024 --check crates/victory-shader/src/gfx10/mod.rs: clean
  • No game data or GPU was used.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6594915981 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/473). Originally posted by [davutsimsekk](https://github.com/davutsimsekk) on 2026-11-25T01:20:37Z. --- `v_nop`, `v_pipeflush` and `v_clrexcp` take no source, but the VOP1 decoder treated the 9-bit field as a source and added a literal/SDWA/DPP extension word whenever it matched `0xFF`, `0xF9`, `0xFA`, `0xE9` or `0xEA`. The field is a shader hash there (see `fields.rs`), so such a hash made the decoder consume the next instruction as an extension and misalign or fail. These three opcodes are now always one dword; every other VOP1 is unchanged. ## Test `vop1_without_operands_has_no_extension_word` decodes `v_nop` and `v_pipeflush` with hash-like low bits and checks the next instruction is still `s_endpgm` at offset 4. On `main` decoding fails. - `cargo test -p victory-shader --lib vop1_without_operands_has_no_extension_word`: 1 passed - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: clean - `rustfmt --edition 2024 --check crates/victory-shader/src/gfx10/mod.rs`: clean - No game data or GPU was used.
avt0m4t48 commented 2026-11-25 02:10:09 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T01:41:02Z.


I independently verified e98e7f29352c12156a756eb1b4a59fb035b55ca3 against its merge base a803c87c48078e57b296e06e08146d7ceca44530 using synthetic instruction words and separate Cargo target directories.

  • I swept all 512 low-field values for each of v_nop, v_pipeflush, and v_clrexcp, followed by s_endpgm. The base failed in exactly 15 cases (all three opcodes with each of the five extension markers). The PR head decoded all 1,536 cases as a one-dword VOP1 followed by s_endpgm at byte offset 4.
  • As controls, ordinary v_mov_b32 kept its extension and placed s_endpgm at byte offset 8 for all five markers on both commits. The register-source control placed it at offset 4 on both.
  • The head's Linux shader unit suite reported 172 passed and 2 ignored. The two independent fixture tests passed. cargo check --locked -p victory-shader --tests --target x86_64-pc-windows-msvc also passed. Runtime verification used Linux.
<!-- greyfinch-sync:fxceless/victory-fork:comment:7149834306 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/473#issuecomment-7149834306). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T01:41:02Z. --- I independently verified `e98e7f29352c12156a756eb1b4a59fb035b55ca3` against its merge base `a803c87c48078e57b296e06e08146d7ceca44530` using synthetic instruction words and separate Cargo target directories. - I swept all 512 low-field values for each of `v_nop`, `v_pipeflush`, and `v_clrexcp`, followed by `s_endpgm`. The base failed in exactly 15 cases (all three opcodes with each of the five extension markers). The PR head decoded all 1,536 cases as a one-dword VOP1 followed by `s_endpgm` at byte offset 4. - As controls, ordinary `v_mov_b32` kept its extension and placed `s_endpgm` at byte offset 8 for all five markers on both commits. The register-source control placed it at offset 4 on both. - The head's Linux shader unit suite reported 172 passed and 2 ignored. The two independent fixture tests passed. `cargo check --locked -p victory-shader --tests --target x86_64-pc-windows-msvc` also passed. Runtime verification used Linux.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/473:upstream-pr/473'
git switch 'upstream-pr/473'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/473'
git switch 'upstream-pr/473'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/473'
git switch 'upstream-pr/473'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/473'
git switch 'main'
git merge --squash 'upstream-pr/473'
git switch 'main'
git merge --ff-only 'upstream-pr/473'
git switch 'main'
git merge 'upstream-pr/473'
git push origin 'main'
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
fxceless/victory-fork!473
No description provided.