Shaders: v_cmp_f and v_cmp_tru are constants (fcmp false/true removed WARP's device) #173
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!173
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-173"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@alexdeliu on GitHub · 2026-11-25 18:49 UTC · original
alexdeliu:fix/v-cmp-f-tru-constant→main· +32 −0 · 2 files · 1 commits · openWhat
The always-false and always-true f32/f16 compares (
v_cmp_f_f32,v_cmp_tru_f32,v_cmp_f_f16,v_cmp_tru_f16) now lower to the constants they mean, instead offcmp false/fcmp true. This is the same change as upstream Marvisak/VIctory77053a0. f64 has its own path (compare_f64) and is unchanged.Why
A dispatch with
fcmp falseorfcmp truemakes WARP remove its device ("The GPU device instance has been suspended"). The cross-device fuzzer (#129) lost WARP on all four opcodes. WARP is what a GPU-less CI runner has.Tested
One machine: RX 9070 (RDNA4, 32.0.32029.2010), Ryzen 7 7700 iGPU (gfx1036, RDNA2, 32.0.21045.29003) and WARP. Windows 11 Pro 26200;
VICTORY_DXIL= dxil.dll 1.8.2502.11. No game data.New test
v_cmp_f_and_tru_are_constants_and_keep_the_device: all four opcodes, including NaN operands, on every host. Like the other VALU tests, it runs on the hardware adapter and on WARP.000ffddVICTORY_WARP=1cargo test -p victory-shader --lib -- --test-threads=1:000ffddcargo clippy -p victory-shader --all-targets --locked: no new warnings (the same 10 as on main).AI use: Claude Code (Claude Opus 5.5) found it with the fuzzer, ported the upstream change and ran the tests on my machine.
🤖 Generated with Claude Code
@KernelSmoker on GitHub · 2026-11-25 18:55 UTC · original
Independent verification on PR head
5dd0f7d(Bazzite Linux 45 x86_64, Rust 1.98.1, NVIDIA RTX 3090 driver 620.73.04):cargo test --locked -p victory-shader: 185 passed, 0 failed, 6 ignored (lib) + 3 passed, 0 failed, 1 ignored (tests/resource_tracking.rs).victory-shadertest binary run under GE-Proton 10-34 / Wine 10.0 / vkd3d-proton 3.0.0 on NVIDIA RTX 3090:emit::valu_tests::v_cmp_f_and_tru_are_constants_and_keep_the_device: 1 passed, 0 failed (note: under Wine/vkd3d-protonEnumWarpAdapterfalls back to the RTX 3090 rather than Windows WARP, so this verifies the NVIDIA hardware path).cargo check --workspace --all-targets --locked --target x86_64-pc-windows-gnu: passed.Minor note:
"f" => pred::FALSEand"tru" => pred::TRUEin the innermatch opright below the new"f" | "tru"arm incrates/victory-shader/src/emit/lower.rsare now unreachable (fine if kept minimal to match upstream77053a0).@HAL9000RELOADED on GitHub · 2026-11-25 22:53 UTC · original
Windows 10 data point for
5dd0f7d: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045), Agility SDK 1.620 (#44), system WARP 10.0.19041.5794. Base:a7fa35e(main + #44).v_cmp_f_and_tru_are_constants_and_keep_the_devicepasses on the card and on WARP. Wholevictory-shader: 278 passed, 0 failed.lower.rschange: it passes too, on both devices (278 passed, 0 failed). No device removal.So this Windows 10 WARP doesn't remove its device on
fcmp false/fcmp true, and the 7900 XTX doesn't either. The test catches the old lowering only on the newer WARP you saw it on (Windows 11 26200). The change is still right, it just can't be checked as a regression here.@MamaLeVrai on GitHub · 2026-11-26 00:18 UTC · original
RDNA2 result. Hardware: RX 6950 XT, Windows 11 build 26300, Rust 1.98.1. This PR (
5dd0f7d) merged onmain4f62c2a. Command:cargo test --release -p victory-shader --lib, two runs.main: 275 passed, 2 failed.v_cmp_f_and_tru_are_constants_and_keep_the_devicepasses on the RX 6950 XT and on WARP.The 2 failures are the same on
main:scalar_counted_in_a_divergent_loop_read_after_itandscalar_counted_in_nested_divergent_loops, the RDNA2 wave-size tests that #110 and #204 fix. So nothing regresses on this card. Not run in the game.harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300
AI-assisted (Claude Code); no game data.
@lcg007xd-c on GitHub · 2026-11-25 21:17 UTC · original · reviewed
Verified on Linux (Rust 1.98.1)
cargo test -p victory-shader --libwith5dd0f7dmerged into current main (--no-commit): 196 passed, 0 failed, 6 ignored. The new test is invalu_tests(cfg(all(test, windows))), so it does not run on Linux.cargo clippy -p victory-shader --target x86_64-pc-windows-msvc --lib --tests: the same 10 warnings as main and none new. This also type-checks the new Windows-only test.git merge --no-commit --no-ffinto main: merges cleanly.llvm-mc --disassemble -triple=amdgcn -mcpu=gfx1030on the test's words givesv_cmp_f_f32_e64 s20, v1, v2,v_cmp_tru_f32_e64,v_cmp_f_f16_e64,v_cmp_tru_f16_e64andv_cndmask_b32_e64 v0, 0, 1, s20. The opcodes in the test are right.lower.rs(not committed) that lowers each compare plus thev_cndmaskthroughlower_with. I took the bitcode out of the DXIL part and ranllvm-bcanalyzer --dump:INST_CMP2record.v_cmp_lt_f32, as a control, still hasINST_CMP2 ... op2=4(olt).INST_CMP2 op2=0/op2=15and the f16 ops the same. Those arefcmp false/fcmp true, so the PR does remove them.git statuswas clean afterwards.f/tru(compare_f64,lower.rs:9894), as the description says.Findings
emit/valu_tests.rs:438-441). The new test was inserted between the/// v_cmp_lg_* is "less or greater" ...comment andfn v_cmp_lg_is_false_for_nan. That comment now documentsv_cmp_f_and_tru_are_constants_and_keep_the_device, and thelgtest has none. Moving the new test, with its own///line if you like, above that comment block fixes it.lower.rs:10006"f" => pred::FALSEandlower.rs:10018"tru" => pred::TRUE). The new"f" | "tru"arm takes these first. Removing them, or swapping them for a comment, would stop a later reader from thinkingfcmp false/truecan still be emitted. This is optional if you want to stay byte-for-byte with upstream77053a0.The change itself looks right to me. I'm leaving a comment rather than an approval because of item 1 and because I could not run the WARP test.
Not verified
Reviewed with Claude Code.
@adrianmjim on GitHub · 2026-11-26 19:40 UTC · original
I tested
5dd0f7don native Windows 11 (26300) with an RX 7900 XT (RDNA3, driver 32.0.32029.2010), Rust 1.98.1 and the Windows SDK 10.0.26100dxil.dll. This adds a run without the fix on Windows 11's WARP:000ffdd, without thelower.rschange. It fails on Windows' WARP adapter with "dispatch failed: The GPU device instance has been suspended" (valu_tests.rs:200). With the PR, it passes.cargo test -p victory-shader --lib -- --test-threads=1gives 267 passed, 0 failed and 6 ignored, against 266 on000ffdd.victory translate --validate --host-lanes 32-64over the game's wholeshaders.rpf. The counts are the same as on000ffdd: VS/PS 14247/14247, CS 2682/2682 and MS 8694 of 8765 validate, with the same 195 + 71 refusals. A local per-program DXIL hash shows 0 of 25623 programs changed.v_cmp/v_cmpxf/trucompares at all (f16, f32 or f64). So this title never reaches the changed path, and the fix matters for WARP and for code that uses these opcodes.Not tested: the current main (
4f62c2a), other GPUs, in-game runs.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.