Shaders: always-false and always-true float compares lower as constants #160
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/160"
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?
Imported from fxceless/victory-fork. Originally posted by Peppacodes on 2026-11-24T22:03:21Z.
v_cmp_f_{f32,f16}andv_cmp_tru_{f32,f16}lowered tofcmp falseandfcmp true(predicates 0 and 15).Why this matters
The fix. These compares are false and true whatever the operands, NaNs included (RDNA2 ISA). So they now lower as constants, as the integer
v_cmp_f/v_cmp_talready do.FALSEandTRUEstay in the predicate table, unused.How it was found. A sweep of every 32-bit VALU instruction on the hardware adapter against WARP. With this change, all 62 compares run and agree on both.
Tested on this branch's base (
2119b0e, the same tree as4e17478) plus this commit, on Windows 11 with an RTX 5080:float_compares_that_are_always_false_or_true: f32 and f16, ordinary and NaN operands, on the hardware adapter and on WARP. Onmain, WARP's dispatch fails with the device suspended.cargo clippy --workspace --all-targets --locked -- -D warnings, with and without--all-features: clean.cargo test -p victory-shader -p victory-hle -p victory-loader --locked: 337 passed, 0 failed, 2 ignored. This was with the two other PRs from this account applied as well.AI-assisted (Claude Code).
Imported from fxceless/victory-fork. Originally posted by DovisLe on 2026-11-24T23:43:40Z.
Tested on a Radeon 860M (RDNA 3.5) and WARP, at
21ad2df(base2119b0e).float_compares_that_are_always_false_or_truemain'slower.rsandbitcode.rswarp: dispatch failed: The GPU device instance has been suspended.So AMD hardware, like the RTX 5080, runs
fcmp false/fcmp true, and only WARP loses its device on them.cargo test -p victory-shader --locked --lib: 211 passed, 0 failed, 2 ignored (main: 210 passed).cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.self.lane(inst, Some(op == "tru")), the same path the integerv_cmp_f/v_cmp_talready take, sov_cmpx_*still writes EXEC and the VOP3 forms still write their SGPR pair.No game files used.
AI-assisted (Claude).
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.