Repository navigation
Shaders: handle redundant partial descriptor writes and lane-preserving VGPR moves (#750) - #1229
Ctrl-Alt-Haze wants to merge 2 commits into
Conversation
|
Setup: Linux, RX 9070 XT, RADV (Mesa 26.3.1), dxil-spirv master, spirv-val 1.3. Your head folded onto a base of origin/main
No program gained or lost and the failure table is identical to the base, reason for reason: nothing in this capture reaches the class you handle, so this is a no-regression result only (same 10 SPIR-V validation failures as the base). Not tested: in-game. |
|
@pablogonz12 Thank you for running the 768-program Linux/RADV ( |
|
@Zipettte Thanks for verifying |
|
Scope of the PR, as described: handle redundant partial descriptor writes (#750) and lane-preserving VGPR moves/extracts/selects ( Measurement (title data, local; counts only)
The pattern that stays out (instructions only)One representative program; the others share the shape:
Where the tracker stops (confirmed by instrumenting So the descriptor is "uniform sampler in the else lanes, non-descriptor data in the then lanes". The console runs the waterfall over both kinds of lanes (sampling with whatever the then lanes hold). Whether the then lanes' results are dead is not proven here: the sample's result is used afterwards under the full mask, and I did not follow it further. Suggestion for the PR (or a follow-up)
Counts and instruction shapes only; no title bytes. Instrumentation was local and is not part of any branch. |
|
@SantannaCarlos Thank you so much for testing I've pushed What changed (
|
|
Thanks for implementing the dead-lane rule in
Why the rule does not fire on the title's programs. The synthetic shader matches the shape up to the waterfall: per-lane if/else, a uniform sampler loaded and copied by
What remains is a question of intent, not of tracking:
Either way, in our measurement the PR changes nothing for the title's programs and regresses nothing (same totals, no validator changes). Counts and instruction shapes only; no title bytes. |
|
Thanks @SantannaCarlos for re-testing We'll keep Option 1 — keeping the strictly sound dead-lane proof rule as-is rather than substituting a fallback descriptor on potentially live non-descriptor lanes — unless the maintainers explicitly prefer adding an opt-in/logged fallback shortcut (Option 2). |
…reserving VGPR moves
|
Rebased onto upstream Verified locally on Windows 11 x64 / NVIDIA GeForce RTX 5070 Ti + WARP:
|
f55ba49 to
da25359
Compare
|
Automated triage for the maintainers. Closing because this change is already in rebased, but still 2,130 lines rewriting main's lane-value tracking for #750 and 'first lane of computed VGPRs', classes main brought to 0 on the title's programs; no count of programs it adds on main. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Summary
Addresses #750 (
joined_descriptor_redundant_partial_write) and extendsvictory-shaderresource tracking for"a descriptor read from the first lane of computed VGPRs".(Note: #1182 also addresses #750 for plain
v_mov_b32; this PR covers both #750 and the broader computed-VGPR move/extract/select family described below.)Changes
crates/victory-shader/src/structure.rs:Bools::var_booland non-mutatingBools::meet_with_facts(meet_facts_in) to enforce equivalence/complement groups overAtom::Lanes and check leaf consistency without cloning or mutatingBools.crates/victory-shader/src/resource.rs:feasible,canon_cmp,cmp_leaf_okwith 1D integer constant bounds) acrossruns,lane_phi,lane_select,waterfall, andlane_value_equals.lane_value_in,redundant_write,lane_value_equals,split_term): when a guardedlane_copyorv_cndmask_b32failsruns(site, known), keeps the prior register value iffoldand the written value provably evaluate to the same 32-bit word on every feasible active lane inknownwherereach[site.0]andguardhold.lane_copy(guarded by!clamp && omod == 0) for sound lane-preserving moves, selects, and 32/64-bit word extracts (v_mov_b32incl.DWORDSDWA,v_swap_b32, identityv_or_b32/v_and_b32/v_xor_b32/v_add_*/v_sub*/v_lshlrev_b32/v_lshrrev_b32/v_ashrrev_i32/v_mul_lo_u32/v_min_*/v_max_*/v_bfi_b32,v_perm_b32,v_alignbit_b32/v_alignbyte_b32, 64-bit 0/32-bit word shifts, and constant-mask / equal-operandv_cndmask_b32with!self.p.wave64guard on 32-bitu32::MAXliterals).lane_select(same_maskand single-feasible-branchv_cndmask_b32) andwaterfall(usinglane_value(..., &loop_known)).resource::tests, including Shader resource tracking: redundant masked write after a per-lane descriptor join is refused (synthetic repro on #566) #750 image & sampler reproducers, swapped/negated compares, lane-preserving moves/extracts, and negative soundness controls (non-identity writes, widened masks, flipped arms, non-identity ALU/perm/shifts, guardedv_swap_b32, mixedlane_selectmasks, and Wave64 literalu32::MAXmask refusal).crates/victory-shader/src/emit/waterfall_tests.rs:lanes_sample_texture_after_redundant_partial_write,lanes_sample_joined_sampler_after_redundant_partial_write,lanes_sample_after_vgpr_swap_and_word_extract) validated withdxil.dlland executed on RTX 5070 Ti + WARP.Verification
32.0.16.2135), WARP (VICTORY_WARP=1), Windows SDK10.0.26100.0dxil.dll, Rust1.98.1, baseffe310eb.cargo xtask policy:154 files okcargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): passedcargo test --workspace --locked:352 passed, 0 failed, 6 ignored(victory-shader130/1 ign)cargo test -p victory-shader --features host --locked(RTX 5070 Ti + WARP):130 passed, 0 failed, 1 ignoredVICTORY_WARP=1 cargo test -p victory-shader --features host --locked(WARP):130 passed, 0 failed, 1 ignoredcargo test -p victory-gpu --features diagnostics --locked&VICTORY_D3D12_WARP=1:53 passed, 0 failed, 1 ignoredeachrustfmt --edition 2024 --checkon modified files: zero diffs on added/modified lines (waterfall_tests.rscompletely clean).AI use: Written and verified locally with an AI coding swarm (
gemini-4-hydrogen-high), then independently audited and tested on RTX 5070 Ti + WARP.