Repository navigation
Shaders: keep per-lane descriptors across redundant masked moves - #2078
fuzeofficlal wants to merge 1 commit into
Conversation
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 (Marvisak#750).
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):
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).
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, 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.
|
Independent check for #750 at PR head
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 AI-assisted local validation. Thanks for taking on the current-main PR. |
|
Automated triage for the maintainers. The change looks careful. 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 |
|
Closing: |
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.