Shaders: apply v_mov_b32 and v_cndmask_b32 abs/neg modifiers bitwise #1275
No reviewers
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!1275
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1275"
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?
@Sakura-Byte on GitHub · 2026-11-24 17:01 UTC · original
Sakura-Byte:pr/bitwise-mov-cndmask-883→main· +401 −16 · 3 files · 2 commits · openFixes #883.
Summary
raw_src/src_bits(crates/victory-shader/src/emit/lower.rs): Reads source operand raw bits (preserving DPP cross-lane inputs and SDWA selection) and appliesabs(& 0x7FFF_FFFF) andneg(^ 0x8000_0000) bitwise, while keepingsrc()rejecting modifiers on integer ALU instructions.v_mov_b32andv_cndmask_b32: Usessrc_bitsonv_cndmask_b32and onv_mov_b32whenclampandomodare unset, preserving exact bit patterns across denormals,+-0.0, infinities, andsNaN/qNaNpayloads instead of quieting or flushing via float operations.v_mov_b32withclamporomodcontinues to take the float output modifier path.crates/victory-shader/src/emit/valu_tests.rs): Addedv_mov_b32_bitwise_abs_and_neg,v_mov_b32_sdwa_and_dpp_apply_bitwise_abs_and_neg, andv_cndmask_b32_applies_abs_and_neg_bitwiseacross 16 floating-point bit patterns, SDWA byte sign-extension + neg, VOP3 clamp/omod, and DPP bitwise lowering inspection (Module::func_names/Module::inst_linesandLowered::op_names/Lowered::insts).Verification
Ran cleanly on clean
origin/main(ffe310e):cargo xtask policy:asset policy: 154 files okcargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)VICTORY_D3D12_WARP=1 VICTORY_WARP=1 cargo test -p victory-shader --locked -- --test-threads=1:123 passed; 0 failed; 1 ignored(including all16 passed; 0 failedinemit::valu_tests, with only the existing release-only benchmarkemit::bitcode::tests::bench_writeignored;dxil.dllvalidation ran;v_mov_b32_dppvalidates DXIL and checks bitwisebin:Xor/bin:Andwithoutdx.op.unary.f32, executing when aWaveSize(32)compute PSO is supported).AI-assisted; synthetic tests only, zero game assets.
@marquezinii on GitHub · 2026-11-24 19:12 UTC · original
On an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at
2d44b99,cargo test -p victory-shader --lib -- --test-threads=1 --nocapturegives 122 passed, 1 failed:The values are fine: in each
run_casesthe hardware leg runs first, and it passed every case. The failure comes from the test's gate.dpp_neg) declaresWaveSize(32)(waveReadLaneAt/waveGetLaneIndexin the dump).can_run_dpponly asks whether the hardware adapter can make that pipeline, andrun_casesthen runs it on hardware and WARP.CreateComputePipelineStatereturnsE_INVALIDARG.The fix is a per-host wave-size check like
run_cases_with_wave_sizein #1412/#1416, or checkingcompute_pipelinefor each host inside the loop instead of once for the hardware.@Sakura-Byte on GitHub · 2026-11-24 19:48 UTC · original
Thank you @marquezinii for catching that and pinning down the exact cause! You were right: the old
can_run_dpppre-check only probed the hardware adapter and then ranrun_casesunconditionally across both hardware and 4-lane WARP, hittingE_INVALIDARGon WARP'sCreateComputePipelineStatefor theWaveSize(32)DPP shader.Fixed in commit
cdbe178(cdbe1789185578baa7130eae642f4fec58287687) incrates/victory-shader/src/emit/valu_tests.rs:run_casesintorun_cases_withand addedrun_cases_if_supported, which checkshost.compute_pipeline(shader)per host inside the("hardware", false)/("warp", true)loop and skips only hosts whose wave size refuses to build the pipeline (instead of panicking on WARP while still asserting that at least one SM 6.6 device was found).v_mov_b32_dppexecution check inv_mov_b32_sdwa_and_dpp_apply_bitwise_abs_and_negtorun_cases_if_supported.Re-verified on
cdbe178(Windows 11, NVIDIA GeForce RTX 5090 D + WARP):cargo xtask policy:154 files okcargo clippy --workspace --all-targets --locked -- -D warnings(default and--all-features):0warningscargo test -p victory-shader --locked --lib -- --test-threads=1(with hardware + WARP): 123 passed, 0 failed, 1 ignored (v_mov_b32_sdwa_and_dpp_apply_bitwise_abs_and_negexecuted and passed all 16 cases on RTX 5090 D while cleanly skipping 4-lane WARP)VICTORY_WARP=1 VICTORY_D3D12_WARP=1 cargo test -p victory-shader --locked --lib -- --test-threads=1 v_mov_b32_sdwa_and_dpp_apply_bitwise_abs_and_neg: 1 passed, 0 failedAI-assisted; synthetic tests only, zero game assets.
@marquezinii on GitHub · 2026-11-24 19:55 UTC · original
Confirmed at
cdbe178on the same RTX 5070 (driver 621.40, Windows 11 26300, Rust 1.98.1).cargo test -p victory-shader --lib -- --test-threads=1 --nocapturegives 123 passed, 0 failed, 1 ignored. Inv_mov_b32_sdwa_and_dpp_apply_bitwise_abs_and_negthe DPP check runs on the hardware adapter and passes, and WARP now printscompute_pipeline unsupported ...; skippedinstead of failing.@Marvisak on GitHub · 2026-11-25 01:20 UTC · original
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
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.