Shaders: hardware probes for the 64-bit scalar logic and shift ops #2570

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

@⁠LouisRiverstone on GitHub · 2026-11-25 16:03 UTC · original
LouisRiverstone:shaders/s-logic-shift-b64-probes → main · +68 −0 · 1 files · 1 commits · open

Adds probes for s_and/or/xor/andn2/orn2/nand/nor/xnor_b64 (SOP2 0x0F-0x1D) and s_lshl_b64, s_lshr_b64, s_ashr_i64 (0x1F, 0x21, 0x23) to scalar_probes: both result dwords and SCC, over 64-bit edge values, with shift counts that pin the six-bit mask (63, 64, 65, garbage in the high bits). Only a single s_ashr_i64 case was tested before. Test-only.

**@⁠LouisRiverstone** on GitHub · 2026-11-25 16:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2570) `LouisRiverstone:shaders/s-logic-shift-b64-probes` → `main` · +68 −0 · 1 files · 1 commits · open Adds probes for s_and/or/xor/andn2/orn2/nand/nor/xnor_b64 (SOP2 0x0F-0x1D) and s_lshl_b64, s_lshr_b64, s_ashr_i64 (0x1F, 0x21, 0x23) to scalar_probes: both result dwords and SCC, over 64-bit edge values, with shift counts that pin the six-bit mask (63, 64, 65, garbage in the high bits). Only a single s_ashr_i64 case was tested before. Test-only.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:09:31 +00:00
Author
Owner

@⁠Mericas77 on GitHub · 2026-11-25 17:34 UTC · original

