Shaders: keep per-lane descriptors across redundant masked moves #2076
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2078"
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 fuzeofficlal on 2026-11-25T04:24:35Z.
Closes #750.
Summary
v_mov_b32step-back (Tracer::lane_value/redundant_vmov/same_in_lanes): when a plainv_mov_b32executes under a narrowedEXECmask (runsfails because inactive lanes retain the previous value), step back toTerm::Value(old)only if every feasible path inactive = known ∧ reach ∧ guardalready holds the replacement dwordwantedacross priorv_mov_b32,v_cndmask_b32, and acyclicphijoins.Tracer::feasible/cmp_atom): on top ofmeetandfew_atoms, group up to 4 pure 32-bit integerv_cmp_*/v_cmpx_*relations (_u32/_i32eq/ne/lt/gt/ge/le, never float compares) so repeated or complemented guards after a control-flow join prune unreachable predecessor arms.Testing
joined_descriptor_redundant_partial_write(repeatedv_cmp_gt_u32and complementedv_cmp_le_u32),joined_buffer_and_sampler_redundant_partial_writes(nested buffer and sampler joins), and the three negative conflict checks injoined_descriptor_conflicting_partial_writes_fail(other arm word,constant overwrite,wider mask).dxil.dll-validated waterfall readbackslanes_sample_after_redundant_masked_image_descriptor_writeandlanes_sample_with_joined_sampler_after_redundant_masked_write(verified across NVIDIA RTX 5090, AMD Radeon RDNA2, and D3D12 WARP), pluscargo clippyandcargo xtask policy.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T04:31:05Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, withdxil.dllvalidator):cargo test -p victory-shader --lib emit::waterfall_tests::— 7 passed, 0 failed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(includinglanes_sample_after_redundant_masked_image_descriptor_writeandlanes_sample_with_joined_sampler_after_redundant_masked_write)cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean preservation of per-lane descriptors across redundant masked
v_movs with strong end-to-end waterfall GPU+WARP tests. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:34:44Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.147 passed / 0 failed. Per-lane descriptors kept across redundant masked moves (+3 tests) — descriptor liveness across masked moves.
Imported from Marvisak/VIctory. Originally posted by YouKnowWh on 2026-11-25T05:19:08Z.
Independent check for #750 at PR head
b404d60cfb8a1f0d9e275a0c24f349587e3f5468against main940d32f69b22265690a0b5a15d6ded572ba33baf.victory-shader --libsuite passed 147, failed 0, ignored 2. On Windows I also ran the new image and joined-sampler end-to-end cases with WARP only, making validator availability mandatory (dxil.dll 1.8.2502.11). The per-lane expected-value checks passed, including swapped samplers. The test adapter selection and validation diagnostics were local harness changes only.victory translate shaders.rpf --validate --list --jobs 8. Both revisions scanned 26,503 containers. Comparing the 25,694 listed stage outcomes by original DXIL-part hash and stage, including repeated outcomes and refusal offsets, found zero differences. This compares translator/validator outcomes, not the generated instructions, visual output or hardware PSOs. The positive evidence for new coverage is the synthetic regression test.A performance caveat for review: an earlier wall-clock comparison of a different local port of #1182 against main is not evidence of a slowdown in #2078. I selected three slow pixel containers from that local profile and ran them individually on stock main and this PR (fresh process, one worker, same CPU and validator, both orders). For example
6f06d377496b2eb7validated in both processes on each revision: main 10.56 and 57.33 s; PR 20.40 and 0.82 s. A separate coarse tracing run on the PR spent ~3.5 ms in the initial resource tracking pass, ~201.0 s between enteringemit_withand returning to validation, and ~39 ms validating. Another run spent <1 s in emission. An additional instrumented run spent 19.93 s in the first call to lower::lower, which returned successfully without the discard fallback. This locates the long interval on that input, not its underlying cause or a general speed change. No title launch or hardware GPU run; no game files attached.AI-assisted local validation. Thanks for taking on the current-main PR.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:30:02Z.
Automated triage for the maintainers.
The change looks careful.
Tracer::lane_valuesteps back over a maskedv_mov_b32whenredundant_vmovandsame_in_lanesshow that active lanes already hold the written dword.Tracer::feasibleandcmp_atomlink repeated or complemented 32-bit integer compares, which is sound becauseAtom::Laneis the compare bit before EXEC masking. The positive and negative tests, including the GPU/WARP readbacks, are good, and CI passes. The concern is value against cost. It adds about 450 lines toresource.rs, andfeasiblenow replacesmeetinrunsand in the join path for every program. Yet the retail census in the comments found zero differences. When #1182 was closed, this refusal class was already at zero for the title's shaders in main.What would change the verdict: a title shader (identified by hash, with no shader data) that this change lets translate, and a before/after translation-time comparison across the archive. The single-container timings in the comments are too noisy to rule out a slowdown.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T15:40:20Z.
Closing:
main(da82e44) now lands nested/joined descriptor handling (59c78bb,ff47463,850b66f), and this branch showed no corpus delta againstmain.Pull request closed