Shaders: validate raw fixtures and signed MAD64 with full-word regression #2774

Open
github-bot wants to merge 3 commits from github-bot/gh-2774 into main AGit
Owner

@⁠LogicGrove on GitHub · 2026-11-25 20:13 UTC · original
LogicGrove:validation/nvidia-raw-fixtures-mad64 → main · +78 −3 · 4 files · 3 commits · open

Summary

On RTX 2060, the existing stride/gather fixtures fail because they bind structured views for raw loads. Separately, a negative literal in v_mad_i64_i32 loses its sign. This integrates the small corrections from #2357 (LICObr) and #2254 (BastienRodz), preserving their authors in separate commits, and adds an independent CPU-oracle regression covering both result words.

raw fixtures (#2357) + signed literal extension (#2254)
    -> both-word readback compared with i128/u128 CPU arithmetic

Our additional test covers six dynamic input pairs, three literal bit patterns, signed/unsigned variants, and both 32-bit words: 72 word comparisons per backend. No game files, extracted shaders, console SDK, or proprietary fixtures were used. This changes neither heap limits nor carry-out handling.

This is an integration/validation PR, not a claim to have authored the existing fixes. If the original PRs are preferred, the final commit can be cherry-picked onto #2254 independently.

Evidence

Windows 11 Home build 26200, RTX 2060 6 GB, NVIDIA driver 610.88, Rust 1.98.1 MSVC. Base: 13f91ca.

  • Before #2357: all five previously observed NVIDIA failures reproduce.
    After #2357 alone: a_heap_buffer_read_by_element_takes_the_views_stride and gathers_at_a_level_match_the_hardware pass. The two GPU heap tests and the null-buffer-view shader test still fail.
  • Before #2254: its original regression and the new mad_literal_addends_match_cpu_in_both_words fail on hardware: the high word of 0 * 0 - 100 is 0, expected 0xffffffff.
    After: both regressions pass in debug and release. The fixture corrections also pass targeted release runs. The shader harness loops over hardware and WARP; no backend-skipped messages appeared in these successful targeted runs.
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: pass.
  • cargo xtask policy: pass. git diff --check: pass. Added regression formatted with rustfmt.

Full workspace run completed (exit 101): victory-gpu: 193 passed, 2 failed, 1 ignored; victory-shader: 271 passed, 1 failed, 3 ignored. Remaining failures: descriptor::host::tests::dynamic_slots_are_held_until_released; memory::tests::lists_share_a_table_and_copies_keep_their_views; emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros. All three were reproduced before this PR. No additional failure names appeared.

The local full-workspace run also includes the previously validated loader tests/reference fix from #2418, which are not included in this shader-only PR. The four shader files in this PR match those tested locally. No FPS or game-playability claim is made.

AI use: Codex assisted with independent reproduction, the additional CPU-oracle test, validation, and this description. Reused changes are credited above.

Merge Danger

Door: Two-way; revert the commits to restore prior behavior.

Blast Radius: Shaders. The production change affects signed MAD literal extension; other changes are synthetic test fixtures and regression coverage. The remaining NVIDIA heap failures are not fixed here.

**@⁠LogicGrove** on GitHub · 2026-11-25 20:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2774) `LogicGrove:validation/nvidia-raw-fixtures-mad64` → `main` · +78 −3 · 4 files · 3 commits · open ## Summary On RTX 2060, the existing stride/gather fixtures fail because they bind structured views for raw loads. Separately, a negative literal in `v_mad_i64_i32` loses its sign. This integrates the small corrections from #2357 (LICObr) and #2254 (BastienRodz), preserving their authors in separate commits, and adds an independent CPU-oracle regression covering both result words. ```text raw fixtures (#2357) + signed literal extension (#2254) -> both-word readback compared with i128/u128 CPU arithmetic ``` Our additional test covers six dynamic input pairs, three literal bit patterns, signed/unsigned variants, and both 32-bit words: 72 word comparisons per backend. No game files, extracted shaders, console SDK, or proprietary fixtures were used. This changes neither heap limits nor carry-out handling. This is an integration/validation PR, not a claim to have authored the existing fixes. If the original PRs are preferred, the final commit can be cherry-picked onto #2254 independently. ## Evidence Windows 11 Home build 26200, RTX 2060 6 GB, NVIDIA driver 610.88, Rust 1.98.1 MSVC. Base: `13f91ca`. - **Before #2357:** all five previously observed NVIDIA failures reproduce. **After #2357 alone:** `a_heap_buffer_read_by_element_takes_the_views_stride` and `gathers_at_a_level_match_the_hardware` pass. The two GPU heap tests and the null-buffer-view shader test still fail. - **Before #2254:** its original regression and the new `mad_literal_addends_match_cpu_in_both_words` fail on hardware: the high word of `0 * 0 - 100` is `0`, expected `0xffffffff`. **After:** both regressions pass in debug and release. The fixture corrections also pass targeted release runs. The shader harness loops over hardware and WARP; no backend-skipped messages appeared in these successful targeted runs. - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: pass. - `cargo xtask policy`: pass. `git diff --check`: pass. Added regression formatted with rustfmt. Full workspace run completed (exit 101): victory-gpu: 193 passed, 2 failed, 1 ignored; victory-shader: 271 passed, 1 failed, 3 ignored. Remaining failures: descriptor::host::tests::dynamic_slots_are_held_until_released; memory::tests::lists_share_a_table_and_copies_keep_their_views; emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros. All three were reproduced before this PR. No additional failure names appeared. The local full-workspace run also includes the previously validated loader tests/reference fix from #2418, which are not included in this shader-only PR. The four shader files in this PR match those tested locally. No FPS or game-playability claim is made. AI use: Codex assisted with independent reproduction, the additional CPU-oracle test, validation, and this description. Reused changes are credited above. ## Merge Danger **Door:** Two-way; revert the commits to restore prior behavior. **Blast Radius:** Shaders. The production change affects signed MAD literal extension; other changes are synthetic test fixtures and regression coverage. The remaining NVIDIA heap failures are not fixed here.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:56 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 20:36 UTC · original

