GPU: a list's upload fills can be shared among threads (VICTORY_FILL_WORKERS) #2900
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!2900
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2900"
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?
@0xkn0wh3r3 on GitHub · 2026-11-25 23:29 UTC · original
0xkn0wh3r3:gpu/upload-fills-in-parallel→main· +294 −2 · 1 files · 2 commits · openWhat
At submission, each list copies the title memory its draws read into upload memory (
defer_fill: root constant buffers not on 256 bytes, expanded data). It does this one fill at a time on the submitting thread.With
VICTORY_FILL_WORKERS=2…6(default1, unchanged), a run of consecutive fills, up to the next step that may write title memory, is shared among that many threads, at least 128 fills each. That happens only when the fills are independent:Anything else runs in order. The submitting thread takes one share and waits for the rest before the next step. The helper threads are a small pool started on first use, because spawning threads for each run costs more than the copies.
Measurement
28,279 fills of 448 bytes in runs of 512, the workload DexNom measured. Release build, Windows 11, Ryzen 9 7900X,
fill_runs_bench, medians of 10 rounds each:That's a CPU microbenchmark. I haven't measured how many fills a frame of the title makes on this tree, which is why it stays opt-in.
Where it came from
From DexNom's fork, DexNom/VIctory@5f4c3df (
Fill,independent_fills,run_fillsand their tests; opt-in there too). Here the runs are found at submission instead of being grouped when recorded, and the crate uses its own small pool. Credited withCo-authored-by: DexNom.Tested
host::fill_tests::parallel_fills_copy_what_serial_ones_do: 512 fills of 448 bytes on four threads copy the same bytes as one thread does, from the source as it is when they run.host::fill_tests::dependent_fills_run_in_order: overlapping destinations, and a source that reads another fill's destination, both run in order.host::fill_tests::a_title_copy_ends_a_run_of_fills.cargo test -p victory-gpu: 232 passed both by default and withVICTORY_FILL_WORKERS=4. The 2 known NVIDIA failures are fixed by #2121.cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--features diagnostics: clean.Not tested
Changes after review
85befef: a share is counted done by a guard that drops after it, including while a panic in it unwinds. Pool threads catch a share's panic and take the next. A share that can't be sent to the pool (no thread left) runs on the submitting thread. New testa_panicking_share_counts_as_done.@Marvisak on GitHub · 2026-11-26 02:16 UTC · original
Automated triage for the maintainers.
Merge candidate (a recommendation to look, not an approval). In
host.rsHostList::run_deferred, a run of consecutiveStep::Fills can be shared among a small thread pool whenVICTORY_FILL_WORKERSis 2–6. The default of 1 keeps today's serial path. I checked that a run stops at the first non-fill step, thatindependent_fillsfalls back to in-order copies for overlapping or aliased fills, and that the submitting thread waits for every share, panics included (ShareDone), before the next step. CIcheckpasses. The only evidence is a microbenchmark (about 9 ms down to 6–7 ms) with no frame measurement from the title, which is why it stays opt-in.Generated by Claude Code
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.