Spread dispatches: VICTORY_SPREAD_LEAN runs the records within 65,535 groups through the plain signature (off by default; #1338) #1352
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!1352
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1352"
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?
@grosterr on GitHub · 2026-11-26 17:43 UTC · original
grosterr:pr/spread-lean→main· +510 −37 · 3 files · 1 commits · merged 2026-11-26 23:06 UTCWhat
Since
06702fean indirect dispatch of a program that takes the spread words goes through a command signature that sets two root constants (row, asked x) and then dispatches, 20 bytes a record. That holds for every such dispatch, whatever it asks for.With
VICTORY_SPREAD_LEAN=1(oralt: twenty seconds each way, each change logged), the clamp writes a batch of up to 64 dispatch records twice:[x, y, z]records from byte 0, with the records past 65,535 groups in x left empty;(records * 12 + 7) & ~7, a predicate word: 1 when any record that runs is spread;[row, asked x, x, y, z]records, with only the spread records filled.The dispatch is then recorded as
ExecuteIndirectwith the plainDISPATCHsignature,SetPredication(EQUAL_ZERO)on the word,ExecuteIndirectwith the spread signature, and predication off again.VICTORY_DISPATCH_SPREAD=0lost the device while loading in 2 of 4 runs.The clamp also counts, in the budget buffer's words 3-5, the spread-eligible records over 65,535 groups and within it, and the groups past 65,535. The frame line says them:
Measured (RTX 3060 12 GB, Ryzen 7 5700X, Series X profile, prison prologue)
The run was on our branch, which has this change on
06702fe+ceb9e1fand the #770 stack. Standing still at one spot,=alt, 9 pairs, warm pipeline library, world frames only:The card's time was lower in every pair: −22, −19, −9, −19, −16, −7, −1, −13, −8 ms (median −12.8). Preparing pays about 4 ms for two executions and the predication instead of one.
Of the ~890-990 spread-signature executions a frame, 0.4-1.2 a frame pass 65,535 groups.
A micro-benchmark of 1,000 single-record executions of an empty dispatch on the same card, card time:
In a real frame the difference is much larger, so the driver probably serialises around executions that set root constants.
This branch is the change alone, rebased on
e4245f3(the clamp's new group charge and gather segments). It was built and tested, but not run in game on this exact base.Tests
warp_spread_lean_routes_small_and_large_records_and_counts_them: a mixed batch (100, 100,000 and 65,535 groups), and an all-small batch. It checks the plain and spread arrays, the predicate word, and the counters.warp_spread_lean_executes_same_group_ids_as_spread_for_100k_groups: 100,000 groups and 100 groups through the two executions under predication. It checks that the same group ids run, and that the predicate is set and clear respectively.VICTORY_D3D12_DEBUG=1:indirect19 passed. Wholevictory-gpu --lib(--test-threads=1): 224 passed. Clippy on the workspace is clean, and--features diagnosticsbuilds.Not tried on AMD, hence off by default. With it unset, nothing changes apart from the three counters.
🤖 Generated with Claude Code
@BitWuehler on GitHub · 2026-11-26 18:35 UTC · original
Tested on Linux/Proton (GE-Proton11-14 + vkd3d-proton, RTX 5080 16 GB, Series X profile,
diagbuild with frame capture enabled, warm shader cache, merged one4245f3alongside #1350 and our Linux DXC/copy-plain test stack):indirect::withVICTORY_SPREAD_LEAN=1— 19 passed, 0 failed, 2 ignored (both newwarp_spread_lean_*tests passed).#1352,VICTORY_DISPATCH_SPREADdefault on):1.7–2.0 fps(505–600 ms/frame,copying back 247–360 ms),1,066indirect dispatches/frame through the spread signature.#1352(VICTORY_SPREAD_LEAN=1):3.7–4.3 fps(234–272 ms/frame,copying back 80–100 ms) — >2x faster while keeping full lighting/volumetrics intact (visually verified across captured world frames).826–1,050indirect dispatches/frame routed lean; only0.40–1.25records/frame exceeded 65,535 groups (1,062–1,155at or under 65,535).(AI-assisted testing and summary.)
@grosterr on GitHub · 2026-11-26 18:49 UTC · original
Thanks for running it under Proton. Your counters match ours: ~1,000 executions a frame through the spread signature, about one record a frame past 65,535. So the cost is the signature itself, and it is clearly worse under vkd3d (copy-back alone 247–360 → 80–100 ms there) than on Windows.
With two independent results, on Windows/NVIDIA (card −12.8 ms) and on Linux/vkd3d (frame more than halved), the switch could be on by default, at least on NVIDIA and under vkd3d. A run of
VICTORY_SPREAD_LEAN=alton an AMD card would settle whether it can be on everywhere. Happy to change the default in this PR if that is preferred.@Filip722 on GitHub · 2026-11-26 20:06 UTC · original
I ran a same-process alternating comparison on the RTX 5060 Laptop 8 GB with an Intel Core 7 240H, Bazzite 44, NVIDIA 615.78.08, GE-Proton11-14 and vkd3d-proton 3.2.0. Base was
52ac4ecwith the #257 loop-latch fix and the same offline Series S prison checkpoint. Both phases used the same executable, rendering scale and initial caches. Three settled 18-second windows per mode exclude the first and last second of each switch interval.The lean arm routed a median 913 indirect dispatches per frame through the new path. The steady checkpoint showed similar throughput in the two modes. The build exited cleanly.
Both new cases and all 19 indirect tests passed on the physical RTX. I explicitly selected the hardware adapter in the fixture and used the existing local DXC fallback for the test worker. Under GE-Proton, the WARP-only fixture otherwise returned early after DXGI supplied a hardware adapter.
Assisted by Codex (GPT-6.2-Sol High).
@grosterr on GitHub · 2026-11-26 20:09 UTC · original
Thanks, that is the case we had no data for: a laptop part, Series S, preparation and copy-back above 240 ms together. The routing count matches ours and BitWuehler's (~900-1,000 indirect dispatches a frame through the plain signature).
A neutral frame there is what we would expect. The switch only takes work off the card, and on your run the frame is held by the host side (preparation 149-156 ms, copy-back 117-127 ms). On our RTX 3060 the card was the limit, so 12.8 ms of card time came off and the frame dropped by about 9 ms. If the card time per frame was logged in the same windows, it would show whether the saving is there and just hidden behind the host side.
With three setups now, nothing got worse in any of them: Windows desktop, card −12.8 ms; Proton on a 5080, frame more than halved; Proton on a 5060 Laptop, no change. I think that is enough to turn it on by default. AMD is still unmeasured.
About the fixture: the early return under GE-Proton is
WarpHarness::new(), which all the indirect tests share, so it is not specific to these two tests. If it helps, a follow-up could print why a WARP test was skipped instead of passing silently.