Shader: prevent WARP device loss on constant floating compares #152

Open
avt0m4t48 wants to merge 2 commits from upstream-pr/152 into main
avt0m4t48 commented 2026-11-24 21:55:18 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-24T21:55:18Z.


Refs #136. Lower the constant DXIL predicates for v_cmp{,x}_{f,tru}_f{16,32} through the existing lane-mask path. The emitted shaders then store the constant result instead of passing fcmp false or fcmp true to WARP.

This is the floating-point portion of Marvisak/VIctory#1326, including the source-built regression by fuzeofficial. Upstream patch

The same Windows-2025 WARP job verified both versions. The patched test checked all eight opcodes across finite, zero, infinity, quiet-NaN and signaling-NaN inputs. Restoring the original lowering suspended the WARP device on dispatch. Windows verification

On Linux, all eight emitted DXIL modules passed dxv and disassembled to the expected constant stores. The shader library suite passed 170 tests with two ignored. Windows-target Clippy with warnings denied and cargo xtask policy also passed. This run used WARP and source-built inputs.

AI-assisted using Codex.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592185429 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/152). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T21:55:18Z. --- Refs #136. Lower the constant DXIL predicates for `v_cmp{,x}_{f,tru}_f{16,32}` through the existing lane-mask path. The emitted shaders then store the constant result instead of passing `fcmp false` or `fcmp true` to WARP. This is the floating-point portion of Marvisak/VIctory#1326, including the source-built regression by fuzeofficial. [Upstream patch](https://github.com/Marvisak/VIctory/pull/1326) The same Windows-2025 WARP job verified both versions. The patched test checked all eight opcodes across finite, zero, infinity, quiet-NaN and signaling-NaN inputs. Restoring the original lowering suspended the WARP device on dispatch. [Windows verification](https://github.com/avt0m4t48/victory-fork/actions/runs/45495405259) On Linux, all eight emitted DXIL modules passed `dxv` and disassembled to the expected constant stores. The shader library suite passed 170 tests with two ignored. Windows-target Clippy with warnings denied and `cargo xtask policy` also passed. This run used WARP and source-built inputs. AI-assisted using Codex.
bawhen commented 2026-11-24 23:09:33 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by bawhen on 2026-11-24T22:18:54Z.


Checked on an RX 7700 (RDNA3, driver 32.0.32029.2010) and WARP.

cargo test -p victory-shader --locked --lib float_compares_that_are_always_false_or_true -- --nocapture

build result
PR head 08cb7ed passes on hardware and WARP
PR test, lower.rs and bitcode.rs from main hardware pass is fine; then warp: dispatch failed: The GPU device instance has been suspended, the WARP device removal from #136

So on this card it's a WARP/CI fix only: the RX 7700 handles fcmp false/fcmp true correctly.

Setup: AMD Radeon RX 7700 (RDNA3, 16 GB), driver 32.0.32029.2010, Ryzen 7 8700F, 16 GB RAM, Windows 11 (build 26300), Rust 1.98.1 from rust-toolchain.toml. Baseline main at 4e17478: cargo test --workspace --locked gives 496 passed, 0 failed, 7 ignored. The "without the fix" run checks out main's version of the PR's non-test files and keeps the PR's new test. No game files used.

AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this comment; posted at my request.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7146076990 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/152#issuecomment-7146076990). Originally posted by [bawhen](https://github.com/bawhen) on 2026-11-24T22:18:54Z. --- Checked on an RX 7700 (RDNA3, driver 32.0.32029.2010) and WARP. `cargo test -p victory-shader --locked --lib float_compares_that_are_always_false_or_true -- --nocapture` | build | result | |---|---| | PR head `08cb7ed` | passes on hardware and WARP | | PR test, `lower.rs` and `bitcode.rs` from `main` | hardware pass is fine; then `warp: dispatch failed: The GPU device instance has been suspended`, the WARP device removal from #136 | So on this card it's a WARP/CI fix only: the RX 7700 handles `fcmp false`/`fcmp true` correctly. Setup: AMD Radeon RX 7700 (RDNA3, 16 GB), driver 32.0.32029.2010, Ryzen 7 8700F, 16 GB RAM, Windows 11 (build 26300), Rust 1.98.1 from `rust-toolchain.toml`. Baseline `main` at `4e17478`: `cargo test --workspace --locked` gives 496 passed, 0 failed, 7 ignored. The "without the fix" run checks out `main`'s version of the PR's non-test files and keeps the PR's new test. No game files used. *AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this comment; posted at my request.*
avt0m4t48 commented 2026-11-25 02:10:08 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T01:32:29Z.


Rechecked the current PR head dbd9a894099845977fca87c8fdf66a4115897c98 on Windows Server 2025 with VICTORY_WARP=1. The exact float_compares_that_are_always_false_or_true regression passed for all eight opcode variants, with no skipped device. The verification commit adds only the workflow, and the job checks that before running the test.

Windows WARP run

AI-assisted using Codex.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7149664458 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/152#issuecomment-7149664458). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T01:32:29Z. --- Rechecked the current PR head `dbd9a894099845977fca87c8fdf66a4115897c98` on Windows Server 2025 with `VICTORY_WARP=1`. The exact `float_compares_that_are_always_false_or_true` regression passed for all eight opcode variants, with no skipped device. The verification commit adds only the workflow, and the job checks that before running the test. [Windows WARP run](https://github.com/avt0m4t48/victory-fork/actions/runs/45526155299) AI-assisted using Codex.
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/152:upstream-pr/152'
git switch 'upstream-pr/152'

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/152'
git switch 'upstream-pr/152'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/152'
git switch 'upstream-pr/152'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/152'
git switch 'main'
git merge --squash 'upstream-pr/152'
git switch 'main'
git merge --ff-only 'upstream-pr/152'
git switch 'main'
git merge 'upstream-pr/152'
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
fxceless/victory-fork!152
No description provided.