Shader: propagate float values across selects/phis and cache bools across dominators #1397
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1397"
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 Marvisak/VIctory. Originally posted by wbkepler on 2026-11-24T17:43:35Z.
Summary
Rebased cleanly onto
upstream/main(ffe310e):Val::F32inemit/lower.rsandinfer_float_phisso float ALU results, float inputs/interpolations, non-d16image/typed-buffer loads, guarded float writes, floatv_mov_b32/v_cndmask_b32, and float-only SSA phis stay nativef32without eagerf32<->i32bitcast roundtrips.i32<->f32/undef, andbitcast(bitcast(x))roundtrips directly inbitcode::Module::cast, and constructsf32constants directly inLower::fsrc.dxil_idom) fromir::idoms, guarded splits, and critical edges soLower::booleanandLower::atomreuse dominatingi1values without leaking across non-dominating sibling blocks.Verification
cargo clippy -p victory-shader --all-targets— passedcargo test -p victory-shader— passedcargo xtask policy— passedImported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T17:52:37Z.
Review: APPROVED
Float phi inference + bool caching across dominators. infer_float_phis is a proper lattice (Const/Float/Int, Int absorbing): only phis whose every reachable arg is float-or-const with at least one float producer become native float phis — inputs are classified conservatively (only f32 vertex attributes and Position), float producers enumerated by opcode/format, and plain mov/cndmask propagate kinds with guard-aware old-value reads. The 32-iteration fixpoint cap is fine for a height-3 lattice. The DXIL idom mapping for the bool cache looks right (IR idom -> dominator tail block, self skipped). Bitcast same-type no-op is trivially correct. +2 macOS tests green; the valu/diff runs on Windows are the real check for the cache. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main
ffe310e,cargo test -p victory-shader --locked. Shader execution tests (valu_tests/host/diff_tests) are#[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. 98 passed, 0 failed.Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-24T19:50:32Z.
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
a78fc2contomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 123, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:25:25Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/lower.rs,crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-27T17:21:53Z.
I checked one program offline on an RX 9070 XT with RADV. On current main it failed SPIR-V validation (0/1 pipelines); on this PR head (
a78fc2cb8), it translated, validated, and created a pipeline (1/1). The PR did not apply cleanly to current main, so I tested the PR head rather than an isolated application on that base; other base differences could contribute. Not tested on NVIDIA hardware.Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-27T17:22:22Z.
On RDNA4/RADV, program 321 passes on this PR head (1/1), but the change conflicts with current main and needs a rebase before I can verify it on that base.
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.