Shaders: lower v_cmp_{f,t}_{i64,u64} constant 64-bit compares #1685

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

@⁠Calvix2k on GitHub · 2026-11-24 20:44 UTC · original
Calvix2k:codex/shader-cmp64-ft-1531 → main · +39 −0 · 2 files · 1 commits · open

Implements #1531.

Ports the fix from @⁠davi713albano-coder's fork (commit 41715fc by Davi713), applied unchanged onto ffe310e; the commit keeps its original author.

Summary

The u64 | i64 arm of emit::lower::compare fell through to Err("a 64-bit compare") for the constant-true and constant-false compares, while the 32-bit arm handled them with self.lane(inst, Some(op == "t")).

  • v_cmp_{f,t}_{i64,u64} and v_cmpx_{f,t}_{i64,u64} now short-circuit before src64, so a constant compare does not set the Int64 flag (SFI0 bit 0x8000) it does not need.

Test

New synthetic compute test v_cmp_f_and_t_64bit_match_rdna2 covers v_cmp_f_i64, v_cmp_t_i64, v_cmp_f_u64 and v_cmp_t_u64: dxil.dll validation, absence of the Int64 flag, and execution on D3D12 hardware/WARP.

Validation

  • cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests — passed (102 tests, 1 ignored).
  • cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings — passed.
  • cargo xtask policy — passed (154 files).
  • Upstream fork CI ran the full workspace, including the new WARP/hardware VALU test: 343 passed, 0 failed.
**@⁠Calvix2k** on GitHub · 2026-11-24 20:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/1685) `Calvix2k:codex/shader-cmp64-ft-1531` → `main` · +39 −0 · 2 files · 1 commits · open Implements #1531. Ports the fix from [@⁠davi713albano-coder's fork](https://github.com/Marvisak/VIctory/compare/main...davi713albano-coder:VIctory:shader/cmp64-f-and-t) (commit 41715fc by Davi713), applied unchanged onto `ffe310e`; the commit keeps its original author. ## Summary The `u64 | i64` arm of `emit::lower::compare` fell through to `Err("a 64-bit compare")` for the constant-true and constant-false compares, while the 32-bit arm handled them with `self.lane(inst, Some(op == "t"))`. - `v_cmp_{f,t}_{i64,u64}` and `v_cmpx_{f,t}_{i64,u64}` now short-circuit before `src64`, so a constant compare does not set the `Int64` flag (`SFI0` bit 0x8000) it does not need. ## Test New synthetic compute test `v_cmp_f_and_t_64bit_match_rdna2` covers `v_cmp_f_i64`, `v_cmp_t_i64`, `v_cmp_f_u64` and `v_cmp_t_u64`: dxil.dll validation, absence of the `Int64` flag, and execution on D3D12 hardware/WARP. ## Validation - `cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests` — passed (102 tests, 1 ignored). - `cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings` — passed. - `cargo xtask policy` — passed (154 files). - Upstream fork CI ran the full workspace, including the new WARP/hardware VALU test: 343 passed, 0 failed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:41:31 +00:00
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 21:40 UTC · original

Hardware run on the RX 7800 XT (RDNA3), Windows 10 x64, Agility SDK 1.616 for SM 6.6:

  • cargo test -p victory-shader --locked v_cmp_f_and_t_64bit_match_rdna2 -- --test-threads=1 --nocapture — 1 passed, 0 failed on the hardware backend.
  • WARP skipped (SM 6.2 here), so this confirms the constant-true/false 64-bit compares and the absent Int64 flag on AMD hardware.
**@⁠Calvix2k** on GitHub · 2026-11-24 21:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1685#issuecomment-7145232087) Hardware run on the RX 7800 XT (RDNA3), Windows 10 x64, Agility SDK 1.616 for SM 6.6: - `cargo test -p victory-shader --locked v_cmp_f_and_t_64bit_match_rdna2 -- --test-threads=1 --nocapture` — **1 passed, 0 failed** on the hardware backend. - WARP skipped (SM 6.2 here), so this confirms the constant-true/false 64-bit compares and the absent `Int64` flag on AMD hardware.
Author
Owner

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

Rebased onto 70564ae; only the test module conflicted (upstream added more test helpers). Both sets are kept. cargo check -p victory-shader --tests --locked passes; the test itself was already verified on a Radeon RX 7800 XT before the rebase and is unchanged.

**@⁠Calvix2k** on GitHub · 2026-11-24 22:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1685#issuecomment-7145976586) Rebased onto 70564ae; only the test module conflicted (upstream added more test helpers). Both sets are kept. cargo check -p victory-shader --tests --locked passes; the test itself was already verified on a Radeon RX 7800 XT before the rebase and is unchanged.
Author
Owner

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

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

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

**@⁠upipibi** on GitHub · 2026-11-24 22:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/1685#issuecomment-7146735224) NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, `d7536bd` (on `main` `70564ae`). `v_cmp_f_and_t_64bit_match_rdna2` 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 and crates/victory-shader/src/emit/valu_tests.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/1685#issuecomment-7152025268) · edited 2026-11-25 22:24 UTC <!-- victory-triage v1 head=d8693330ef982db141f23297818bb784c9bff0e1 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` and `crates/victory-shader/src/emit/valu_tests.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:06 UTC · original

Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at d869333. 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:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1685#issuecomment-7157873623) **Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24.** Branch at `d869333`. `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 10:14 UTC · original

Hardware run on an RX 7800 XT (RDNA3), Windows 10 19045, SM 6.6 via the Agility runtime for the test binaries (#486): victory-shader lib suite 248 passed, 0 failed, 3 ignored, including the 64-bit constant-compare cases. The lowering is exercised on the card here as well as on CI's device.

**@⁠Calvix2k** on GitHub · 2026-11-25 10:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1685#issuecomment-7159433468) Hardware run on an **RX 7800 XT (RDNA3), Windows 10 19045**, SM 6.6 via the Agility runtime for the test binaries (#486): `victory-shader` lib suite **248 passed, 0 failed, 3 ignored**, including the 64-bit constant-compare cases. The lowering is exercised on the card here as well as on CI's device.
github-bot force-pushed github-bot/gh-1685 from d8693330ef to 803c7f3ac0 2026-11-26 13:53:33 +00:00 Compare
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 → 96 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_cmp_f_i64/v_cmp_t_i64/v_cmp_f_u64/v_cmp_t_u64 constant 64-bit compares: 59-line diff with an RDNA2 reference test.

**@⁠catminou4** on GitHub · 2026-11-24 21:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1685#pullrequestreview-6047849310) · **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 → 96 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_cmp_f_i64/v_cmp_t_i64/v_cmp_f_u64/v_cmp_t_u64 constant 64-bit compares: 59-line diff with an RDNA2 reference test.
Author
Owner

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

Rebased. The f/t early return now runs before upstream's dword-wise comparison, so both the AMD dword order and the float predicates are handled by one path.

**@⁠Calvix2k** on GitHub · 2026-11-26 13:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/1685#issuecomment-7193974809) Rebased. The `f`/`t` early return now runs before upstream's dword-wise comparison, so both the AMD dword order and the float predicates are handled by one path.
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/1685/head:github-bot/gh-1685'
git switch 'github-bot/gh-1685'

Merge

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