Shaders: keep per-lane descriptors across redundant masked moves #2078

Closed
github-bot wants to merge 1 commit from gh-pr/2078/head into gh-pr/2078/base
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 04:24 UTC · original
fuzeofficlal:fix/shader-joined-descriptor-redundant-write-750 → main · +530 −21 · 3 files · 1 commits · closed without merging

Closes #750.

Summary

  • Redundant masked v_mov_b32 step-back (Tracer::lane_value / redundant_vmov / same_in_lanes): when a plain v_mov_b32 executes under a narrowed EXEC mask (runs fails because inactive lanes retain the previous value), step back to Term::Value(old) only if every feasible path in active = known ∧ reach ∧ guard already holds the replacement dword wanted across prior v_mov_b32, v_cndmask_b32, and acyclic phi joins.
  • Equivalent 32-bit integer lane-compare linking (Tracer::feasible / cmp_atom): on top of meet and few_atoms, group up to 4 pure 32-bit integer v_cmp_* / v_cmpx_* relations (_u32 / _i32 eq/ne/lt/gt/ge/le, never float compares) so repeated or complemented guards after a control-flow join prune unreachable predecessor arms.

Testing

  • Added joined_descriptor_redundant_partial_write (repeated v_cmp_gt_u32 and complemented v_cmp_le_u32), joined_buffer_and_sampler_redundant_partial_writes (nested buffer and sampler joins), and the three negative conflict checks in joined_descriptor_conflicting_partial_writes_fail (other arm word, constant overwrite, wider mask).
  • Added end-to-end GPU/WARP dxil.dll-validated waterfall readbacks lanes_sample_after_redundant_masked_image_descriptor_write and lanes_sample_with_joined_sampler_after_redundant_masked_write (verified across NVIDIA RTX 5090, AMD Radeon RDNA2, and D3D12 WARP), plus cargo clippy and cargo xtask policy.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 04:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2078) `fuzeofficlal:fix/shader-joined-descriptor-redundant-write-750` → `main` · +530 −21 · 3 files · 1 commits · closed without merging Closes #750. ### Summary - **Redundant masked `v_mov_b32` step-back (`Tracer::lane_value` / `redundant_vmov` / `same_in_lanes`)**: when a plain `v_mov_b32` executes under a narrowed `EXEC` mask (`runs` fails because inactive lanes retain the previous value), step back to `Term::Value(old)` only if every feasible path in `active = known ∧ reach ∧ guard` already holds the replacement dword `wanted` across prior `v_mov_b32`, `v_cndmask_b32`, and acyclic `phi` joins. - **Equivalent 32-bit integer lane-compare linking (`Tracer::feasible` / `cmp_atom`)**: on top of `meet` and `few_atoms`, group up to 4 pure 32-bit integer `v_cmp_*` / `v_cmpx_*` relations (`_u32` / `_i32` `eq`/`ne`/`lt`/`gt`/`ge`/`le`, never float compares) so repeated or complemented guards after a control-flow join prune unreachable predecessor arms. ### Testing - Added `joined_descriptor_redundant_partial_write` (repeated `v_cmp_gt_u32` and complemented `v_cmp_le_u32`), `joined_buffer_and_sampler_redundant_partial_writes` (nested buffer and sampler joins), and the three negative conflict checks in `joined_descriptor_conflicting_partial_writes_fail` (`other arm word`, `constant overwrite`, `wider mask`). - Added end-to-end GPU/WARP `dxil.dll`-validated waterfall readbacks `lanes_sample_after_redundant_masked_image_descriptor_write` and `lanes_sample_with_joined_sampler_after_redundant_masked_write` (verified across NVIDIA RTX 5090, AMD Radeon RDNA2, and D3D12 WARP), plus `cargo clippy` and `cargo xtask policy`.
When a plain `v_mov_b32` writes under a narrowed `EXEC` mask, step back to the register's previous value if every feasible active path already holds the replacement dword. Link equivalent 32-bit integer lane compares on top of `meet` so repeated or complemented guards after a control-flow join prune unreachable predecessor arms (#750).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:14 +00:00
github-bot closed this pull request 2026-11-26 04:54:14 +00:00
Author
Owner

@⁠YouKnowWh on GitHub · 2026-11-25 05:19 UTC · original

Independent check for #750 at PR head b404d60cfb8a1f0d9e275a0c24f349587e3f5468 against main 940d32f69b22265690a0b5a15d6ded572ba33baf.

  • On stock main the two identity moves (repeated and complementary comparisons) are both refused at 0x108. The cross-arm word, constant overwrite and widened-mask controls are also refused.
  • On this PR the Linux victory-shader --lib suite 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.
  • Offline 1.0.2.1 archive census: 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 6f06d377496b2eb7 validated 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 entering emit_with and 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.

**@⁠YouKnowWh** on GitHub · 2026-11-25 05:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2078#issuecomment-7153655535) Independent check for #750 at PR head `b404d60cfb8a1f0d9e275a0c24f349587e3f5468` against main `940d32f69b22265690a0b5a15d6ded572ba33baf`. - On stock main the two identity moves (repeated and complementary comparisons) are both refused at 0x108. The cross-arm word, constant overwrite and widened-mask controls are also refused. - On this PR the Linux `victory-shader --lib` suite 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. - Offline 1.0.2.1 archive census: `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 `6f06d377496b2eb7` validated 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 entering `emit_with` and 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 10:30 UTC · original

Automated triage for the maintainers.

The change looks careful. Tracer::lane_value steps back over a masked v_mov_b32 when redundant_vmov and same_in_lanes show that active lanes already hold the written dword. Tracer::feasible and cmp_atom link repeated or complemented 32-bit integer compares, which is sound because Atom::Lane is 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 to resource.rs, and feasible now replaces meet in runs and 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

**@⁠Marvisak** on GitHub · 2026-11-25 10:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2078#issuecomment-7159779050) <!-- victory-triage v1 head=b404d60cfb8a1f0d9e275a0c24f349587e3f5468 verdict=needs-work at=2026-11-25T10:29:49Z --> Automated triage for the maintainers. The change looks careful. `Tracer::lane_value` steps back over a masked `v_mov_b32` when `redundant_vmov` and `same_in_lanes` show that active lanes already hold the written dword. `Tracer::feasible` and `cmp_atom` link repeated or complemented 32-bit integer compares, which is sound because `Atom::Lane` is 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 to `resource.rs`, and `feasible` now replaces `meet` in `runs` and 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](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 15:40 UTC · original

Closing: main (da82e44) now lands nested/joined descriptor handling (59c78bb, ff47463, 850b66f), and this branch showed no corpus delta against main.

**@⁠fuzeofficlal** on GitHub · 2026-11-25 15:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2078#issuecomment-7167202550) Closing: `main` (`da82e44`) now lands nested/joined descriptor handling (`59c78bb`, `ff47463`, `850b66f`), and this branch showed no corpus delta against `main`.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2078
No description provided.