Tested on NVIDIA: RTX 4070, driver 621.01, Windows 11, rustc 1.100.0. Head f70c8c4 against main 67e8ae1.

  • scalar_alu_matches_the_hardware: passes. 39 probes here vs 28 on main; the 11 new 64-bit ones (s_and/or/xor/andn2/orn2/nand/nor/xnor_b64, s_lshl_b64, s_lshr_b64, s_ashr_i64) all report hardware 0 / warp 0 mismatches, so they ran on the NVIDIA adapter and on WARP.
  • cargo test -p victory-shader --lib --locked (with --skip heap_direct_texture_reads_mark_their_heap_index, which crashes the process on main here too, #2571): 266 / 3 / 3, same as main, same 3 known NVIDIA failures.

No game data; the title was not run.

AI-assisted.

**@⁠Mericas77** on GitHub · 2026-11-25 17:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/2570#issuecomment-7169688382) Tested on NVIDIA: RTX 4070, driver 621.01, Windows 11, rustc 1.100.0. Head `f70c8c4` against `main` `67e8ae1`. - `scalar_alu_matches_the_hardware`: **passes**. 39 probes here vs 28 on `main`; the 11 new 64-bit ones (`s_and/or/xor/andn2/orn2/nand/nor/xnor_b64`, `s_lshl_b64`, `s_lshr_b64`, `s_ashr_i64`) all report hardware 0 / warp 0 mismatches, so they ran on the NVIDIA adapter and on WARP. - `cargo test -p victory-shader --lib --locked` (with `--skip heap_direct_texture_reads_mark_their_heap_index`, which crashes the process on `main` here too, #2571): 266 / 3 / 3, same as `main`, same 3 known NVIDIA failures. No game data; the title was not run. AI-assisted.
Author
Owner

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

Automated triage for the maintainers.

Merge candidate. This is a recommendation to look, not an approval. It merges cleanly into main. CI: check passing.

The PR adds scalar_64_probes to scalar_probes in crates/victory-shader/src/emit/semantics_tests.rs. It covers the 64-bit SOP2 ops s_and/or/xor/andn2/orn2/nand/nor/xnor_b64 and s_lshl/lshr_b64/s_ashr_i64 over 64-bit edge pairs, checking both result dwords and SCC. The opcodes (0x0F–0x23, odd) match the SOP2 table in gfx10/opcodes.rs. The model's six-bit shift count and SCC = result != 0 match the RDNA2 ISA and the existing lowering arms in lower.rs. Register use fits program(): inputs in s16–s19, the result in s[20:21], SCC to s22 via s_cselect, and outputs from v5–v7. main has no probe for these ops yet.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 19:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2570#issuecomment-7172225484) <!-- victory-triage v1 head=f70c8c4e5f64a0e21760aed27bffa1e3956f521e verdict=merge-candidate at=2026-11-25T19:39:30Z --> Automated triage for the maintainers. **Merge candidate.** This is a recommendation to look, not an approval. It merges cleanly into `main`. CI: `check` passing. The PR adds `scalar_64_probes` to `scalar_probes` in `crates/victory-shader/src/emit/semantics_tests.rs`. It covers the 64-bit SOP2 ops `s_and/or/xor/andn2/orn2/nand/nor/xnor_b64` and `s_lshl/lshr_b64`/`s_ashr_i64` over 64-bit edge pairs, checking both result dwords and SCC. The opcodes (0x0F–0x23, odd) match the SOP2 table in `gfx10/opcodes.rs`. The model's six-bit shift count and SCC = result != 0 match the RDNA2 ISA and the existing lowering arms in `lower.rs`. Register use fits `program()`: inputs in s16–s19, the result in s[20:21], SCC to s22 via `s_cselect`, and outputs from v5–v7. `main` has no probe for these ops yet. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fyernald on GitHub · 2026-11-25 17:01 UTC · original · approved these changes

Checked on real NVIDIA hardware: RTX 3080 (617.42), Windows 10 (19045), plus WARP, main 67e8ae1 + #486 + #2596 (without #2596 the suite crashes on NVIDIA, #2571). cargo test -p victory-shader --lib --locked -- --test-threads=1 gives 267 passed, 3 failed, the same as the base. The 3 are the #1835 failures. The new probes agree with the model on both adapters.

The SOP2 opcodes match RDNA2: the _b64 logic ops at 0x0F to 0x1D (odd), then s_lshl_b64/s_lshr_b64/s_ashr_i64 at 0x1F/0x21/0x23. The shift references mask the count to 6 bits as the hardware does.

**@⁠fyernald** on GitHub · 2026-11-25 17:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/2570#pullrequestreview-6061677849) · **approved these changes** Checked on real NVIDIA hardware: **RTX 3080 (617.42), Windows 10 (19045)**, plus WARP, `main` `67e8ae1` + #486 + #2596 (without #2596 the suite crashes on NVIDIA, #2571). `cargo test -p victory-shader --lib --locked -- --test-threads=1` gives 267 passed, 3 failed, the same as the base. The 3 are the #1835 failures. The new probes agree with the model on both adapters. The SOP2 opcodes match RDNA2: the `_b64` logic ops at 0x0F to 0x1D (odd), then `s_lshl_b64`/`s_lshr_b64`/`s_ashr_i64` at 0x1F/0x21/0x23. The shift references mask the count to 6 bits as the hardware does.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 19:35 UTC · original · approved these changes

Looks good to me — clean test-only expansion of scalar_probes covering all eight 64-bit SOP2 bitwise ops and all three 64-bit scalar shifts, including SCC (!= 0) and 6-bit shift-count masking.

Verified locally on Windows 11 with head f70c8c4e cleanly merged onto main (63bcca43):

  • Audited all 11 SOP2 opcodes in scalar_64_probes (crates/victory-shader/src/emit/semantics_tests.rs:2816-2878): 0x0F..=0x1D (odd: s_and/or/xor/andn2/orn2/nand/nor/xnor_b64) and 0x1F/0x21/0x23 (s_lshl_b64, s_lshr_b64, s_ashr_i64) match gfx10/opcodes.rs and RDNA2 semantics, capturing s[20:21] and SCC via s_cselect_b32.
  • Formatting check (rustfmt --edition 2024 --config skip_children=true) shows no diffs on the added lines.
  • cargo run -p xtask -- policy (191 files ok) and cargo clippy --locked -p victory-shader --all-targets -- -D warnings (both default and --all-features) pass.
  • cargo test --locked -p victory-shader --lib scalar_alu_matches_the_hardware -- --nocapture passes on both VICTORY_WARP=0 (2.41s) and VICTORY_WARP=1 (0.22s): all 39 probes (including all 11 new probes across 64 logic pairs / 72 shift inputs) report model mismatches ["hardware 0", "warp 0"], hardware/warp differ on 0.

Tiny non-blocking doc-comment nit: semantics_tests.rs:2813-2814 mentions s[16:17] and s[18:19] as operands for all 11 ops, whereas the three shift ops only read scalar s18[5:0] (with s19 holding OLD and unused).

**@⁠fuzeofficlal** on GitHub · 2026-11-26 19:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2570#pullrequestreview-6079606927) · **approved these changes** Looks good to me — clean test-only expansion of `scalar_probes` covering all eight 64-bit SOP2 bitwise ops and all three 64-bit scalar shifts, including `SCC` (`!= 0`) and 6-bit shift-count masking. Verified locally on Windows 11 with head `f70c8c4e` cleanly merged onto `main` (`63bcca43`): - Audited all 11 SOP2 opcodes in `scalar_64_probes` (`crates/victory-shader/src/emit/semantics_tests.rs:2816-2878`): `0x0F..=0x1D` (odd: `s_and/or/xor/andn2/orn2/nand/nor/xnor_b64`) and `0x1F`/`0x21`/`0x23` (`s_lshl_b64`, `s_lshr_b64`, `s_ashr_i64`) match `gfx10/opcodes.rs` and RDNA2 semantics, capturing `s[20:21]` and `SCC` via `s_cselect_b32`. - Formatting check (`rustfmt --edition 2024 --config skip_children=true`) shows no diffs on the added lines. - `cargo run -p xtask -- policy` (`191 files ok`) and `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (both default and `--all-features`) pass. - `cargo test --locked -p victory-shader --lib scalar_alu_matches_the_hardware -- --nocapture` passes on both `VICTORY_WARP=0` (`2.41s`) and `VICTORY_WARP=1` (`0.22s`): all 39 probes (including all 11 new probes across 64 logic pairs / 72 shift inputs) report `model mismatches ["hardware 0", "warp 0"], hardware/warp differ on 0`. Tiny non-blocking doc-comment nit: `semantics_tests.rs:2813-2814` mentions `s[16:17]` and `s[18:19]` as operands for all 11 ops, whereas the three shift ops only read scalar `s18[5:0]` (with `s19` holding `OLD` and unused).
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 20:18 UTC · original · approved these changes

LGTM — verified on RTX 5090 and VICTORY_WARP=1 (Windows / D3D12) against origin/main (63bcca4).

  • Adding 64-bit scalar logic and shift probes to scalar_alu_matches_the_hardware expands hardware-verified coverage cleanly on both RTX 5090 and WARP.
  • cargo test -p victory-shader --lib emit::semantics_tests::scalar_alu_matches_the_hardware -- --test-threads=1: passed on RTX 5090 and VICTORY_WARP=1.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 20:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2570#pullrequestreview-6080054196) · **approved these changes** LGTM — verified on RTX 5090 and `VICTORY_WARP=1` (Windows / D3D12) against `origin/main` (`63bcca4`). - Adding 64-bit scalar logic and shift probes to `scalar_alu_matches_the_hardware` expands hardware-verified coverage cleanly on both RTX 5090 and WARP. - `cargo test -p victory-shader --lib emit::semantics_tests::scalar_alu_matches_the_hardware -- --test-threads=1`: passed on RTX 5090 and `VICTORY_WARP=1`. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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/2570/head:github-bot/gh-2570'
git switch 'github-bot/gh-2570'

Merge

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