perf(gpu/texback,host,queue): parallelize diff-only texture readbacks and unlock queue::behind unfold #292
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
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
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
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/Androtim--MiniVI!292
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-292"
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?
@Androtim on GitHub · 2026-12-01 17:23 UTC · original
Androtim:perf/parallel-texback-and-unlocked-unfold→main· +275 −40 · 3 files · 2 commits · merged 2026-12-01 21:10 UTCAddresses #233 and #276 remaining copyback / submission-thread latency.
Changes
texback(crates/victory-gpu/src/texback.rs, crates/victory-gpu/src/host.rs)TICKETSfromMutextoRwLockso concurrenttexback::landworkers validate tickets under shared read locks without serializing.VICTORY_TEXBACK_SAMEby default (VICTORY_TEXBACK_SAME=0kill-switch) and accelerateddiff_rangewith 64-byte slice chunk scanning before bytewise narrowing, skipping completely unchanged readbacks and narrowing writes to modified bytes only.plan_batch+land_batch: deduplicates superseded identical readbacks within a contiguousLate::Runsegment and executes disjoint[at, end)range chains concurrently viashadow::wide_each_scopedwhile strictly preserving order across overlapping ranges andLate::Write/Late::Signalboundaries.queue::behind::unfold(crates/victory-gpu/src/queue/behind.rs)Work::unfold()outsideLane::lock()(unfold_entry+insert_unfolded) so title threads callingsubmit/present/signal/waitdo not block on list unfolding while preserving strict submission sequence ordering.Verification
crates/victory-gpu/src/host.rssize: 647,891 bytes (<= 655,360 policy limit).cargo +1.98.1-x86_64-pc-windows-gnu xtask policy: PASS (318 files ok).cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked texback:: -- --test-threads=1: PASS (5 passed; 0 failed).cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --locked queue::behind:: -- --test-threads=1: PASS (7 passed; 0 failed).clippy -- -D warnings(default and--features diagnostics): PASS (0 warnings).objdump -pon plain--releasebinary: standard Windows DLLs only.Paired Plain
--release60s 1440p A/B vsorigin/main(c15df49b)(RTX 4060 Ti 8 GB, Series X Low-VRAM parity, DLSS Quality, NO
--features diagnostics)origin/main(c15df49b)read-backs and lists(median / mean across in-world windows)copybackms/frameVICTORY_TEXBACK_SAMEunchanged skipmapped()residency rate / totalover = 0 MB),crashes = 0over = 0 MB),crashes = 0github-bot referenced this pull request2026-12-01 20:29:39 +00:00
github-bot referenced this pull request2026-12-01 20:30:17 +00:00
github-bot referenced this pull request2026-12-01 20:30:50 +00:00
github-bot referenced this pull request2026-12-01 20:30:50 +00:00
@Androtim on GitHub · 2026-12-01 17:40 UTC · original
Architect & Strict-Gate Review (
28cb804f): markingtriage: needs work.The
-69.2%read-backs and listsreduction (5.35 -> 1.65 ms),-1.6 mscopybackcut (11.2 -> 9.6 ms),57.7%unchanged readback skip (VICTORY_TEXBACK_SAME=0kill-switch only), and unlockedqueue::behind::unfoldare very promising, but this PR currently fails three strict merge gates:--release60s A/B (omitted from PR table):median_fpsdropped15.05 -> 14.2 fps(-5.6%) (mean_fps 13.11 -> 12.16,min_fps 4.5 -> 2.7) andpreparingticked27.7 -> 27.75 msvsc15df49b.final_waitingtexture regression (omitted from PR table):final_waitingincreased2,665 -> 4,182(+1,517,+57%) vsc15df49b(failing the healthy streaming threshold).--features diagnosticsvisual PNG verification &minivi-triagereview:crates/victory-gpu/src/texback.rs, a 90s--features diagnosticsvisual PNG check (confirming zero corrupted readback textures / water / lighting) is required before merge.To Unblock Merge
--release60s A/B (2-run confirm recommended if scene-window timing caused the FPS/final_waitingdelta) against updatedmain(post-#285) reporting all required gate metrics (median_fps,preparing,copyback,VRAM/over,uploaded,final_waiting,crashes,untranslated) and confirming zero regression inmedian_fpsandfinal_waiting.--features diagnosticsvisual PNG verification pass and wait for automatedminivi-triagereview oftexback.rs/queue/behind.rsconcurrency.@Androtim on GitHub · 2026-12-01 18:04 UTC · original · edited 2026-12-01 21:03 UTC
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
The logic, concurrency invariants, and test coverage across all three touched files look solid, and CI is passing. Because this PR modifies the D3D12 host landing path (
host.rs), enablesVICTORY_TEXBACK_SAMEby default with parallel readback landing (texback.rs), and unlocksLane::lock()duringWork::unfold()(queue/behind.rs), it warrants a local real-GPU smoke test before merging.Verified Changes
crates/victory-gpu/src/texback.rs:TICKETSfromMutextoRwLockallows concurrentland()workers to hold shared read locks while preserving exclusive write serialization intrack()/invalidate()and the existing lock ordering (watch::title_memory_reading()->TICKETS).plan_batch()safely drops invalid/empty entries before deduplicating exact(owner, at, end, footprints, mips)overwrites (sound becausetexback::recordalways copies all0..subresources) and merges overlapping[at, end)intervals into chronologically ordered connected components executed concurrently viashadow::wide_each_scoped.diff_range()64-byte chunk pre-scanning handles empty, sub-chunk, exact-chunk, and single-byte boundary cases cleanly;VICTORY_TEXBACK_SAMEdefaults to on with=0kill-switch (parse_same).crates/victory-gpu/src/host.rs:Host::settle, contiguousLate::Runsegments now draindeferred().texture_backsinto a batch and land them viatexback::land_batchbeforeread_buffer_backs, preserving strict ordering acrossLate::WriteandLate::Signalboundaries while releasingTextureReadbackbuffers back to the pool right after the batch lands.crates/victory-gpu/src/queue/behind.rs:unfoldintounfold_entry(unlocked) +insert_unfolded(locked) preserves queue invariants:state.runningremainsSome(entry.queue)andstate.runsstill accounts for the folded entry duringunfold_entry, so concurrentpush/push_behind/draincalls stay ordered.e.number > entry.numbertoe.number >= numberininsert_unfoldedalso keeps unfolded parts ahead of any remaining siblings sharing the same submission number.pushduring a blockedunfoldand order preservation whentake_alongrejects an unfolded part.Local Real-GPU Smoke Test Needed
VICTORY_ASYNC_SUBMIT=1and defaultVICTORY_TEXBACK_SAME(on), exercising ocean/water CPU readbacks (boats/buoyancy) and multi-flight frames to verify no visual/physics regressions, deadlocks, or stalls, and briefly verifyVICTORY_TEXBACK_SAME=0still works as a kill-switch.Generated with Antigravity CLI (
agy).github-bot referenced this pull request2026-12-01 20:31:16 +00:00
28cb804fd2to32212537b7@Androtim on GitHub · 2026-12-01 20:52 UTC · original
Addressed all
triage: needs workreview items and re-verified on rebasedmain(463d6573):Fixes Applied
crates/victory-gpu/src/queue/behind.rs):at(let Some((at, next)) = next) on both the unmet-foldedandErr(what)re-insertion paths inLane::step, and updatedinsert_unfoldedto searche.number >= number, preventing unfolded parts that sharenumber(e.g.,[Wait(f, 1), Run(after_wait)]) from being reordered ahead of waiting siblings.unfolded_parts_preserve_order_when_take_along_rejects_first_partverifying strict intra-submission order.crates/victory-gpu/src/texback.rs):b.ticket.ownertoplan_batch(BatchEntry) so distinct placed/aliased resources sharing[at, end)with the same shape are never cross-deduplicated and run in chronological chain order.plan_batch_deduplicates_exact_overwrites_and_keeps_overlapping_chains_orderedto cover distinct owners at the same byte span.Static & Unit Test Verification
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy: PASS (318 files ok)cargo +1.98.1-x86_64-pc-windows-gnu test --locked -p victory-gpu --lib queue::behind::: 8 passed, 0 failedcargo +1.98.1-x86_64-pc-windows-gnu test --locked -p victory-gpu --lib texback::: PASSclippy --workspace --locked --all-targets -- -D warnings(default and--features diagnostics): PASS (0 warnings)objdump -p: standard Windows DLLs onlyPaired 60s Plain
--releaseA/B Benchmark (1440p,-PlayParity -LowVram -DlssMode quality) vsmain(463d6573)origin/main(463d6573)#292(Fixed)9.4 fps(106.15 ms, min1.0)14.9 fps(67.1 ms, min6.8)+5.50 fps(+58.5%)38.55 ms27.0 ms-11.55 ms13.25 ms10.4 ms-2.85 ms5835 / 6484 MB(over=0)6098 / 6639 MB(over=0)541 MBheadroomroom=falseratio100.0%0.0%-100.0 pp51716/1321863542/2017-11201waiting (-84.7%)1296329-967(-74.6%)00090s
--features diagnosticsVisual Check (1440p)crashes=0,used_max=6254 MB(over=0 MB),lit=21/24,luma=97.84,near_black=0.05%,edge_energy=7.58,magenta=0.0%(final_waiting=5107due to diagnostics capture overhead vs2017in plain--release).frame-2348.png,frame-2380.png,frame-2404.png): crisp world geometry, water reflections, sky, foliage, and zero corrupted readback textures (showed_another_view=0in plain--release).@Androtim on GitHub · 2026-12-01 21:10 UTC · original
Architect & Strict-Gate Review (
32212537, cleanly rebased, CI passing,minivi-triageverified, zero file overlap with#29381661aff, zero opt-inVICTORY_*toggles —VICTORY_TEXBACK_SAME=0kill-switch only):All prior blocking items were cleanly resolved —
queue::behindunfolded sibling reordering fixed & unit-tested (8/8pass),plan_batchnow keys exact-overwrite dedup onb.ticket.owner, and paired plain--release+ 90s--features diagnosticsverification passed with strong wins across every strict gate:--release60s 1440p A/B vs463d6573:9.4 -> 14.9 fps(+5.50 fps/+58.5%,min 1.0 -> 6.8 fps)38.55 -> 27.0 ms(-11.55 ms) /13.25 -> 10.4 ms(-2.85 ms)6,098 / 6,639 MB(over = 0 MB,room_false 100.0% -> 0.0%),final_waiting13,218 -> 2,017(-84.7%),uploaded51,716 -> 63,542, dropped draws1,296 -> 329(-74.6%)0crashes/DRED,untranslated = 6 -> 6,showed_another_view = 0in plain--release,mapped_rate = 0.25 ms/world_secin 90s diag, and late 90s--features diagnosticsPNGs directly verified crisp and clean (luma = 97.84,near_black = 0.05%,edge_energy = 7.58,magenta = 0.0%).Squash-merging into
main(will tagv2026.12.01.03shipping#291+#293+#292oncemainCI turns green).