Repository navigation
Conversation
…eLaneCountMax < 64
…ween its LDS phases On a host of 32-lane waves, Marvisak#2176 runs a wave64 program as two host waves and refuses one whose thread group is a single console wave and uses LDS: the console compiler leaves barriers out of such programs, whose lanes run in step, so the two host halves would race. In the title that refuses 65 programs, among them 34d88edf583f3778, which writes the step-length volume a ray-marched lighting pass reads; with that volume left at zero every lane marches to its step cap (305 of 520 ms of GPU time a frame on an RTX 4070 SUPER). `lower::lds::barriers` plans group barriers instead: LDS accesses must come in phases of reads or of writes, and between two phases (and between writes, where it can) a barrier goes at the first point every thread reaches exactly once: an instruction boundary in a block on every path to every exit and in no loop. A lane that the iteration limit stops at a loop's unconditional back edge returns through a block of its own that first passes the barriers still ahead, so the others never wait for it. Without such a point, or with LDS atomics or memory loads into LDS, the program stays refused as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fuzeofficlal
left a comment
There was a problem hiding this comment.
Verified head ae618381 cleanly merged onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 — WaveLaneCountMax = 32 — + D3D12 WARP + Windows SDK 10.0.26100.0 dxil.dll).
Architecture & Safety Audit
- Running single-wave Wave64 LDS compute shaders as two 32-lane host waves with
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.- File size &
#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
left a comment
There was a problem hiding this comment.
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_WAVE32 overriding the query is the standard env-knob shape here. The Options field 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.
|
Automated triage for the maintainers. Needs work (one item left). The new commit What still blocks merging as is: the branch carries the three commits of #2176 (n-romanovich's open PR, CI: passing. Generated by Claude Code |
…not left unordered Triage pointed out that the earlier shortcut assumed one title's tiles write disjoint slots. Writes are now ordered like any other phase change: two writes with no point between them that all threads reach keep the program refused. Of the 64 programs refused before Marvisak#2925 on the RTX 4070 SUPER run, 18 translate with this (20 with the shortcut); 34d88edf583f3778 still does. Also drops a stray blank line in the lower.rs tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 Tree:
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. |
|
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, Base: What it unlocks:
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,
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 AI-assisted (Claude); measured on my machine, no game data shared. |
Stacked 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