Independent verification of head cca9102f (WARP/CPU): looks good.

  • Diff: v_mad_i64_i32 now sign-extends its 32-bit literal addend (v_mad_u64_u32 still zero-extends, per the new test), plus two fixtures changed from structured to raw buffer views. The change is small and in scope.
  • Tests: victory-shader --lib 269 pass, 3 fail. The same 3 fail on origin/main (WARP has no 32-lane pipeline: gathers_at_a_level_match_the_hardware, permutes_read_the_lane_named_and_zero_from_lanes_left_out, a_mask_joined_with_data_at_a_uniform_loop_is_its_number), so they are baseline WARP failures. Note that gathers_at_a_level... is one of the two fixtures this PR edits, so that edit cannot be checked on WARP. The other fixture edit (stride_tests) passes. Clippy -D warnings is clean.
  • Negative control: with the lower.rs change reverted to origin/main, both new tests (mad_i64_i32_sign_extends_literal_addend, mad_literal_addends_match_cpu_in_both_words) fail. They pass with the fix, and they compare both result words against CPU integer arithmetic.

Method: WARP/CPU only (no physical GPU; VICTORY_WARP=1, VICTORY_D3D12_WARP=1, Windows SDK dxil.dll on PATH, so DXIL validation ran), cargo test -p <crate> --lib --locked and cargo clippy -p <crate> --all-targets --locked -- -D warnings, compared with origin/main 13f91cae. Nothing from the game was used.

AI-assisted review (Claude Code / Claude Sonnet 5.5).

**@⁠oni-swr** on GitHub · 2026-11-25 20:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2774#issuecomment-7173913733) Independent verification of head `cca9102f` (WARP/CPU): **looks good**. - Diff: `v_mad_i64_i32` now sign-extends its 32-bit literal addend (`v_mad_u64_u32` still zero-extends, per the new test), plus two fixtures changed from structured to raw buffer views. The change is small and in scope. - Tests: `victory-shader --lib` 269 pass, 3 fail. The same 3 fail on `origin/main` (WARP has no 32-lane pipeline: `gathers_at_a_level_match_the_hardware`, `permutes_read_the_lane_named_and_zero_from_lanes_left_out`, `a_mask_joined_with_data_at_a_uniform_loop_is_its_number`), so they are baseline WARP failures. Note that `gathers_at_a_level...` is one of the two fixtures this PR edits, so that edit cannot be checked on WARP. The other fixture edit (`stride_tests`) passes. Clippy `-D warnings` is clean. - Negative control: with the `lower.rs` change reverted to `origin/main`, both new tests (`mad_i64_i32_sign_extends_literal_addend`, `mad_literal_addends_match_cpu_in_both_words`) fail. They pass with the fix, and they compare both result words against CPU integer arithmetic. Method: WARP/CPU only (no physical GPU; `VICTORY_WARP=1`, `VICTORY_D3D12_WARP=1`, Windows SDK `dxil.dll` on PATH, so DXIL validation ran), `cargo test -p <crate> --lib --locked` and `cargo clippy -p <crate> --all-targets --locked -- -D warnings`, compared with `origin/main` 13f91cae. Nothing from the game was used. AI-assisted review (Claude Code / Claude Sonnet 5.5).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 20:38 UTC · original

