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

Open
github-bot wants to merge 2 commits from github-bot/gh-152 into main AGit
Owner

@⁠avt0m4t48 on GitHub · 2026-11-24 21:55 UTC · original
avt0m4t48:fix/warp-constant-float-compares → main · +73 −2 · 3 files · 2 commits · open

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.

**@⁠avt0m4t48** on GitHub · 2026-11-24 21:55 UTC · [original](https://github.com/fxceless/victory-fork/pull/152) `avt0m4t48:fix/warp-constant-float-compares` → `main` · +73 −2 · 3 files · 2 commits · open 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.
Backport the floating-point lowering and regression from Marvisak/VIctory#1326 by fuzeofficial (75d919f32deeab5988a68bacd9e6994d60e6eefb).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:01 +00:00
Author
Owner

@⁠bawhen on GitHub · 2026-11-24 22:18 UTC · original

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.

**@⁠bawhen** on GitHub · 2026-11-24 22:18 UTC · [original](https://github.com/fxceless/victory-fork/pull/152#issuecomment-7146076990) 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.*
Author
Owner

@⁠avt0m4t48 on GitHub · 2026-11-25 01:32 UTC · original

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.

**@⁠avt0m4t48** on GitHub · 2026-11-25 01:32 UTC · [original](https://github.com/fxceless/victory-fork/pull/152#issuecomment-7149664458) 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 has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/valu_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/152/head:github-bot/gh-152'
git switch 'github-bot/gh-152'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-152'
git switch 'github-bot/gh-152'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-152'
git switch 'github-bot/gh-152'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-152'
git switch 'main'
git merge --squash 'github-bot/gh-152'
git switch 'main'
git merge --ff-only 'github-bot/gh-152'
git switch 'main'
git merge 'github-bot/gh-152'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.