Repository navigation
Conversation
ir::without_skips and ir::without_early_outs stripped s_cbranch_execz even when the guarded region contained a loop exited via a non-zero lane mask (v_cmp_* + s_cbranch_vccz / s_cbranch_vccnz, s_cbranch_execz / s_cbranch_execnz, or s_cbranch_scc0 / s_cbranch_scc1 from an AND with EXEC or VCC). When EXEC == 0 falls through into such a loop, vector compares always write 0 so the zero-mask edge stays on the cycle until the synthetic loop limit fires (4096 iterations), aborting before post-loop stores — and under VICTORY_WAVE_WIDE=1 on ptfx_CS_lightAtlas_Sprite / _Trail, spinning through thousands of wave-wide group barriers per empty wave. Keep s_cbranch_execz whenever its guarded region contains a loop whose zero-mask edge stays in the region, while continuing to strip skips over scalar-counted loops. Add unit tests for all four CFG shapes and a wave64 hardware/DXIL regression test covering both per-lane and wave-wide lowering. Assisted-by: Antigravity
|
Ran the new s_cbranch_execz tests and the full workspace at bbfe426: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. The new Not tested: release profile, native wave64 (not available here), AMD/Intel GPUs, Wine, the full title. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
…am: 25,953 of 25,953), fxceless#196 loop exits with the host wave, fxceless#262 execz skips over loops, fxceless#213 a missing child is a miss, fxceless#788, fxceless#806, fxceless#748, fxceless#817 translate --hashes and translate-diff, fxceless#820, fxceless#694 one queue per test host
…port of upstream fxceless#262); shader names listed in a file (VICTORY_SHADER_NAMES); nothing held from the wide form by default
|
Some data on this from DexNom/VIctory on an RTX 4080 (32-lane waves). This PR, ported unchanged to DexNom's main ( A narrower guard keeps the same skips in front of the light-atlas loops, and costs nothing in that census (29 → 29, 21 programs change). It works out which masks are actually empty with no lane left (EXEC, lane compares and the scalar mask arithmetic on them), lets counted loops through, and still keeps the skip around a loop on a
Runs (prologue save, AI-assisted (Claude Code); measured on my machine. No game data: counts, hashes and log lines only. |
…ith no lane left Port of DexNom/VIctory#71 (b27921645, pr0vId3nce) and its follow-up b60997d11 onto this tree; the cause was found first in fxceless/victory-fork#262. The "without skips" and "without early-outs" forms drop `s_cbranch_execz` skips and early-outs, so a region the console only enters with lanes left also runs with none. A loop whose exit waits for some lane (a lane compare's VCC, empty then) never ends there, and every lane walks it to the iteration limit: in the particle light-atlas sprite and trail programs, with the group barriers of the wave-wide form in the loop nest (a GPU hang on 32-lane cards). Such a skip, or an early-out to the program's end, is now kept when the code left running with no lane holds a loop that may not end there (`goes_round`). Here the early-out test is `early_out_continuation`, which both forms use, so the far-jump early-out (`s_cbranch_execnz` past a far jump to the end) is guarded too. (cherry picked from commit b27921645) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
ir::without_skips(bothdeep = falseanddeep = true) andir::without_early_outsstrips_cbranch_execzeven when the guarded region contains a loop exited via a non-zero lane mask (e.g.v_cmp_*+s_cbranch_vccz/s_cbranch_vccnz,s_cbranch_execz/s_cbranch_execnz, ors_cbranch_scc0/s_cbranch_scc1fed by ans_and*withEXECorVCC).When an empty wave (
EXEC == 0) or inactive lane falls through into such a loop, every vector compare writes0(masked byEXEC), so the zero-mask branch stays on the loop cycle until the synthetic 4,096-iteration guard fires:ptfx_CS_lightAtlas_Sprite/_Trail), hitting the synthetic guard executesret void, silently dropping stores after the loop.VICTORY_WAVE_WIDE=1on 32-lane hosts, every empty wave falls into the loop and runs ~4,096 iterations × dozens of wave-wide group barriers (the hang that forcedVICTORY_WAVE_WIDEoff by default ine9765a7).Complementary to #83 and #196: #83 keeps
s_cbranch_execzwhen the skipped region reactivatesEXEC, and #196 usesWaveActiveAnyTruefor active-wavevccloop exits; whenEXEC == 0across the whole wave,vccis 0 in every lane so even a wave-wideWaveActiveAnyTruecannot exit and thes_cbranch_execzguard itself must be kept.What is in it
crates/victory-shader/src/ir.rs:has_empty_exec_loop(withreaches_within,reachable_from,scc_zero_under_empty_exec) and refuse to strips_cbranch_execzinwithout_early_outsandwithout_skipswhenever the guarded region contains a mask-branch whose zero-mask edge stays on a cycle within that region.s_cmp_lg_u32+s_cbranch_scc1) are still stripped as before.without_skips_keeps_execz_over_vcc_loops_and_strips_scalar_loopscoveringvccz,vccnz, early-outvccz, and scalar loops.crates/victory-shader/src/emit/wave64_tests.rs:without_skips_keeps_execz_guard_over_vcc_loop(validates DXIL withdxil.dlland dispatches on wave32 hardware under both per-lane and wave-wide lowering for empty, partial active/inactive, and full waves).Tested
32.0.16.2124, wave32, SM 6.6) + Intel(R) UHD Graphics (32.0.101.7026), Windows SDK10.0.26100.0(dxil.dllactive).bbfe426):cargo xtask policy->169 files okcargo clippy --workspace --all-targets --locked -- -D warnings-> 0 warningscargo clippy --workspace --all-targets --all-features --locked -- -D warnings-> 0 warningscargo test --locked -p victory-shader --lib without_skips-> 2 passed, 0 failed (note: on this hybrid laptop without the adapter-selection PR, adapter 0 is Intel UHD Graphics which rejectsWaveSize(32)compute pipelines so hardware dispatch skips there)cargo test --locked -p victory-shader --lib wave64_tests-> 6 passed, 0 failedcargo test --locked -p xtask-> 4 passed, 0 failedcargo test --workspace --locked-> 500 passed, 0 failed, 7 ignored (verifiedwithout_skips_keeps_execz_guard_over_vcc_loopfailed withleft: 0, right: 7without their.rsfix and passed all 8 per-lane + wave-wide hardware dispatches with it).translate --validate --pipelineswithVICTORY_HOST_MAX_WAVE=32 VICTORY_WAVE_WIDE=1on RTX 3050:ptfx_CS_lightAtlas_*shaders (2561af9577c47289,c06aa62112ffba4c,cabb87599722e59a,e8f6ae0597846841) and 14CS_ShadowRenderTiled*shaders: 18/18 emitted,dxil.dll-validated, and created D3D12 pipelines; inspected disassembled DXIL for2561af9577c47289andc06aa62112ffba4cand confirmed the outer light loop now keeps its wave-wides_cbranch_execzguard.XboxBvhBuilder.dll(VICTORY_HOST_WAVE=32): 49/52 emitted, 49/49 validated, 49/49 pipelines (unchanged baseline).Not tested
VICTORY_WAVE_WIDE=1enabled (kept off by default pere9765a7).shaders.rpfcorpus translation sweep.AI use
Written and verified with Antigravity (model name not exposed in the agent environment).