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 · openWhat
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.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.