Shaders: lower constant 64-bit integer compares without INT64 #1090

Closed
tarcisioads wants to merge 1 commit from upstream-pr/1090 into main
tarcisioads commented 2026-11-24 15:39:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tarcisioads on 2026-11-24T15:39:32Z.


Handle f and t predicates (v_cmp_f_{u64,i64}, v_cmp_t_{u64,i64}, and v_cmpx_*) in the "u64" | "i64" branch of compare() in crates/victory-shader/src/emit/lower.rs, matching the existing 16/32-bit integer path:

  • Return self.lane(inst, Some(op == "t")) before calling self.src64(), avoiding "a 64-bit compare" and avoiding setting flags::INT64 (SFI0 0x8000) unnecessarily.
  • Add unit test constant_64_bit_compares_lower_without_int64 covering v_cmp_f_u64, v_cmp_t_i64, v_cmpx_f_u64, and v_cmpx_t_i64.

Verification

  • cargo test -p victory-shader (97 passed, 0 failed, 1 ignored benchmark on macOS; Windows dxil.dll validation not run)
  • cargo xtask policy (ok)
<!-- greyfinch-sync:Marvisak/VIctory:issue:5475357854 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1090). Originally posted by [tarcisioads](https://github.com/tarcisioads) on 2026-11-24T15:39:32Z. --- Handle `f` and `t` predicates (`v_cmp_f_{u64,i64}`, `v_cmp_t_{u64,i64}`, and `v_cmpx_*`) in the `"u64" | "i64"` branch of `compare()` in `crates/victory-shader/src/emit/lower.rs`, matching the existing 16/32-bit integer path: - Return `self.lane(inst, Some(op == "t"))` before calling `self.src64()`, avoiding `"a 64-bit compare"` and avoiding setting `flags::INT64` (`SFI0 0x8000`) unnecessarily. - Add unit test `constant_64_bit_compares_lower_without_int64` covering `v_cmp_f_u64`, `v_cmp_t_i64`, `v_cmpx_f_u64`, and `v_cmpx_t_i64`. ### Verification - `cargo test -p victory-shader` (97 passed, 0 failed, 1 ignored benchmark on macOS; Windows `dxil.dll` validation not run) - `cargo xtask policy` (ok)
Aniseto commented 2026-11-24 16:05:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Aniseto on 2026-11-24T15:48:18Z.


Ran the new lowering test at 0b7067f:

Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

cargo test -p victory-shader constant_64_bit
1 passed; 0 failed; 0 ignored      (exit 0)

emit::lower::tests::constant_64_bit_compares_lower_without_int64 passes. This is a CPU-side lowering test, so the adapter is not the variable; the datapoint is the pinned 1.98.1 toolchain.

Two related PRs from the same area are still open and I have not looked at them yet (#1099 for v_interp_p1, #1103 for s_buffer_load_dword); they are small and can be run the same way if that is useful.

Not tested: a title using these compares (no game data here), RDNA2/RDNA4 and Intel GPUs.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the test, wrote this report; no game data was used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136640013 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1090#issuecomment-7136640013). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-24T15:48:18Z. --- Ran the new lowering test at `0b7067f`: Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` cargo test -p victory-shader constant_64_bit 1 passed; 0 failed; 0 ignored (exit 0) ``` `emit::lower::tests::constant_64_bit_compares_lower_without_int64` passes. This is a CPU-side lowering test, so the adapter is not the variable; the datapoint is the pinned 1.98.1 toolchain. Two related PRs from the same area are still open and I have not looked at them yet (#1099 for `v_interp_p1`, #1103 for `s_buffer_load_dword`); they are small and can be run the same way if that is useful. Not tested: a title using these compares (no game data here), RDNA2/RDNA4 and Intel GPUs. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash 1017** - checked out the PR's head commit in a detached worktree, built it, ran the test, wrote this report; no game data was used.
Zipettte commented 2026-11-24 17:04:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T16:29:44Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 0b7067f: cargo test -p victory-shader passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7137753942 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1090#issuecomment-7137753942). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T16:29:44Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 0b7067f: `cargo test -p victory-shader` passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
mercuryVM commented 2026-11-24 19:58:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T19:58:56Z.

Review: APPROVED


Tested 0b7067fb on Windows 11, RTX 5070, MSVC:

  • cargo test -p victory-shader -- --test-threads=1 passes on the head (121 passed, 1 ignored).
  • Merged into our fork: workspace tests, shader tests and clippy -D warnings (default and all features) are all clean.

The change is right. The f/t predicates don't read their operands, so returning the constant lane result before src64 matches the 16- and 32-bit path and keeps INT64 out of SFI0. The v_cmpx forms go through the same lane call.

On a full game package, translate --validate --list keeps every program's result, with 0 programs changed (counts only compared).

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6046401911 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1090#pullrequestreview-6046401911). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T19:58:56Z. **Review:** APPROVED --- Tested 0b7067fb on Windows 11, RTX 5070, MSVC: - `cargo test -p victory-shader -- --test-threads=1` passes on the head (121 passed, 1 ignored). - Merged into our fork: workspace tests, shader tests and `clippy -D warnings` (default and all features) are all clean. The change is right. The `f`/`t` predicates don't read their operands, so returning the constant lane result before `src64` matches the 16- and 32-bit path and keeps `INT64` out of SFI0. The `v_cmpx` forms go through the same `lane` call. On a full game package, `translate --validate --list` keeps every program's result, with 0 programs changed (counts only compared). AI-assisted (Claude Code).
Marvisak commented 2026-11-25 02:06:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:26:02Z.


Automated triage for the maintainers.

Proposed close. This duplicates #1685.

The change in the "u64" | "i64" arm of Lower::compare (crates/victory-shader/src/emit/lower.rs) is correct: f and t return self.lane(inst, Some(op == "t")) before src64, as the 32-bit arm already does, so no Int64 flag is set. However, #1685 makes exactly the same four-line change, and both PRs merge cleanly.

#1685's test (v_cmp_f_and_t_64bit_match_rdna2 in valu_tests.rs) is the stronger one. It checks the SFI0 flag, validates the shader, and runs it on the host GPU and WARP to check the result. constant_64_bit_compares_lower_without_int64 here checks only that lowering succeeds without the Int64 bit; it does not check that f gives false and t gives true.

If you push an execution check like that, or the maintainer prefers this PR, this verdict can be revisited.

CI: no check runs on the head commit.

This pull request 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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149541101 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1090#issuecomment-7149541101). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:26:02Z. --- <!-- victory-triage v1 head=9a2513e565268460c6ba4a98635b871608e35032 verdict=proposed-close at=2026-11-25T01:26:00Z --> Automated triage for the maintainers. **Proposed close.** This duplicates #1685. The change in the `"u64" | "i64"` arm of `Lower::compare` (`crates/victory-shader/src/emit/lower.rs`) is correct: `f` and `t` return `self.lane(inst, Some(op == "t"))` before `src64`, as the 32-bit arm already does, so no Int64 flag is set. However, #1685 makes exactly the same four-line change, and both PRs merge cleanly. #1685's test (`v_cmp_f_and_t_64bit_match_rdna2` in `valu_tests.rs`) is the stronger one. It checks the SFI0 flag, validates the shader, and runs it on the host GPU and WARP to check the result. `constant_64_bit_compares_lower_without_int64` here checks only that lowering succeeds without the Int64 bit; it does not check that `f` gives false and `t` gives true. If you push an execution check like that, or the maintainer prefers this PR, this verdict can be revisited. CI: no check runs on the head commit. This pull request 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)_
catminou4 commented 2026-11-25 04:04:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:04:24Z.

Review: CHANGES_REQUESTED


Merge with current main (940d32f69b) breaks compilation — verified locally after git merge origin/main:

error[E0063]: missing field `view_marks` in initializer of `Parts<'_>`

Same break as #1587/#1519/#1004: main added view_marks to Parts after this PR was opened. Constant 64-bit integer compares without INT64 look right; rebase + initialize the new field, and I will re-test.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051698266 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1090#pullrequestreview-6051698266). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T04:04:24Z. **Review:** CHANGES_REQUESTED --- Merge with current main (940d32f69b) breaks compilation — verified locally after `git merge origin/main`: ``` error[E0063]: missing field `view_marks` in initializer of `Parts<'_>` ``` Same break as #1587/#1519/#1004: main added `view_marks` to `Parts` after this PR was opened. Constant 64-bit integer compares without INT64 look right; rebase + initialize the new field, and I will re-test.
tarcisioads commented 2026-11-28 03:37:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tarcisioads on 2026-11-28T03:37:18Z.


Closing as duplicate of #1685.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7233222936 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1090#issuecomment-7233222936). Originally posted by [tarcisioads](https://github.com/tarcisioads) on 2026-11-28T03:37:18Z. --- Closing as duplicate of #1685.

Pull request closed

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!1090
No description provided.