Shaders: omit DXIL selects with identical values #3796
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3796"
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 andrewpozdnakov7-jpg on 2026-11-28T21:32:03Z.
Return the shared value directly when the two arms of a DXIL select are the same IR value. The existing liveness pass can then drop calculations used only by that condition. The bitcode regression checks that a discarded 64-bit comparison stops contributing the integer-width flag. A select between distinct values keeps the comparison live.
A generated compute shader selected the same register on both sides of a dynamic comparison. Its DXIL size fell from 2,052 to 1,984 bytes. The distinct-register control remained at 2,052 bytes. Both versions returned the expected words for all 32 WARP readbacks per build, including inputs yielding both comparison results. Both shaders passed Microsoft's signed DXIL validator. The two existing select semantics tests also passed on app-local WARP 1.0.22 with Agility 1.620.2.
The focused bitcode tests, both strict shader Clippy configurations and the asset policy passed.
Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T21:34:51Z.
Windows CI passed on
d8dba2c, including both Clippy configurations and the workspace tests. The new bitcode regression checks that the comparison stays live with two distinct values and becomes dead with the same value. The signed WARP fixture returned all 32 expected words per build. The matching-value shader became 68 bytes smaller. The distinct-value control stayed at 2,052 bytes.The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T21:42:42Z.
I tested #3796 together with #3791 and #3792.
9e9ea39resolves the overlapping bitcode tests and retains the identical-select and live-i64 regressions. Both exercise the sharedplan_with_usesentry point.I built main
63bcca4, exact #3796 headd8dba2c, and the combined branch on Windows. In each build the two generated shaders produced all 32 expected readbacks on WARP 1.0.22 with Agility 1.620.2. Both containers on the combined branch are byte-identical to #3796 and pass Microsoft's DXIL validator 1.9.2609.5. The identical-select container is 1,984 bytes versus 2,052 on main. The distinct-select control is 2,052 bytes and byte-identical across all three builds.All 15 active bitcode tests and all three select tests passed on the combined branch. Strict Clippy passed with default features and all features, as did the asset policy check.
Integration branch. Please retain the Git authors on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding these changes into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-28T22:58:35Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
d8dba2ceded4705925b92563dec4053503cd0198, base/parent63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-shader --lib -- emit::bitcode::tests::same_select_operands_do_not_keep_the_condition_live --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 305 filtered, exit 0.git grep -Ffor the test name on the base returned no match (test is new on this PR);git diff --check HEAD^ HEADclean (1 file, +24/-0).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T23:38:00Z.
Full
victory-shader --lib --features hoston AMD hardware: RX 5700 XT (Navi 10, RDNA1, driver 32.0.21045.29003, Windows 11 26200), headd8dba2cedon63bcca4: 303 passed; 0 failed; 3 ignored. That suite includes the GPU semantics tests, which run on the hardware adapter and WARP in turn. I didn't check which of them reach the changed code. The newsame_select_operands_do_not_keep_the_condition_livepasses; it runs on the CPU.AI use: Claude Code (Claude Opus 5.5).
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.