Shaders: keep empty-EXEC branches that can reactivate lanes #83
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!83
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-83"
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?
@ryotdev on GitHub · 2026-11-24 21:20 UTC · original
ryotdev:codex/preserve-empty-exec→main· +946 −43 · 3 files · 5 commits · draftAn empty console wave can branch past a block that restores an earlier EXEC mask and writes to shared memory. Removing that branch lets the store run. The synthetic regression covers both a branch to an early return and a branch to a join.
Depends on #443 by @AscilCH, included here with its original commit. The follow-up at 4bf38e3 applies its analysis to early returns as well as ordinary skips. A masked vector write can carry a previous full-wave temporary into a join. The analysis follows that value through masked writes and phis. A plain full-width conditional select or cross-row permutation can discard the old destination when all lanes are active and none of its explicit sources reads that destination.
The follow-up at 26c9647 handles a terminal empty-wave branch over workgroup barriers. A retired RDNA2 wave drops out of subsequent rendezvous. The new check permits it to walk the region with empty EXEC when every wave reaches the same gate, all paths visit the same barriers exactly once in order, and loops have bounded scalar counters. The original checks on side effects and EXEC restores still apply. AMD RDNA2 ISA, section 4.3
Verification on Windows 11, RTX 5070, driver 610.88
310c6eband previous draft4bf38e3. Each revision emitted DXIL for the same 2,680. This follow-up changes exactly four outputs from the previous draft. All four match main byte-for-byte and use the regular 32-lane translation.The current head and main both reached the interactive jail checkpoint and responded to the same movement sequence on the RTX 5070. Both completed the observation with no host GPU failure and the same six unrelated compute pipeline refusals. None of the four regressions above appeared in either refusal set. At the prison window, both runs showed orange light on the character’s hair. The dark-hair image from the previous draft did not persist after repair. The fence also varied across repeated launches of the same main binary. Different geometry was still streaming during the timed window, so this comparison establishes neither a frame-rate gain nor visual parity.
AI-assisted implementation and testing. The public test fixtures are handwritten. Thanks to @Xeltax for narrowing the original lighting example and @YeokiNoewChi for reporting the native pipeline regression.
@adriaespii on GitHub · 2026-11-24 21:30 UTC · original
Independent test run on commit
7ed853a(AMD RDNA4):x86_64-pc-windows-msvc)cargo clippy --workspace --all-targets -- -D warnings: 0 warningscargo test --workspace: 498 passed, 0 failed, 7 ignored (victory-shader: 212 passed, 0 failed, 2 ignored;victory-gpu: 110 passed, 0 failed, 1 ignored)AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.
@arminkhaleghirod on GitHub · 2026-11-24 21:42 UTC · original
Merged onto main
90228a7and ranvictory translate --validateover the full title (26,148 programs) on Windows 11 / RTX 4080. Changes against main, by failure reason:No change: every failure count is the same as main, and no new reason appears. So no regression in translation. What this PR changes at run time isn't covered by this check.
@YeokiNoewChi on GitHub · 2026-11-25 00:37 UTC · original
RTX 3070 Ti 8 GB (32-lane waves), driver 621.x, Windows 11, fork
main4e17478plus #23 #24 #25 #51 #52 #32 #58 #71, diag build, Series X.With #83 on top, the driver refuses six more compute pipelines with
E_INVALIDARG(0x80070057), so their dispatches are dropped:55679a0547649d0bInstanceCulling:CS_Tree_BatchCull89d08e561897d4e5InstanceCulling:CS_Tree_BatchCull_ImposterOnly7168dd781ca7efb9sr_tracing:CS_RayPrePass_Opaque_SSRd2b169b82f67ec5bsr_tracing:CS_RayPrePass_Alpha1f1fbd86759b3da2vfx_proj_decal_vbuffer:CS_ProjDecalReduceClassification_Scalarizedb96880482a17f632vfx_proj_decal_vbuffer:CS_ProjDecalReduceClassification_VectorizedReproduced offline in seconds:
VICTORY_TRANSLATE_ONLY=55679a0547649d0b,89d08e561897d4e5,1f1fbd86759b3da2,7168dd781ca7efb9 VICTORY_HOST_MAX_WAVE=32 victory translate --pipelines --list shaders.rpfgives "pipeline created" for all four without #83 and "pipeline: The parameter is incorrect." for all four with it. Reverting only #83 restores them (the other PRs in the stack are not involved; #79 was checked separately). The game run without #83 refuses the usual four (02384a60fda6f2d0,2cc4c197ee29e291,2da4beb386509b77,369cbe906ea72764).AI-assisted (Claude Code); counts and hashes only, nothing from the game.
@justlovett0 on GitHub · 2026-11-25 03:23 UTC · original
Tested on Windows 10 (19044), RTX 3080 (32-lane waves), title build 1.0.2.1, release + diagnostics.
With this empty-EXEC guard plus #11 (restore parked lane-mask pairs a few instructions apart) and #77 (v_fma_mixlo/mixhi over an f16 first interpolation half), the
IrradianceCache_Shade/IrradianceCache_ShadeSecondarycompute shaders translate and bind in game — previously refused with "a wave reduction where not every lane runs". With the BVH builder left OFF, the static world renders lit (good world lighting) at ~390 ms/frame in a heavy scene.Applying #11 alone previously removed world geometry for us; with this guard the geometry is preserved. So the guard appears necessary alongside #11's restore forward-search — the combination is what made the irradiance cache usable on this card. The remaining clothes/material lighting issue looks separate (the deferred-material pixel programs #77 addresses). Thanks — useful fix.
@ryotdev on GitHub · 2026-11-25 03:44 UTC · original
@YeokiNoewChi I reproduced the regression on an RTX 5070 (driver 610.88). All six programs validated on both revisions. Native pipeline creation was 6/6 on the original parent and 0/6 on
7ed853a.I updated this branch at
4bf38e3. It retains the empty-EXEC store regression, reuses the region analysis from #443, and checks whether full-wave temporary values survive a later masked write. Native pipeline creation now passes 6/6 with approximate local-wave lowering disabled. The 14 lighting pipelines in #62 also validate and create successfully. I did not dispatch the six programs in this check.I’ve left this in draft for independent testing of rendered output and broader shader coverage. Thanks for catching the difference between DXIL validation and actual pipeline creation.
@ryotdev on GitHub · 2026-11-25 04:14 UTC · original · edited 2026-11-25 04:29 UTC
Full compute comparison. I compared the emitted DXIL for all 2,689 compute containers in the local input index with the same 32-lane host settings. Both revisions emitted 2,680 programs. Exactly 20 outputs changed. All 20 validated on both builds. Main created all 20 native pipelines on the RTX 5070, and the draft created 16. The four regressions cover raster and ray-traced shadow classification. The original six and the separate fourteen lighting cases all passed on both builds. This remains blocked on the four native failures.
Keeping this in draft. A checkpoint run exposed two additional compute pipelines that regress between fork main
310c6eband this branch at4bf38e3. I collected the nine distinct compute inputs refused across the two runs, then tested exactly those same nine offline on each binary. Both validated all nine DXIL programs. On the RTX 5070 (driver 610.88), main created two native D3D12 pipelines and this branch created zero. The original six reported above still pass their targeted test.Both new failures have an empty-EXEC branch to program termination that skips workgroup barriers. Main's translator removes that branch and emits wave32. This branch preserves it and emits wave64, which the adapter rejects. RDNA2 permits an early-exiting wave to leave the remaining waves to synchronize. Any fix here needs to preserve that behavior across the barriers and loops. AMD RDNA2 ISA, section 4.3
The visual difference is real. At the same stationary jail window, the bright orange highlight across the back of the character's head became dark. The median frame-time reading over 57 seconds was 455 ms on main and 415 ms on this branch at about 5,000 draws/frame in each. That is one ordered comparison on one GPU.
@ryotdev on GitHub · 2026-11-25 05:04 UTC · original · edited 2026-11-25 05:20 UTC
Updated the draft to
26c9647. All four shadow classification regressions are fixed in native pipeline creation on the RTX 5070. The full 2,689-input comparison found exactly four changed outputs from the previous draft, each identical to main. The handwritten 192-thread shared-memory test also passed on both WARP and hardware. I’ve added the three-revision results to the PR description.Checkpoint follow-up: the repaired head and main both reached the interactive cell and responded to movement. The earlier dark-hair difference disappeared on the repaired head. Both logged the same six unrelated native compute refusals. The PR description records the comparison and its limits.
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.