Reviewed and verified cca9102f on Windows 11 (RTX 5090 + WARP + Windows SDK 10.0.26100.0 dxil.dll) against main (13f91ca).

  • Sign-extending Operand::Literal(x) via i64::from(x as i32) for v_mad_i64_i32 (lower.rs:6487-6489) matches inline-constant behavior, and switching byte-addressed fixtures in stride_tests.rs / synthetic_tests.rs to Stride::Raw fixes the a_heap_buffer_read_by_element_takes_the_views_stride failure on RTX 5090 as well.
  • RTX 5090 + WARP + dxil.dll: mad_ 2/2 passed, valu_tests:: 32/32 passed, synthetic_tests:: 7/7 passed, stride_tests:: 7/8 passed (only the separate pre-existing NVIDIA a_heap_buffer_read_where_no_buffer_view_is_reads_zeros failure remains, as noted in the PR).
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default & --features host): 0 warnings; cargo xtask policy: 184 files ok; clean git merge-tree vs 13f91ca, #2768, and #2766.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 20:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2774#issuecomment-7173962029) Reviewed and verified `cca9102f` on Windows 11 (RTX 5090 + WARP + Windows SDK `10.0.26100.0` `dxil.dll`) against `main` (`13f91ca`). - Sign-extending `Operand::Literal(x)` via `i64::from(x as i32)` for `v_mad_i64_i32` (`lower.rs:6487-6489`) matches inline-constant behavior, and switching byte-addressed fixtures in `stride_tests.rs` / `synthetic_tests.rs` to `Stride::Raw` fixes the `a_heap_buffer_read_by_element_takes_the_views_stride` failure on RTX 5090 as well. - **RTX 5090 + WARP + `dxil.dll`**: `mad_` **2/2 passed**, `valu_tests::` **32/32 passed**, `synthetic_tests::` **7/7 passed**, `stride_tests::` **7/8 passed** (only the separate pre-existing NVIDIA `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` failure remains, as noted in the PR). - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default & `--features host`): **0 warnings**; `cargo xtask policy`: **184 files ok**; clean `git merge-tree` vs `13f91ca`, `#2768`, and `#2766`.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 20:39 UTC · original

Correct: v_mad_i64_i32's name doesn't match the _i64 suffix check so its S2 literal was zero-extended - the explicit-name addition matches LLVM's operand rules (S2.i64 sign-extends). The test splits the cases well (mad_i64 sign-extends -100, mad_u64 zero-extends). Raw-stride fixture changes also fix the tests to match how the host actually views heap buffers.

**@⁠kotekompotek** on GitHub · 2026-11-25 20:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/2774#issuecomment-7173990201) Correct: v_mad_i64_i32's name doesn't match the _i64 suffix check so its S2 literal was zero-extended - the explicit-name addition matches LLVM's operand rules (S2.i64 sign-extends). The test splits the cases well (mad_i64 sign-extends -100, mad_u64 zero-extends). Raw-stride fixture changes also fix the tests to match how the host actually views heap buffers.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:23 UTC · original

Automated triage for the maintainers.

This PR re-packages changes from other PRs: the lower.rs src64 change and the mad_i64_i32_sign_extends_literal_addend test are those of #2254, which is still open and already marked as a merge candidate, and the stride_tests.rs/synthetic_tests.rs fixture changes are those of #2357. The only new part is mad_literal_addends_match_cpu_in_both_words. That test would be better offered to #2254 (as a suggestion on that PR), and the fixture change can be raised again on its own if a maintainer wants it, so review happens in one place. CI passes on this head.

This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the triage: proposed close label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2774#issuecomment-7177490328) <!-- victory-triage v1 head=cca9102f3b3ea2beac6f909dd9a55042412d5164 verdict=proposed-close at=2026-11-25T23:23:06Z --> Automated triage for the maintainers. This PR re-packages changes from other PRs: the `lower.rs` `src64` change and the `mad_i64_i32_sign_extends_literal_addend` test are those of #2254, which is still open and already marked as a merge candidate, and the `stride_tests.rs`/`synthetic_tests.rs` fixture changes are those of #2357. The only new part is `mad_literal_addends_match_cpu_in_both_words`. That test would be better offered to #2254 (as a suggestion on that PR), and the fixture change can be raised again on its own if a maintainer wants it, so review happens in one place. CI passes on this head. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the `triage: proposed close` label. --- _Generated by [Claude Code](https://claude.ai/code)_
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/2774/head:github-bot/gh-2774'
git switch 'github-bot/gh-2774'

Merge

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