Shaders: decode and lower v_dot8_i32_i4 #184

Open
github-bot wants to merge 1 commit from github-bot/gh-184 into main AGit
Owner

@⁠lcg007xd-c on GitHub · 2026-11-25 20:16 UTC · original
lcg007xd-c:shader/v-dot8-i32-i4 → main · +9 −4 · 5 files · 1 commits · open

What this fixes

VOP3P opcode 0x18, v_dot8_i32_i4, is missing from gfx10/opcodes.rs. 0x16, 0x17 and 0x19 are all there, so any program using it fails at decode. AMD's RDNA2 ISA lists it, and so does LLVM's llvm-mc --disassemble -mcpu=gfx1030, which I used to cross-check the table.

The change

  • Opcode table: adds (0x018, "v_dot8_i32_i4").
  • integer_dot: already takes the field width (v_dot8 → 4) and signedness (_i32) from the name, so it only needed the name added to its dispatch. Clamp saturates in 64 bits, as it does for the other signed forms.
  • The older lowering arm: maps v_dot8_i32_i4 to (4, true) explicitly. Otherwise it would fall into _ => (4, false) and be treated as unsigned.

Tests

  • packing_dot_and_ldexp_instructions_translate (runs on every host) now covers the new opcode. It passes with the change and fails with the table entry removed.
  • opcode_tests::packed_integer_dot_products and valu_tests::v_dot_products_of_packed_fields (Windows/GPU) get the new opcode as a row in their tables, with the same signed model the other signed rows use.

Run here (Linux, Rust 1.98.1):

  • cargo test -p victory-shader --lib: 185 passed, 0 failed, 6 ignored. That includes refused_opcodes, which now audits this opcode as well.
  • cargo clippy --target x86_64-pc-windows-msvc: reports the same 12 findings as main, and nothing new from this change.

Not run here: the GPU tests, since I have no Windows machine.

The same fix is open upstream as Marvisak/VIctory#2768, where Windows CI passed.

🤖 Generated with Claude Code

**@⁠lcg007xd-c** on GitHub · 2026-11-25 20:16 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/184) `lcg007xd-c:shader/v-dot8-i32-i4` → `main` · +9 −4 · 5 files · 1 commits · open ## What this fixes VOP3P opcode **0x18, `v_dot8_i32_i4`**, is missing from `gfx10/opcodes.rs`. 0x16, 0x17 and 0x19 are all there, so any program using it fails at decode. AMD's RDNA2 ISA lists it, and so does LLVM's `llvm-mc --disassemble -mcpu=gfx1030`, which I used to cross-check the table. ## The change - **Opcode table:** adds `(0x018, "v_dot8_i32_i4")`. - **`integer_dot`:** already takes the field width (`v_dot8` → 4) and signedness (`_i32`) from the name, so it only needed the name added to its dispatch. Clamp saturates in 64 bits, as it does for the other signed forms. - **The older lowering arm:** maps `v_dot8_i32_i4` to `(4, true)` explicitly. Otherwise it would fall into `_ => (4, false)` and be treated as unsigned. ## Tests - **`packing_dot_and_ldexp_instructions_translate`** (runs on every host) now covers the new opcode. It passes with the change and fails with the table entry removed. - **`opcode_tests::packed_integer_dot_products`** and **`valu_tests::v_dot_products_of_packed_fields`** (Windows/GPU) get the new opcode as a row in their tables, with the same signed model the other signed rows use. **Run here** (Linux, Rust 1.98.1): - `cargo test -p victory-shader --lib`: 185 passed, 0 failed, 6 ignored. That includes `refused_opcodes`, which now audits this opcode as well. - `cargo clippy --target x86_64-pc-windows-msvc`: reports the same 12 findings as `main`, and nothing new from this change. **Not run here:** the GPU tests, since I have no Windows machine. The same fix is open upstream as Marvisak/VIctory#2768, where Windows CI passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
VOP3P 0x18 was missing from the opcode table (0x16, 0x17 and 0x19 are
there; AMD's RDNA2 ISA and LLVM's gfx1030 disassembler list it), so a
program using it failed to decode. integer_dot already takes its width and
signedness from the name; the older arm maps it to (4, signed) explicitly.
Added to the translation test and both GPU dot-product tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:29 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-26 05:00 UTC · original

RDNA2 data point. This PR (01f7c0f) merged on main 4f62c2a, cargo test --release -p victory-shader --lib on an RX 6950 XT (Windows 11 build 26300, Rust 1.98.1):

  • main: 275 passed, 2 failed.
  • This PR: 275 passed, 2 failed: the same count as main, so no new lib test of victory-shader ran here.

The 2 failures are the same as on main: the RDNA2 wave-size tests scalar_counted_in_a_divergent_loop_read_after_it and scalar_counted_in_nested_divergent_loops, fixed by #110 and #204. No regression here. One run ended without a result line, which this test binary does now and then on this machine, on main too. Not run in the game.

harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-26 05:00 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/184#issuecomment-7183094495) RDNA2 data point. This PR (`01f7c0f`) merged on `main` `4f62c2a`, `cargo test --release -p victory-shader --lib` on an RX 6950 XT (Windows 11 build 26300, Rust 1.98.1): - `main`: 275 passed, 2 failed. - This PR: 275 passed, 2 failed: the same count as `main`, so no new lib test of `victory-shader` ran here. The 2 failures are the same as on `main`: the RDNA2 wave-size tests `scalar_counted_in_a_divergent_loop_read_after_it` and `scalar_counted_in_nested_divergent_loops`, fixed by #110 and #204. No regression here. One run ended without a result line, which this test binary does now and then on this machine, on `main` too. Not run in the game. harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300 AI-assisted (Claude Code); no game data.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:42 UTC · original

Tested on Windows 11 with an RX 7900 XT (RDNA3, driver 32.0.32029.2010), Rust 1.98.1. The PR is based on 000ffdd. I tested the head (01f7c0f) and also the diff applied on current main (4f62c2a). It applies cleanly there.

GPU tests (they run natively here):

  • cargo test -p victory-shader --lib -- --test-threads=1 on 4f62c2a + this PR: 277 passed, 0 failed, 6 ignored. That is the same count as 4f62c2a alone. The head itself gives 266 / 0 / 6.
  • valu_tests::v_dot_products_of_packed_fields passes on both the hardware adapter and WARP.
  • opcode_tests::packed_integer_dot_products passes on the hardware adapter, including the clamp rows for the new opcode.
  • With only the test changes applied to 4f62c2a, all three touched tests fail. packing_dot_and_ldexp_instructions_translate and v_dot_products_of_packed_fields fail with "unknown opcode". packed_integer_dot_products fails at the opcode-name lookup.

Game corpus (whole shaders.rpf, translate --validate --host-lanes 32-64):

  • Same counts as main: 26084 programs translated, the same IR instruction total, VS/PS 14247/14247, CS 2682/2682 and MS 8694/8765 validated, and the same refusals.
  • 0 of 25623 per-program DXIL hashes change. That holds for the head against 000ffdd and for 4f62c2a + PR against 4f62c2a.
  • shader-info --disasm with this build finds no v_dot* instruction of any kind in this title (0 of about 44.4M decoded instructions) and no unnamed opcodes. So the change has no effect on this corpus, and this corpus does not exercise the new path.

Not tested: native execution of v_dot8_i32_i4 on RDNA2 hardware to compare against the test model, other host lane configurations, and clippy.

**@⁠adrianmjim** on GitHub · 2026-11-26 19:42 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/184#issuecomment-7201872343) Tested on Windows 11 with an RX 7900 XT (RDNA3, driver 32.0.32029.2010), Rust 1.98.1. The PR is based on 000ffdd. I tested the head (01f7c0f) and also the diff applied on current main (4f62c2a). It applies cleanly there. GPU tests (they run natively here): - `cargo test -p victory-shader --lib -- --test-threads=1` on 4f62c2a + this PR: 277 passed, 0 failed, 6 ignored. That is the same count as 4f62c2a alone. The head itself gives 266 / 0 / 6. - `valu_tests::v_dot_products_of_packed_fields` passes on both the hardware adapter and WARP. - `opcode_tests::packed_integer_dot_products` passes on the hardware adapter, including the clamp rows for the new opcode. - With only the test changes applied to 4f62c2a, all three touched tests fail. `packing_dot_and_ldexp_instructions_translate` and `v_dot_products_of_packed_fields` fail with "unknown opcode". `packed_integer_dot_products` fails at the opcode-name lookup. Game corpus (whole shaders.rpf, `translate --validate --host-lanes 32-64`): - Same counts as main: 26084 programs translated, the same IR instruction total, VS/PS 14247/14247, CS 2682/2682 and MS 8694/8765 validated, and the same refusals. - 0 of 25623 per-program DXIL hashes change. That holds for the head against 000ffdd and for 4f62c2a + PR against 4f62c2a. - `shader-info --disasm` with this build finds no `v_dot*` instruction of any kind in this title (0 of about 44.4M decoded instructions) and no unnamed opcodes. So the change has no effect on this corpus, and this corpus does not exercise the new path. Not tested: native execution of `v_dot8_i32_i4` on RDNA2 hardware to compare against the test model, other host lane configurations, and clippy.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/184/head:github-bot/gh-184'
git switch 'github-bot/gh-184'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-184'
git switch 'github-bot/gh-184'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-184'
git switch 'github-bot/gh-184'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-184'
git switch 'main'
git merge --squash 'github-bot/gh-184'
git switch 'main'
git merge --ff-only 'github-bot/gh-184'
git switch 'main'
git merge 'github-bot/gh-184'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.