Shaders: hardware probes for s_bitcmp0_b32 and s_bitcmp1_b32 #2563

Open
LouisRiverstone wants to merge 1 commit from upstream-pr/2565 into main
LouisRiverstone commented 2026-11-25 15:54:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LouisRiverstone on 2026-11-25T15:54:21Z.


Adds s_bitcmp0_b32 and s_bitcmp1_b32 (SOPC 0x0C, 0x0D) probes to scalar_probes. Test-only.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5494656194 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2565). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-11-25T15:54:21Z. --- Adds s_bitcmp0_b32 and s_bitcmp1_b32 (SOPC 0x0C, 0x0D) probes to scalar_probes. Test-only.
Vedoxdev123 commented 2026-11-25 16:09:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Vedoxdev123 on 2026-11-25T16:04:14Z.


Tested on Windows with AMD Ryzen 5 5600X + NVIDIA GeForce RTX 4060 (AI-assisted):

cargo test -p victory-gpu --lib -> 193 passed; 2 failed; 1 ignored (improved from 192 passed; 3 failed on main; new test passes and views_bound_while_another_slot_gets_its_texture_do_not_wait now passes).

Only the 2 known 1,000,000 view heap cap tests (dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views from #1744) remain.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167565931 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2565#issuecomment-7167565931). Originally posted by [Vedoxdev123](https://github.com/Vedoxdev123) on 2026-11-25T16:04:14Z. --- Tested on Windows with AMD Ryzen 5 5600X + NVIDIA GeForce RTX 4060 (AI-assisted): `cargo test -p victory-gpu --lib` -> **193 passed; 2 failed; 1 ignored** (improved from `192 passed; 3 failed` on `main`; new test passes and `views_bound_while_another_slot_gets_its_texture_do_not_wait` now passes). Only the 2 known 1,000,000 view heap cap tests (`dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views` from #1744) remain.
fyernald commented 2026-11-25 17:01:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fyernald on 2026-11-25T17:01:11Z.

Review: APPROVED


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.

s_bitcmp0_b32/s_bitcmp1_b32 are 0x0C/0x0D in SOPC, and the reference reads the bit index from src1[4:0] as the ISA says. The 32/33/0xFFFFFFE1 counts cover the wrap.

<!-- greyfinch-sync:Marvisak/VIctory:review:6061676217 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2565#pullrequestreview-6061676217). Originally posted by [fyernald](https://github.com/fyernald) on 2026-11-25T17:01:11Z. **Review:** APPROVED --- 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. `s_bitcmp0_b32`/`s_bitcmp1_b32` are 0x0C/0x0D in SOPC, and the reference reads the bit index from `src1[4:0]` as the ISA says. The 32/33/0xFFFFFFE1 counts cover the wrap.
Marvisak commented 2026-11-25 20:06:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T19:22:34Z.


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 hardware probes for s_bitcmp0_b32 and s_bitcmp1_b32 (SOPC 0x0C/0x0D) to scalar_probes in crates/victory-shader/src/emit/semantics_tests.rs, using the same s_cselect_b32 pattern as the existing compare probes. The model follows the RDNA2 ISA: SCC is whether bit src1[4:0] of src0 is clear or set. It matches the s_bitcmp branch in emit/lower.rs, which masks the index with 31, and the bit indices 32, 33 and 0xFFFFFFE1 exercise that masking. main has only lowering unit tests for these opcodes, not probes, and I found no duplicate open PR.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7172207216 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2565#issuecomment-7172207216). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T19:22:34Z. --- <!-- victory-triage v1 head=bb744a8f982b6c0b80f58cca1f697b7e2d28966f verdict=merge-candidate at=2026-11-25T19:36:00Z --> 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 hardware probes for `s_bitcmp0_b32` and `s_bitcmp1_b32` (SOPC 0x0C/0x0D) to `scalar_probes` in `crates/victory-shader/src/emit/semantics_tests.rs`, using the same `s_cselect_b32` pattern as the existing compare probes. The model follows the RDNA2 ISA: SCC is whether bit `src1[4:0]` of src0 is clear or set. It matches the `s_bitcmp` branch in `emit/lower.rs`, which masks the index with 31, and the bit indices 32, 33 and 0xFFFFFFE1 exercise that masking. `main` has only lowering unit tests for these opcodes, not probes, and I found no duplicate open PR. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 19:50:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:50:48Z.

Review: APPROVED


Looks good to me — clean hardware probe coverage for s_bitcmp0_b32 and s_bitcmp1_b32, exercising both clear/set bits across all 32 positions and 5-bit index wrapping (src1[4:0]).

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

  • Audited crates/victory-shader/src/emit/semantics_tests.rs:2803-2818: SOPC 0x0C (s_bitcmp0_b32) and 0x0D (s_bitcmp1_b32) and the i[1] & 31 model match gfx10/opcodes.rs:194-195 and lower.rs:3623.
  • 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.01s) and VICTORY_WARP=1 (0.16s), with both new probes (168 inputs each) reporting model mismatches ["hardware 0", "warp 0"], hardware/warp differ on 0.
<!-- greyfinch-sync:Marvisak/VIctory:review:6079777177 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2565#pullrequestreview-6079777177). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T19:50:48Z. **Review:** APPROVED --- Looks good to me — clean hardware probe coverage for `s_bitcmp0_b32` and `s_bitcmp1_b32`, exercising both clear/set bits across all 32 positions and 5-bit index wrapping (`src1[4:0]`). Verified locally on Windows 11 with head `bb744a8f` cleanly merged onto `main` (`63bcca43`): - Audited `crates/victory-shader/src/emit/semantics_tests.rs:2803-2818`: SOPC `0x0C` (`s_bitcmp0_b32`) and `0x0D` (`s_bitcmp1_b32`) and the `i[1] & 31` model match `gfx10/opcodes.rs:194-195` and `lower.rs:3623`. - 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.01s`) and `VICTORY_WARP=1` (`0.16s`), with both new probes (`168 inputs` each) reporting `model mismatches ["hardware 0", "warp 0"], hardware/warp differ on 0`.
Dukestar69 commented 2026-11-26 20:19:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T20:19:01Z.

Review: APPROVED


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

  • Adding hardware probes for s_bitcmp0_b32 and s_bitcmp1_b32 in scalar_alu_matches_the_hardware passes 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).

<!-- greyfinch-sync:Marvisak/VIctory:review:6080058071 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2565#pullrequestreview-6080058071). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T20:19:01Z. **Review:** APPROVED --- LGTM — verified on RTX 5090 and `VICTORY_WARP=1` (Windows / D3D12) against `origin/main` (`63bcca4`). - Adding hardware probes for `s_bitcmp0_b32` and `s_bitcmp1_b32` in `scalar_alu_matches_the_hardware` passes 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 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/2565:upstream-pr/2565'
git switch 'upstream-pr/2565'

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/2565'
git switch 'upstream-pr/2565'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2565'
git switch 'upstream-pr/2565'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2565'
git switch 'main'
git merge --squash 'upstream-pr/2565'
git switch 'main'
git merge --ff-only 'upstream-pr/2565'
git switch 'main'
git merge 'upstream-pr/2565'
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
Marvisak/VIctory!2563
No description provided.