Repository navigation
Conversation
|
Tested stacked on the RTX 5070 after #493 + #483 + #581 (the pair that stops the world hang here), and it runs: 2.0-2.5 fps in the world, no device removal. Setup: Windows 11 Pro 26200.9974, RTX 5070, driver 617.14, in-box D3D12 10.0.26100.9818;
The frame line now reads No game files; only timings and counts. AI-assisted (DeepSeek V4.1 Flash coding agent). |
|
@wbkepler I ran a native-fence-gated #595 + #562 integration. Reset dropped the draw state while its native work was still pending. Without the fix, WARP reported all 65,536 descriptor slots available before the fence. Transferring the shared and list-local leases to the retired recording preserved both GPU outputs. A separate two-submission test showed that later CPU detiling could rewrite shared texture staging while an earlier GPU copy still needed it. Waiting before rewriting the changed staging kept both outputs correct. Both fixes passed AMD, NVIDIA and WARP with full GPU validation. The deliberate WARP mutations failed both regressions. The integration branch carries the fixes separately at The #185 composition at |
|
Thanks @aycow for the thorough AMD/NVIDIA/WARP validation and both fixes! Folded both into
Gate: |
|
@wbkepler Thanks for carrying the lifetime fixes into The 21 ordered-copy cases and inherited retirement/staging controls passed on AMD, RTX 5070 Laptop and WARP with full GBV. I also fixed the wait helper's handling of Win32 For #185, exact selected slots could go asynchronous once native heap/slot generations are leased under the descriptor mutation lock and backing ranges stay protected through the fence. Current direct-SRV refresh records alone don't hold that proof. Composition and reproduction |
|
Follow-up on the same machine after two CPU-side changes stacked on this PR (not part of it), world scene, release build:
The single submission is now the thing the frame waits on: the main thread prepares, submits, then waits for this PR's completion (which includes the shader results copied back into title memory) before preparing the next one. Nothing here reads wrong; the wait is just the pipeline's length now. No game files; only timings. AI-assisted (DeepSeek V4.1 Flash coding agent). |
|
Tested this on Linux: RX 9070 XT, RADV / Mesa 26.3.1, Proton Experimental (vkd3d-proton 3.2), diagnostics build. Base was It works: GPU time per world frame dropped from 200–350 ms (synchronous) to a few ms. But on its own it hangs the GPU about 6–9 s into the world. That happened three times out of three. Each time it was
So #595 likely needs #452 to land first, or with it. One thing to retire when this meets #282: #282 adds a per-list Two smaller notes from the merge:
AI-assisted (Claude Code). |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested c89f08f on Windows 11, RTX 5070, MSVC: builds; cargo test -p victory-gpu -- --test-threads=1 49 passed, 0 failed, 1 ignored (all 6 new tests pass). I ran single-threaded, so the parallel hang in finding 3 was not exercised.
I read this for ordering, sync points, lifetimes and locks.
What holds:
- Copy-back, then bottom-of-pipe writes, then title signals, with signals queued under the entries lock.
SignalandSignal2Xhold an AddRef until they are set.- Lock order has no cycle: submitted, then finishing, then entries; the finisher doesn't take
submitted. - These sync points all wait correctly:
Copysource and destination,Fill, rect expansion,GpuWrite, texture staging, page mappings, swap-chain resize, present, capture, and the limit of 16 in flight. - Allocators, preludes, scratch and kept objects are released behind their fence.
- A failed
Signalcallsfail, so no wait is left hanging.
One data-correctness problem:
- The per-copy snapshot goes stale while another submission on the same copy is in flight (shadow.rs:166-170, 257-262).
beforeis released only whenpendingis empty, andcopy_backnever refreshesbeforefor the range it just synced.writing()returns early when the hull is unchanged.- Scenario:
- S1 writes range A of copy C. S2 writes a disjoint range B of C and is still in flight, so the snapshot survives S1's copy-back.
- S3 declares A again. Its "before" for A is the bytes from before S1.
- While S3 runs, the title writes byte x in A, which S1 wrote and S3 doesn't touch.
- At S3's copy-back,
h != oandt != h, so the GPU's older value overwrites the title's write.
- This is the lost-write case the diff copy-back exists to prevent, and it becomes common now that the world heap always has something in flight.
- Fix: at the end of
copy_back, whenpendingis still non-empty, copyhost[from..to]into the matching part ofbefore. Or havewriting()always re-take[from, to), which is safe becausesettleguarantees no writer of that range is in flight.
Also:
- Mark-clean race, much wider now (shadow.rs:216 vs 243-248). Title memory is read before the write-journal timestamp
nowis taken. A title write between the two is stampedcopied = nowand never recopied. Copy-back now runs on the finisher thread at the same time as the title, so this window is open all the time. Fix: take the timestamp beforeread_into. - A test can hang (host.rs ~2685-2697).
dynamic_descriptor_leases_stay_held_until_async_submission_finishesgates the shared queue withqueue.Wait(gate, 1)and signals the gate only after its ownexecutereturns. Another host test submitting behind the gate in parallel can block insettlewhile holdingsubmitted. Serialize the host tests, or signal the gate from another thread. - Two tests probably don't take the path they name (host.rs ~2571, ~2617). The lists are tiny and usually finish before the
reset()or the secondexecute. The gate trick from 3 would force the path. (The description says 5 tests; there are 6.) - Nit:
conflict(writing = true)also waits for in-flight GPU reads, but those read the host copy taken at their own submission, so a write to title memory doesn't need to wait for them. - Nit:
DynamicLeasenow drops later, on the finisher.release_dynamicmatches the heap by address, so a heap freed and replaced at the same address in between gets the wrong slots released. A generation number or anArcwould fix it.
It conflicts with current upstream main in draw.rs, host.rs and texture.rs, so it isn't merged into our fork.
AI-assisted (Claude Code).
…ark-clean race, and make gated tests deadlock-free (Marvisak#595)
|
@wbkepler I tested a current-main #595/#562 composition at Follow-up on the same production head: the five cases passed on explicitly selected AMD Radeon Graphics, RTX 5070 Laptop, and WARP with Agility 1.620.2, full GPU-based validation and state tracking, and zero warning/error callbacks. Test-only adapter harness. Run the ignored The ordered-copy follow-up now includes #387 |
Port of VIctory #595 (five commits: run submissions asynchronously on a host fence timeline; a refresh waits for an earlier submission only if the title wrote the overlap; a list reset while it runs records into fresh memory; formatting; dynamic descriptor leases and texture staging waits). Submissions are no longer waited for. Each signals the next host fence value and joins a timeline (host/timeline.rs). Once the GPU has run it, it is finished in submission order: GPU copy destinations and shader-written ranges written back into title memory, then its bottom-of-pipe writes, then the title fence signals queued behind it. A completion thread (xtp-gpu-finisher) finishes submissions as soon as the fence reaches them. A thread that needs one finished first waits for that one only: - a later step that reads title memory an earlier submission's GPU work writes, or writes memory it reads or writes; - a refresh through the same host copy only if the title wrote the overlap since the copy took it (Shadow::stale); - a texture staging buffer an earlier GPU copy still reads; - a list submitted again while it runs, more than 16 submissions in flight, page mappings, swap chain resizes, blocking fence waits and the present (which drains the frame). A list reset while it runs hands its allocator, prelude, scratch and upload memory, kept objects and textures, dynamic descriptor leases, budget word and title uploads to the timeline, and records into fresh or spare ones. XTP: merged by hand onto gpu-frame (G1-G4). - GPU buffer copies (G3) go back on the completion thread too, merged per host copy and before shader-written ranges, as in G3. They count as GPU writes for later steps. A GPU copy into a range an earlier submission's shaders write through the same copy waits for it: that one's write-back is told from a snapshot of the copy. - The frame-rate line keeps preparing, GPU and copying back, and adds the title's waiting and the overlap. Preparing leaves out the waits inside it. The GPU time is measured until each submission was seen done. The longest submission is counted when it finishes. - XTP_SYNC_SUBMIT=1 brings back synchronous submission for bisecting (gpu.md risk 2): each submission waited for and finished in execute, no completion thread. - Host fence waits go in 500 ms slices that check for device removal and warn every 5 s (as xcl's fence waits do); a removed device ends the run with the device-removed data of every submission in flight. - Timeline entries carry merged ranges, and refresh conflicts are looked up through them first (G3 records thousands of copies per frame). - Texture refreshes are not copied and hashed a second time before detiling (#595's last commit did): a title write meanwhile is detiled again at the next check. - Tests on WARP: completion order, write-back after the GPU work, fence signals, list memory retirement, dynamic descriptor leases, the waits (and the refresh that does not wait), the synchronous path. Co-authored-by: wrothgaril <211408787+wrothgaril@users.noreply.github.com> Co-authored-by: asc <aydanscowan@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ported from Marvisak/VIctory#595 (head c89f08fe866dab895998df79e7c65b6f091f5d95) by wbkepler
|
@wbkepler A held-fence reader regression on current main plus |
|
The new synthetic CPU-inside-UAV reproductions for #185/#387 exercise a CPU update after list recording, a real UAV write, and a different CPU write after the snapshot. Synchronous fixes landed on those branches. At exact ba55d3c, this cannot be ported as removal of pending ranges: older in-flight writers still need those exclusions, and the held-reader regression reported above demonstrates why older readers need protection too. The safe integration point is after refresh preparation for the current declarations, separately from completion-owned earlier intervals. Direct descriptor/heap generations and backing bytes still need fence ownership before a composition can be validated. |
|
The prior timestamp-generation work is now an independently validated #509 composition with exact #509 and current #595 plus the confirmed-fence guard, free of #387/#562 dependencies. The held-fence/replay regression and one-submit smoke pass AMD/NVIDIA/WARP with full GBV. This isolates census lifetime work from the shadow data/descriptor ownership cases. |
…ark-clean race, and make gated tests deadlock-free (Marvisak#595)
ba55d3c to
e6694e4
Compare
|
@mercuryVM thanks for the careful review (written against Where each finding stands at the rebased head:
New in the rebase ( Verified: AI-assisted (Claude Code); checked on Windows 11 / RTX 5090. |
|
Pushed #1414 fixes
Gate: AI-assisted (Claude Code); checked on Windows 11 / RTX 5090. |
|
A review of Why it matters for the Prestream watchdog (#1118). The title submits from one thread (
So the stall moves from Correctness points:
Tests: on an RTX 3050 6 GB (Linux, Proton 11, vkd3d-proton) with a real device, Would a rebase onto AI-assisted review (Claude Code, Codex, Antigravity). No game data. |
|
The held-fence reader control in our earlier integration independently reproduced the refresh-conflict issue on 7465030: an earlier queued read of 11 saw the later CPU refresh to 29 until the reader was protected. The historical census composition 6e79490 also checks reset/replay and counts repeated recordings with ambiguous timestamp spans suppressed. With the current renderer conflicts and the rebase offered here, I will keep #509 independently mergeable and use those controls against a new submission integration when available. The checks should use actual fence completion before mapping old readback. AI-assisted using Codex. |
Submissions are no longer waited for: each signals the next host fence value and joins a timeline of up to 16 in flight, finished in order (copy back, then bottom-of-pipe writes, then title fence signals) by a finisher thread or whichever thread first needs one. Allocators, preludes, scratch, kept objects, twins, dynamic descriptor leases and retired heap resources are released behind their submission's fence. A step touching title memory, host copies or texture staging waits only for in-flight submissions that write (or read) it. Rebased onto the page table, bindless heap views, twins and change journal: a list's after-run work and missed-memory checks move into the pending submission; bindless texture uploads, view heap refreshes and page table refreshes wait for in-flight writers like other steps, a page table is rewritten only with no reader in flight, and a page table user counts as writing every copy it names. A list named again in one submission gets its own prelude, and what its steps write into the list's own memory (upload memory, scratch, budget word) goes into an upload buffer of the submission that the repeat's prelude copies in on the GPU, so each run reads its own data with no CPU wait. List memory is a CPU-visible custom heap the GPU can copy into. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
7465030 to
dfac3b4
Compare
|
Rebased onto Conflicts that needed more than a merge
Repeated list in one submission: upload memory and budget New test Verification
AI-assisted (Claude Code); checked on Windows 11 / RTX 5090. |
|
@wbkepler I independently checked the current-main rebase AI-assisted using Codex. Follow-up on the AMD replay reproduction. With native inbox D3D12, the failure persisted with standard readback, independent outputs, an explicit source transition, and a held fence. Omitting replay passed. Waiting for confirmed native fence completion immediately before a group reuses the command-list recording restored both words. Local |
|
Thanks for the rebase. The present point from my review is now a one-commit PR against |
|
Automated triage for the maintainers. Needs rebase. This PR does not merge cleanly into current The content has not been reviewed yet; it will be once the branch is rebased onto Generated by Claude Code |
|
Rebased this onto current It is open as #1923 so the maintainer can take a ready branch. If you would rather update this PR yourself, reset Two things from the review thread I carried into #1923's description rather than fixing here: |
GPU: Bind bounded buffer reads selected by a root constant
Summary
Host::executeused to submit, signal, thenWaitForSingleObject(INFINITE)on every submission before copying shader-written ranges back and doing the bottom-of-pipe writes. Each world frame has about 150 submissions, all fully serialized, so the CPU and GPU never overlapped. This PR runs them on an asynchronous GPU timeline.Timeline (
timeline.rs): each submission signals the next host fence value and is pushed with its work and the title memory its GPU work touches:Submissions are finished strictly in order, one thread at a time. Finishing a submission means: copy-back, then its bottom-of-pipe writes, then the title fence signals queued behind it. Signals run under the entries lock, so a signal queued later can never overtake them.
Completion thread (
victory-gpu-finisher): waits on the host fence for the oldest submission and finishes it. Title fences and bottom-of-pipe memory therefore move on their own, which covers titles that wait on events or poll memory.Queue
Signal/Signal2X: the fence is AddRef'd and set once every earlier submission has finished, or at once if none is in flight.Lists reset while they run (D3D12 allows a reset right after submission; titles record the next frame into their lists while the GPU runs this one): the reset no longer waits.
Retired,SPARE_*).Sync points. The thread that needs a submission finished waits for that one only:
A later submission's CPU-side steps (
Batch::settle):Fill,Copysource, rectangle expansion, texture staging refresh, and theGpuWritesnapshot;Copydestination,CopyMemoryToMemoryX;Refreshoverlapping an in-flight submission's shader writes through the same copy waits only if the write journal shows a title write in the overlap since the copy took it (Timeline::refresh_conflict,Shadow::stale). Overlaps with bottom-of-pipe targets or with shader writes through another copy always wait.In-flight shader-write ranges on one copy never overlap, which keeps the per-copy snapshot/
pendingbookkeeping sound.Resubmitting a recording that is still running, page-mapping batches, swap-chain resizes, a blocking (null-event)
SetEventOnCompletion, capture readbacks, and more than 16 submissions in flight.Device removal is detected when a submission is finished. The DRED report covers the lists of every submission still in flight. A failed
Signalends the run instead of leaving a wait that never returns.VICTORY_GPU_TIMING(diagnostics) stays synchronous: each list is waited for and timed.What stays synchronous, and why
// shortcut:inHost::present). A title may treat a present as the GPU being done with the frame. In the world the GPU has usually finished by then (about 0 ms waited at present), so this costs little now; letting one frame run on is a follow-up.Test evidence
timeline: submissions finish in order and signals follow their work; conflicts pick the newest overlapping submission; a refresh waits only for title-written overlaps, with labels and other copies always counting.host(on the host device): a list reset while it runs records into fresh memory and both bottom-of-pipe writes land; a queued signal sees an earlier submission's write; a later submission's fill of memory an earlier one writes sees the written value.cargo clippy --workspace --all-targets,cargo clippy -p victory --features diagnostics --all-targets(no new warnings),cargo test --workspaceandcargo xtask policyall pass. New and changed code is rustfmt-clean.VICTORY_D3D12_DRED=1, 7-minute runs (menus → about 60 s loading → world). Each build is GPU: refuse wave64 mesh and compute programs on hosts without 64-lane waves #578 (refuse wave64 programs on 32-lane hosts, which ends the NVIDIA device removals) with or without this PR:upstream/main, menus also became steady (22–42 fps with dips to 4–10 became a steady 30). The world was dominated by the wave64 hangs then.🤖 Generated with Claude Code