Shaders: lower v_mad_u32_u16, v_mad_i32_i16, and v_lerp_u8 #1688

Open
github-bot wants to merge 2 commits from github-bot/gh-1688 into main AGit
Owner

@⁠Calvix2k on GitHub · 2026-11-24 20:46 UTC · original
Calvix2k:codex/shader-mad16-lerp-1068 → main · +153 −0 · 1 files · 2 commits · open

Implements #1068.

Ports the verified branch from @⁠kilvynsilveira-tech's fork (commit 5319a34 by Kilvy Nog), applied unchanged onto ffe310e; the commit keeps its original author.

Summary

Lower::integer refused three RDNA2 integer VALU instructions:

  • v_mad_u32_u16 and v_mad_i32_i16 (16x16 → 32 multiply-add), including opsel low/high 16-bit selection for src0 and src1.
  • v_lerp_u8: the packed 4x8-bit rounded average, (a[i] + b[i] + (c[i] & 1)) >> 1, with src2 supplying the rounding bits.

Synthetic unit test mad_32_16_and_lerp_u8_lower_and_validate covers all three, including the opsel high halves, and validates the emitted DXIL with dxil.dll.

Validation

  • cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests — passed (103 tests, 1 ignored).
  • cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings — passed.
  • cargo xtask policy — passed (154 files).
  • The new test itself was run by the author with dxil.dll validation: passed.
**@⁠Calvix2k** on GitHub · 2026-11-24 20:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/1688) `Calvix2k:codex/shader-mad16-lerp-1068` → `main` · +153 −0 · 1 files · 2 commits · open Implements #1068. Ports the verified branch from [@⁠kilvynsilveira-tech's fork](https://github.com/kilvynsilveira-tech/VIctory/tree/shader/lerp-and-mad16-u32) (commit 5319a34 by Kilvy Nog), applied unchanged onto `ffe310e`; the commit keeps its original author. ## Summary `Lower::integer` refused three RDNA2 integer VALU instructions: - `v_mad_u32_u16` and `v_mad_i32_i16` (16x16 → 32 multiply-add), including `opsel` low/high 16-bit selection for `src0` and `src1`. - `v_lerp_u8`: the packed 4x8-bit rounded average, `(a[i] + b[i] + (c[i] & 1)) >> 1`, with `src2` supplying the rounding bits. Synthetic unit test `mad_32_16_and_lerp_u8_lower_and_validate` covers all three, including the `opsel` high halves, and validates the emitted DXIL with `dxil.dll`. ## Validation - `cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests` — passed (103 tests, 1 ignored). - `cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings` — passed. - `cargo xtask policy` — passed (154 files). - The new test itself was run by the author with `dxil.dll` validation: passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:41:37 +00:00
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 22:15 UTC · original

Rebased onto 70564ae; only the test module conflicted (upstream added the packed-half parameter test). Both tests are kept. mad_32_16_and_lerp_u8_lower_and_validate passes and cargo check -p victory-shader --tests is clean.

**@⁠Calvix2k** on GitHub · 2026-11-24 22:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/1688#issuecomment-7146010689) Rebased onto 70564ae; only the test module conflicted (upstream added the packed-half parameter test). Both tests are kept. mad_32_16_and_lerp_u8_lower_and_validate passes and cargo check -p victory-shader --tests is clean.
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 22:52 UTC · original

NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, c7242f1 (on main 70564ae). mad_32_16_and_lerp_u8_lower_and_validate passes on the hardware adapter.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-24 22:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1688#issuecomment-7146736104) NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, `c7242f1` (on `main` `70564ae`). `mad_32_16_and_lerp_u8_lower_and_validate` passes on the hardware adapter. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:33 UTC · original · edited 2026-11-25 22:24 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: main has moved since the last triage, and the branch now conflicts in crates/victory-shader/src/emit/lower.rs. It will be reviewed again once it is rebased onto current main.

Previous verdict for this head: merge candidate.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/1688#issuecomment-7152032439) · edited 2026-11-25 22:24 UTC <!-- victory-triage v1 head=37be9623705c7c4dfec9d2330ef703888384a005 verdict=needs-rebase at=2026-11-25T22:28:00Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main`: `main` has moved since the last triage, and the branch now conflicts in `crates/victory-shader/src/emit/lower.rs`. It will be reviewed again once it is rebased onto current `main`. Previous verdict for this head: merge candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠StExpeditus on GitHub · 2026-11-25 09:04 UTC · original

Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at 37be962. cargo test --workspace --locked --no-fail-fast -> 697 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.

**@⁠StExpeditus** on GitHub · 2026-11-25 09:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/1688#issuecomment-7157844646) **Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24.** Branch at `37be962`. `cargo test --workspace --locked --no-fail-fast` -> 697 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 16:39 UTC · original

Thanks — the same five NVIDIA heap-cap failures as on main, and nothing from this PR. Noted on the record.

**@⁠Calvix2k** on GitHub · 2026-11-25 16:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/1688#issuecomment-7168325247) Thanks — the same five NVIDIA heap-cap failures as on `main`, and nothing from this PR. Noted on the record.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 21:40 UTC · original · approved these changes

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 97 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.

v_mad_u32_u16/v_mad_i32_i16/v_lerp_u8 lowered; mad_32_16_and_lerp_u8_lower_and_validate checks the DXIL container hash against the reference.

**@⁠catminou4** on GitHub · 2026-11-24 21:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1688#pullrequestreview-6047848695) · **approved these changes** Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 97 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests. v_mad_u32_u16/v_mad_i32_i16/v_lerp_u8 lowered; mad_32_16_and_lerp_u8_lower_and_validate checks the DXIL container hash against the reference.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-26 13:53 UTC · original

Rebased. Dropped our duplicate validate helper (upstream added the same one in the same place) and kept upstream's ds_bpermute test plus ours.

**@⁠Calvix2k** on GitHub · 2026-11-26 13:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/1688#issuecomment-7193975355) Rebased. Dropped our duplicate `validate` helper (upstream added the same one in the same place) and kept upstream's `ds_bpermute` test plus ours.
github-bot force-pushed github-bot/gh-1688 from 37be962370 to 8c6ff387e5 2026-11-26 13:59:36 +00:00 Compare
This pull request can be merged automatically.
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/1688/head:github-bot/gh-1688'
git switch 'github-bot/gh-1688'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1688'
git switch 'github-bot/gh-1688'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1688'
git switch 'github-bot/gh-1688'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1688'
git switch 'main'
git merge --squash 'github-bot/gh-1688'
git switch 'main'
git merge --ff-only 'github-bot/gh-1688'
git switch 'main'
git merge 'github-bot/gh-1688'
git push origin 'main'
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/Marvisak--VIctory!1688
No description provided.