Shaders: lower v_cmp_{f,t}_{i64,u64} constant 64-bit compares #1531
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#1531
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@davi713albano-coder on GitHub · 2026-11-24 18:49 UTC · original
Summary
In
emit::lower::compare, the"u32" | "i32" | "u16" | "i16"arm handles constant-false ("f") and constant-true ("t") compares viaself.lane(inst, Some(op == "t")), while the"u64" | "i64"arm fell through toErr("a 64-bit compare").This branch adds
"f" | "t"handling to the"u64" | "i64"compare arm (coveringv_cmp_{f,t}_{i64,u64}andv_cmpx_{f,t}_{i64,u64}), short-circuiting beforeself.src64so constant 64-bit compares do not spuriously setflags::INT64(0x8000inSFI0).Changes (
shader/cmp64-f-and-t, commit41715fc)crates/victory-shader/src/emit/lower.rs: handle"f" | "t"in the"u64" | "i64"arm ofcompare()beforesrc64.crates/victory-shader/src/emit/valu_tests.rs: add synthetic compute testv_cmp_f_and_t_64bit_match_rdna2testingv_cmp_f_i64,v_cmp_t_i64,v_cmp_f_u64, andv_cmp_t_u64againstdxil.dllvalidation,SFI0Int64flag absence, and D3D12 WARP execution.Branch & Verification
main(ffe310e): https://github.com/Marvisak/VIctory/compare/main...davi713albano-coder:VIctory:shader/cmp64-f-and-twindows-latest): https://github.com/davi713albano-coder/VIctory/actions/runs/45461692979cargo clippy --workspace --all-targets --locked -- -D warnings: passedcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passedcargo test --workspace --locked(includingxtaskasset-policy check,dxil.dllvalidation, and D3D12 WARP tests): 343 passed, 0 failed (emit::valu_tests::v_cmp_f_and_t_64bit_match_rdna2 ... ok)(No game data used. AI-assisted.)
@studiostephe on GitHub · 2026-11-25 03:55 UTC · original
In
emit::lower::compare, the"u64" | "i64"arm callsself.src64(...)before matching the op, andsrc64unconditionally setsflags::INT64. Sov_cmp_f_i64/v_cmp_t_i64/v_cmp_f_u64/v_cmp_t_u64— constant compares that read no 64-bit source — still take the SFI0Int64feature (0x8000), where the"u32" | "i32" | "u16" | "i16"arm already short-circuitsf/tthroughself.lane(...)before touching the sources.The fix mirrors the integer arm: handle
f/tin the 64-bit arm beforesrc64, so constant 64-bit compares emit a lane constant and never setINT64.Verified:
v_cmp_f_and_t_64bit_do_not_require_int64builds each of the four constant compares, reads the SFI0 feature payload out of the emitted container, and asserts theInt64bit is clear; a realv_cmp_eq_i64is the control and must set it (so the check is not vacuous).valu_tests, which is#[cfg(all(test, windows))]because that module imports the D3D12host. So I could not run it on this Mac; I cross-compiled it:cargo check -p victory-shader --profile test --target x86_64-pc-windows-msvc: clean.cargo clippy -p victory-shader --profile test --target x86_64-pc-windows-msvc: 0 warnings.cargo test -p victory-shader --locked(the 144 non-Windows tests): 144 passed, 0 failed, 2 ignored — thelower.rschange introduces no regression in the runnable suite.Not covered: I could not execute the new test against
dxil.dll/WARP (no Windows here), and the pre-existing fmt drift inlower.rs(unrelated long lines) is left as-is; my added lines are fmt-clean.Local commit
4808a39on a clean940d32f(two files, +44/−1).qwen3.8_27b running locally on an M1 Mac
shout out to Digital Debris Los Angeles
@Marvisak on GitHub · 2026-11-25 10:25 UTC · original
Automated triage for the maintainers.
Confirmed on
main: incrates/victory-shader/src/emit/lower.rs,compare, the"u64" | "i64"arm reads both 64-bit sources (src64, which sets the 64-bit-integer flag) and then has no case forfort, sov_cmp_{f,t}_{i64,u64}fail translation with "a 64-bit compare" and the program is dropped. The 32/16-bit arm already lowersf/tto a lane constant. Open pull request #1685 carries this change, so please continue on that PR rather than the fork branch. The diff in the comment takes the same approach.Generated by Claude Code