Shaders: lower v_cmp_{f,t}_{i64,u64} constant 64-bit compares #1684
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1685"
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 Calvix2k on 2026-11-24T20:44:42Z.
Implements #1531.
Ports the fix from @davi713albano-coder's fork (commit 41715fc by Davi713), applied unchanged onto
ffe310e; the commit keeps its original author.Summary
The
u64 | i64arm ofemit::lower::comparefell through toErr("a 64-bit compare")for the constant-true and constant-false compares, while the 32-bit arm handled them withself.lane(inst, Some(op == "t")).v_cmp_{f,t}_{i64,u64}andv_cmpx_{f,t}_{i64,u64}now short-circuit beforesrc64, so a constant compare does not set theInt64flag (SFI0bit 0x8000) it does not need.Test
New synthetic compute test
v_cmp_f_and_t_64bit_match_rdna2coversv_cmp_f_i64,v_cmp_t_i64,v_cmp_f_u64andv_cmp_t_u64: dxil.dll validation, absence of theInt64flag, and execution on D3D12 hardware/WARP.Validation
cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests— passed (102 tests, 1 ignored).cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings— passed.cargo xtask policy— passed (154 files).Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:40:10Z.
Review: APPROVED
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.v_cmp_f_i64/v_cmp_t_i64/v_cmp_f_u64/v_cmp_t_u64 constant 64-bit compares: 59-line diff with an RDNA2 reference test.
Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T21:40:05Z.
Hardware run on the RX 7800 XT (RDNA3), Windows 10 x64, Agility SDK 1.616 for SM 6.6:
cargo test -p victory-shader --locked v_cmp_f_and_t_64bit_match_rdna2 -- --test-threads=1 --nocapture— 1 passed, 0 failed on the hardware backend.Int64flag on AMD hardware.Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T22:14:11Z.
Rebased onto
70564ae; only the test module conflicted (upstream added more test helpers). Both sets are kept. cargo check -p victory-shader --tests --locked passes; the test itself was already verified on a Radeon RX 7800 XT before the rebase and is unchanged.Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T22:51:59Z.
NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
d7536bd(onmain70564ae).v_cmp_f_and_t_64bit_match_rdna2passes on the hardware adapter.AI-assisted (Claude Code). Synthetic tests only.
upstream-sync referenced this pull request2026-11-25 01:07:47 +00:00
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:33:28Z.
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main:mainhas moved since the last triage, and the branch now conflicts incrates/victory-shader/src/emit/lower.rsandcrates/victory-shader/src/emit/valu_tests.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T04:23:48Z.
Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at
d869333.cargo test --workspace --locked --no-fail-fast-> all green: 0 passed, 0 ignored, 0 failed.Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T09:06:01Z.
Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at
d869333.cargo test --workspace --locked --no-fail-fast-> 697 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T10:14:53Z.
Hardware run on an RX 7800 XT (RDNA3), Windows 10 19045, SM 6.6 via the Agility runtime for the test binaries (#486):
victory-shaderlib suite 248 passed, 0 failed, 3 ignored, including the 64-bit constant-compare cases. The lowering is exercised on the card here as well as on CI's device.Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-26T13:53:16Z.
Rebased. The
f/tearly return now runs before upstream's dword-wise comparison, so both the AMD dword order and the float predicates are handled by one path.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T12:05:41Z.
I checked
803c7f3on Windows with WARP 1.0.22 and DXIL validation. The existing fourv_cmpcases pass. 189e553 adds a test directly on this head for constant signed and unsignedv_cmpx, both true and false.It uses two operand sets for each opcode, with the lane initially active and inactive. A write between the compare and restoring EXEC verifies which lanes ran, and the emitted
SFI0Int64 bit is clear in all eight shaders. With both fixtures on63bcca4, they fail during lowering witha 64-bit compare. On the test branch both pass, and the full VALU group is 37/37. Strict all-targets/all-features shader Clippy and asset policy passed.If you take the test, please keep its Git author. If folding it in, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex. Synthetic WARP testing only.
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.