Shaders: one console wave run as two host waves meets at barriers between its LDS phases (stacked on #2176) #2925
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2925
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2925"
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?
@moe-miau on GitHub · 2026-11-26 00:13 UTC · original
moe-miau:port/one-wave-lds→main· +662 −14 · 16 files · 5 commits · openStacked on #2176 (n-romanovich). Its commits are in this branch; the change to review is the last commit. I'll rebase once #2176 is merged. If @n-romanovich would rather take this into #2176, I'll close this one.
Problem
#2176 runs a wave64 compute program as two 32-lane host waves on NVIDIA, and refuses one whose thread group is a single console wave (64 threads or fewer) and that uses LDS. The console compiler leaves barriers out of such programs, because one wave's lanes run in step; split into two host waves, they would race on LDS.
In the title that refusal drops 64 programs on an RTX 4070 SUPER. One of them,
34d88edf583f3778, writes the 60×34×512 R16_FLOAT step-length volume that the ray-marched lighting passes (c7feccae4e01e454,8bbcbda6008eaa37,0184869d6e47e5fa,915ed81ea580a276, ...) read. Left at zero, every lane marches 0.1-unit steps to the 10,000-step cap:c7feccaealone took 305 of ~520 ms of GPU time a frame (the same pass takes 0.29 ms in fxceless/victory-fork's timing log).Measured with a local probe (reading the texture back before the pass, and logging every dispatch whose unordered views cover its memory):
34d88edfrefused)34d88edf583f3778Change
emit::lower::lds::barriers(new file, solower.rsstays under the 512 KiB asset-policy limit) plans group barriers instead of refusing:dx.op.barrier, sync + group-shared fence) goes at the first point every thread reaches exactly once: an instruction boundary in a block that lies on every path to every exit and in no loop. Writes are ordered among themselves too: two writes with no such point between them keep the program refused.LOOP_LIMIT) stops at a loop's unconditional back edge would return without reaching the barriers ahead and hang the others. It now returns through a block of its own that passes those barriers first.buffer_load ... lds, which the lowering does not handle).Of the 64 programs, 18 now translate on their own (6 more need #2711's lifts of #2176's other refusals); the others stay refused, each with the reason in its message. (The in-game numbers below are from the head before writes were made strict, when 20 translated;
34d88edftranslates either way.)The design and a review pass were done with Codex; Codex's review found the buffer-to-LDS case, now refused, with a test.
Tested
RTX 4070 SUPER, driver 32.0.16.1742, Windows 11 26300. Title 1.0.2.1, Series X profile, diag build, scripted Enter presses. Tree:
mainf3578e3+ #2464 + #2098 + #2626 + #2628 + #2711 + #2851 + #2705 (VICTORY_CARD_COPIES=1) + this.GPU time per command (median over each 6-minute run,
VICTORY_GPU_TIMING=1 VICTORY_D3D12_DRED=1). The "before" tree has neither #2705 nor this PR; #2705 alone leaves these ray-march passes as they were (95 and 67 ms forc7feccae, 146 and 105 ms force30cb33, in its own A/B):c7feccae4e01e4548bbcbda6008eaa37ce30cb330ef34306776d835da5ffa646cargo test -p victory-shader --libfor the new tests: 10 passed, including the negative cases (one loop that reads and writes, a buffer load into LDS) and the loop-limit drain.wave64_one_wave_lds_is_refused_on_wave32_hostbecomeswave64_one_wave_lds_waits_between_its_phases_on_wave32_host(translates and validates).cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo xtask policy: ok.AI-assisted (Claude Code, design and review by Codex). Runs done on my machine.
🤖 Generated with Claude Code
@fuzeofficlal on GitHub · 2026-11-26 00:23 UTC · original · reviewed
Verified head
ae618381cleanly merged ontoorigin/main(63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 —WaveLaneCountMax = 32— + D3D12 WARP + Windows SDK 10.0.26100.0dxil.dll).Architecture & Safety Audit
spine-onlydx.op.barrier(1 | 8)phase separation (refusing unseparable non-spine hazards viaNO_POINTand draining remainingPlan::drainsbarriers onLOOP_LIMITabort vialds_abort) is well-reasoned and properly refuses cross-halfv_readlane/v_writelane/ds_bpermute/non-quadds_swizzle/64-bit mask-as-data ops whenhost_wave() < wave().host_wave32()(D3D12_FEATURE_DATA_D3D12_OPTIONS1) and theshader_cacheblake3 key update keep Wave32 and Wave64 cached artifacts cleanly separated.#2920merge note:crates/victory-shader/src/emit/lower.rsis523,227 B(1,061 Bbelow the524,288 B512 KiB policy cap). Note that#2920leaveslower.rsat524,190 B, so landing both will require extracting additional helpers out oflower.rs(and checkinglds_abortinteraction if a shader mixess_barrierandlds_barrier).Local Verification (RTX 5090 +
dxil.dll)victory-shader:emit::tests::wave642/2 (wave64_cross_half_readlane_is_refused_on_wave32_hostandwave64_one_wave_lds_waits_between_its_phases_on_wave32_host, DXIL validated),emit::lower::+emit::flow_tests+emit::crosslane_tests48/48 (includinglds::tests9/9),emit::memory_tests(skipping pre-existing Blackwell baseline crash) 4/4.victory-gpu(--features diagnostics):shader_cache+draw::tests+host::tests(non-descriptor) 36/36 on RTX 5090.cargo clippy --locked -p victory-shader -p victory-gpu -p victory --tests -- -D warnings(default and--all-features) &cargo xtask policy(192 files ok): clean.Looks solid and ready to merge.
@kotekompotek on GitHub · 2026-11-26 00:27 UTC · original · reviewed
Scoped review: translating a wave64 program as two host wave32s meeting at group barriers is the right decomposition for NVIDIA/Intel hosts (no WaveSize(64)), and
VICTORY_HOST_WAVE32overriding the query is the standard env-knob shape here. TheOptionsfield with..Default::default()at the two call sites keeps it forward-compatible. Correctness hinges on the barrier pairing being symmetric between the halves — the same counting discipline #2920 introduces, so these likely land best together.@Marvisak on GitHub · 2026-11-26 04:23 UTC · original · edited 2026-11-26 05:46 UTC
Automated triage for the maintainers.
Needs work (one item left). The new commit
fd180a6addresses the earlier point:emit::lower::lds::barriersno longer skips two LDS writes with no common point between them, it refuses the program (NO_POINT) like the other unplaceable cases, and the "tiles write disjoint slots" comment is gone. The stray blank line in thelower.rstests is removed too.What still blocks merging as is: the branch carries the three commits of #2176 (n-romanovich's open PR,
b2ea86a,9857ed1,fb99078). Once #2176 lands, a rebase down to the two commits of this PR (or folding them into #2176, as you offered) would make it reviewable on its own. Note also that #233 (with #223) handles wave64 compute on 32-lane hosts by a different route; the maintainers will need to pick one base for this work.CI: passing.
Generated by Claude Code
@frenziedcoder on GitHub · 2026-11-26 07:45 UTC · original
RTX 5080 (Blackwell), driver 621.40, title runs: this PR on top of the #2464 / #2176 stack brings back 41 of the 84 dropped compute programs at
ae61838(30 atfd180a6) (including34d88edf583f3778), runs 600 s with no device removal, and the interior shots gain texture and light, but with a strong green cast I could not pin on this PR or on thewave32_approxchange in the same tree.Tree:
main842b0cb+ #1906, #2098, #2626, #2628, #2464, #2176 (fb99078), #2118 + yourwave32_approxchange and the BVH-builder hold-back from #2176's thread (local), then this PR (ae61838, thenfd180a6; both clean merges). Same switches as my earlier reports (diag build,VICTORY_D3D12_DRED=1, scriptedEnter, 600 s).ae61838ae61838,wave32_approxofftranslate --cache)one-wave LDS on a 32-lane host: no point all threads reach between a write and a read is not supported.34d88edf583f3778translates and gets a host pipeline.fd180a6(refusing one-wave LDS writes with no point between them): 373 programs refused (341 withae61838), 55 dropped in the run (54 compute, 50 of themone-wave LDS on a 32-lane host: no point all threads reach between a write and a read), no removal in 600 s, frame 2,048 at 479 s, and the green cast on the interior shots is unchanged. So it does not come from the writesfd180a6now refuses.wave32_approxoff the run never reached that interior shot in 600 s (it stayed on the exterior fence shot, as shots follow the clock and more passes were dropped), so I can't say which change brings the green (this PR's barrier lowering of the programs it still translates,wave32_approx, or the two together).Not tested: more than one run per tree; this PR without #2176's other open points; Series S profile.
AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report.
@neonbyte1 on GitHub · 2026-11-26 11:35 UTC · original
In-game result for the stack #2176 → #2711 → #2925 on an RTX 5090 (32-lane waves), Linux, GE-Proton11-14 Wine with its vkd3d-proton,
VICTORY_WAVE32_APPROX=1. Context: #2688.Base:
mainplus a few unmerged PRs needed on this setup, including #439's console flow for one-wave LDS on 32-lane hosts. The stack merged on top. The scene is the lit prison yard after the opening, in a warm run.What it unlocks:
--host-lanes 32-32, 41 of the 42 compute shaders the base refuses (wave64 groups of more than 64 threads, and implicit derivatives in the console flow) now translate. That includes all 21cascadeshadows_*. OnlyCS_DensityShadowMapMips(5b2ce592c3a5dd09) still stops.cascadeshadows_classify/cascadeshadows_renderingtiled pass;alphaResolve:CS_AlphaTransmissionDepthTileGenerationMip1;vfx_triangleClip;CS_ComputeInfiniteRRIntensity.One thing to know if this lands together with #439. Merged naively, #2925's phase plan also ran inside #439's console flow. Its "no point all threads reach between a write and a read" refusal then rejected 138 compute programs the console flow translates, 42 of them used in this scene (lens flares,
sr_tracingtiling, ambient-map propagation, particle emit, ...). What worked:With that, every program the base emits gives byte-identical DXIL, and the 57 gains stay. While merging I also had to fix one artifact of my own: duplicated lane-number handling made
v_writelane_b32in the console flow write lane n and n XOR 32. That bug isn't in your PRs. I can share the merged branch if it helps.AI-assisted (Claude); measured on my machine, no game data shared.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.