fix(victory-shader): lower v_cmp_f and v_cmp_tru floats as constant booleans #448
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!448
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-448"
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?
@mauroalvare on GitHub · 2026-11-26 19:08 UTC · original
mauroalvare:fix/victory-fcmp-const-predicates→main· +51 −3 · 4 files · 3 commits · openWhat failed
In
third_party/victory/crates/victory-shader/src/emit/lower.rs, floating-point constant-result compares (v_cmp_f_f32,v_cmp_tru_f32,v_cmp_f_f16,v_cmp_tru_f16, and theirv_cmpx_*forms) lowered to LLVM/DXILfcmp false(pred::FALSE = 0) andfcmp true(pred::TRUE = 15).While integer constant compares (
v_cmp_f_{u32,i32,u16,i16},v_cmp_t_{u32,i32,u16,i16}) already lowered directly to constant lane booleans (self.lane(inst, Some(op == "t"))), emittingfcmp false/fcmp truein DXIL caused D3D12 WARP to fail at dispatch with GPU device removal (DXGI_ERROR_DEVICE_SUSPENDED) on base50936c0:How to reproduce
From
third_party/victory:The synthetic compute shader encodes
v_cmp_f_f32(0x000),v_cmp_tru_f32(0x00f),v_cmp_f_f16(0x0c8), andv_cmp_tru_f16(0x0ef) followed byv_cndmask_b32, validates the emitted DXIL withdxil.dll, and dispatches across finite values, infinities, quiet NaNs, and signalling NaNs on both the hardware GPU and WARP.What changed
third_party/victory/crates/victory-shader/src/emit/lower.rs: Lower"f"and"tru"for"f32" | "f16"viaself.lane(inst, Some(op == "tru")), matching the existing"f" | "t"integer compare path and avoidingfcmp false/fcmp truein emitted DXIL.third_party/victory/crates/victory-shader/src/emit/bitcode.rs: Markpred::FALSEandpred::TRUE#[allow(dead_code)]with a note explaining why they are not emitted (mirroringpred::ONE).third_party/victory/crates/victory-shader/src/emit/valu_tests.rs: Add synthetic regression testv_cmp_f_and_tru_lower_as_constant_booleanscoveringv_cmp_f_f32,v_cmp_tru_f32,v_cmp_f_f16, andv_cmp_tru_f16with normal, infinite, qNaN, and sNaN inputs.Verification
Tested on Windows x64, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver
621.40), WARP, anddxil.dll(10.0.26100.0), base SHA50936c0:50936c0:v_cmp_f_and_tru_lower_as_constant_booleansfailed (warp: dispatch failed: DXGI_ERROR_DEVICE_SUSPENDED).cargo test --locked -p victory-shader v_cmp_f_and_tru_lower_as_constant_booleans -- --test-threads=1 --nocapture: 1 passed; 0 failed (RTX 5070 Ti + WARP +dxil.dll).cargo test --locked -p victory-shader -- --test-threads=1: 258 passed; 0 failed; 2 ignored (both ignored are benchmarks:bench_writeandbench_opt).cargo xtask policy: asset policy: 215 files ok.All measurements are from synthetic unit tests only (no game files or game runs).
AI assistance
Assisted by AI (Antigravity) for root-cause analysis, synthetic test authoring, implementation, and verification on local hardware.
8e7c05fac1to727118c1d2534396239atob50d2ee9dd@mauroalvare on GitHub · 2026-11-26 23:37 UTC · original
The Vice-Tay port is up in
b50d2ee. The constant false and true comparisons passed on native D3D12 and WARP. Vice-Tay keys the shader cache by translator version in the default mode, so the port bumps that version from 2 to 3.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.