perf: reduce GPU submission, coherence, and loading overhead #38
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/trustno1-coder--VIctory-NVIDIA!38
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-38"
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?
@vilaris on GitHub · 2026-11-27 12:20 UTC · original
vilaris:perf/radical-refactor→main· +20335 −2121 · 95 files · 65 commits · open## Summary
This branch brings together performance work aimed at reducing GPU command submission overhead, improving coherence between title memory and GPU copies, and shortening texture and pipeline loading times. The branch history was rewritten to remove all
Co-Authored-Bytrailers.Main changes
GPU/CPU submission and coherence
Resource loading
Measurement and documentation
docs/performance.Validation
git diff --checkpassed for the local changes before they were committed.Suggested review
docs/performance.The first raw-constants version read tables' constants through the slots' raw twins. NVIDIA caps view heaps at 1,000,000 descriptors and the twins (2 x 2^21) never fit ("raw_twins=false" in play-20261127-114321-28084), so constant_align() asked for 256 bytes: ~108 views in place a frame, 2,841-4,075 not, 2,574-3,669 fills, 13.8 fps. - descriptor/host.rs: a constant buffer's slot (constant_at, the mirror's make_twinned, null_constant_at, null_for) is a structured view (DXGI_FORMAT_UNKNOWN, stride 4) of the CBV's bytes (constant_views): it begins at the title's own dword, so no twin and no residual offset are needed; the raw twin is still made where twins exist (picked reads). - victory-shader lower.rs: constants loaded through tables are read as element byte/4 of that structured view (props 12, stride 4); picked ones read the raw twin where twins exist, else the same view. Translator hash changes again. Test harness makes table CBVs structured views. - port.rs: one alignment (ALIGN = 4) for every binder; constants() takes Use::{Root, Table, Mirror}; the log splits not-in-place off 4 bytes and in-place counts by binder. - draw.rs: tables ask with Use::Table; null constant slots are null structured views. - docs: EXPERIMENTS revision entry, UNIFIED_MEMORY_ARCHITECTURE section 10. Not compiled or run (the user compiles).03a6c1ff3atobd7351c8ae9bf8f2d6fcto3013ab8d16@exotiquee on GitHub · 2026-11-27 16:15 UTC · original
A note on the write-watch asking this PR reworks (
kernel_written/kernel_written_intoinwatch.rs). It is a problem that already exists onmain, not something this branch introduces.In
watch.rs,ASKINGholds back an asking only when another asking covers overlapping pages (Asking::hold). So two threads can callGetWriteWatch(WRITE_WATCH_FLAG_RESET)at the same time over disjoint ranges of the same reservation. A submission's refreshes run on several threads, so this can happen.We found that two concurrent
GetWriteWatch(RESET)calls over one reservation can make one of them miss a page written before it began, even when their ranges are disjoint. The next asking reports the page, so the write is not lost for good. It is picked up one asking late, which can mean one submission late. This is consistent with the kernel gathering and resetting write-watch state for more than the asked range.Stress test: title-writer threads, a submitting thread asking, and one more asker over a disjoint sub-range of the same reservation, repeated for about 1.5 s. Results:
GetWriteWatchandResetWriteWatch) serialized behind one process-wide lock, taken after the journal lock wherever that is held: 763 of 17,168 were still late. A second, separate gap was also involved in our tree (a standing asking that didn't wait for an asking already in flight). With both fixed: 0 of 16,801.Suggested fix: serialize the write-watch kernel calls per reservation, or with one global lock as we did. Across all threads the calls add up to only 3-8 ms per frame, so the lock costs little. A per-reservation lock would need the reservation bounds, which costs a system call per asking unless they are cached.
3013ab8d16to143781e60b@vilaris on GitHub · 2026-11-27 17:39 UTC · original
Fixed
mimalloc) 67c9da9327View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.