Repository navigation
Conversation
…y saves Eliminate mid-gameplay 500 ms PSO wait freezes and periodic 20-second pipeline-worker stalls while raising early-warmup capacity: - pipeline/make: replace non-atomic FRAME/WAITED_US accounting with a lock-free packed AtomicU64 FrameBudget (reserve + same-frame refund) so concurrent recording threads cannot overshoot the frame wait budget or corrupt a subsequent frame's budget; move from a single global Condvar to per-Pending wakeups so unrelated background compiles do not wake waiting threads. - pipeline/make: use an adaptive default budget (500 ms during the first 60 warmup frames for boot/menu/one-shot init passes, 8 ms in steady state) with an explicit `VICTORY_PSO_WAIT_MS` (`0..=5000`) override. - pipeline/library: offload periodic saves onto a dedicated low-priority background saver thread reusing its serialization buffer (pre-sized outside `library.lock()`), hold `library.lock()` only for `Serialize`, skip rewriting `host-pipelines.bin` when only the early list changed, perform atomic unique-temp write + rename with cleanup on error outside all locks, keep `save(true)` synchronous on shutdown, and raise `EARLY_MAX` from 8,192 to 65,536. - tests: add unit tests for concurrent budget reservation/refund/frame isolation, `VICTORY_PSO_WAIT_MS` parsing/clamping and adaptive defaults, early-list recording/dedup above 8,192 up to 65,536, and atomic-write temp-file cleanup on rename failure.
|
I compiled a deterministic CPU-only test against the This interleaving needs no timing-sensitive test: let budget = FrameBudget::new();
let limit_us = 8_000;
assert_eq!(budget.reserve(101, limit_us), limit_us);
assert_eq!(
(budget.reserve(100, limit_us), budget.reserve(101, limit_us)),
(0, 0),
);The current implementation returns |
|
@ifBars Good catch — thanks for the deterministic repro! Fixed in
|
# Conflicts: # crates/victory-gpu/src/pipeline/library.rs
…Marvisak#358 Marvisak#89 Marvisak#331 Marvisak#86 Marvisak#83 Marvisak#211 Marvisak#260 Marvisak#275) Conflict in crates/victory-gpu/src/descriptor/host.rs: gpu-state (Marvisak#251) moved the dynamic-slot search into free_table(); gpu-draw (Marvisak#86) bounds the search by the heap's spare slots instead of DYNAMIC. free_table() works over taken.len(), which is the spare count, so the helper is kept with gpu-draw's spare-based cursor wrap. Both sides' tests kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tester tree (upstream main ffe310e plus its PRs, update 8; see its INTEGRATION.md) ran 11-25 minutes in the world on an RTX 5070 without a device removal. Where both sides carry the same PR (the wave64 stack #223/#233/#320 with #439 and #180, #454, #336, #259, #331 and others), the tester tree's newer head is taken; our own work and the PRs only we merged are kept. Conflicts, file by file: - descriptor/host.rs: the tester layout (`spare`, the guard slot after the dynamic slots, `free_table`, the capped sampler heap). A capped view heap keeps `capped_reserve()` dynamic slots, now 2^18 by default (the tester measurement, and our 91fed158), still `VICTORY_DYNAMIC_SLOTS` in diagnostics builds; uncapped hosts keep our 2^19. Our slot statistics (TAKEN/PEAK/SHORT), the bindless plan cache (`CommittedRegions`, `timed_valid_title_address`, `timed_find`, `title_bounds`) and the revision triple are kept beside the tester's `guard_slot`. - Buffer states: the tester tree's buffer-state tracker (#334: every list moves host copies of title memory between GENERIC_READ and UNORDERED_ACCESS and back to common before it closes) and depth twins (#469) are taken. #40's enhanced/legacy indirect barriers (the indirect prelude, `use_indirect_buffers`, the title buffer handoff mirrored in `host_barrier`) cannot share buffers with that tracker and are dropped; #40's argument checks (`byte_len`, exact spans, overflow-safe clamp shader, aligned counts) stay. `indirect::bound` and #282's `rectangles` go through `buffer_state`, and `indirect::execute` (#334) replaces `done`. #178's DXC fallback compiles both of our passes. Our segments (#387: `close` ends the segment, `close_native` closes a native list) carry the tracker: each native list returns its buffers to common and its twins to their depth targets, and each prelude also holds our texture uploads. - shadow.rs: our write flow (`queue_write`, one `snapshot` after the batch's refreshes, `finish_writes`, the unchanged-page cache) with #261's copy-back that also gives the snapshot the title's bytes; its tests run through our flow. - pipeline/make.rs: #275's per-frame budget and per-pipeline wake pair, with our compute waits (a dispatch waits for its pipeline, up to 20 s). - pipeline/library.rs: the tester version (#347, #275's saver thread); our concurrent-write test kept. shader_cache.rs: our byte-returning cache API with #358's "translated, only not kept". - draw.rs: #493's root SRV tables; where no table can stand in, our drop of a draw whose root view is unset or outside title buffers. Our refusal of a table offset past the capped heap stays. - resource.rs: `HostTexture` has both our `staged` generation and the depth twin. - Shaders: the tester's lower.rs for the wave64 stack, #160's image sampling (it covers our #73 and #136 sample forms) and #453/#587; kept from our side: #136's preference for an image or buffer use of a descriptor read as data and its `s_buffer_` arm, #422's nearest-even narrowing (also for #169's d16 loads and #453's interpolation), #452's spin-wait limit, #391's LDS limit, #302's spilled root arguments (now in `NativeProgram::translation_ir`), #136's PSV0 interpolation beside the tester's row harmonisation. split_tests.rs, lane_read_loop_tests.rs and docs/wave64-on-wave32.md are the tester versions (the same PRs at newer heads). - Tests: #483's heap guard dwords filled in our GPU tests of #200 (v_div_scale) and #437 (scalar loads from a raw view), which read through the guard slot otherwise; #334's debug-layer test passes an offset to our `indirect::bound`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry at the same time Head f821cb9 (TG0000). Conflicts in pipeline/library.rs: our imports (Arc, mpsc for #275's saver thread) with #1000's Condvar; the load takes #1000's form (the interface cloned out of the lock, a hold per name). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 |
|
A pointer and one observation, since this PR and #2111 change the same accounting in What overlaps. On What is only here. The adaptive budget (500 ms for the first 60 frames, 8 ms after), One behavioural difference, from reading Suggestion. After a rebase, the parts unique to this PR sit on top of either accounting, so the two need not compete: this could keep the adaptive budget, the switch and the per-pipeline wake, and take the accounting from whichever the maintainers prefer. If they prefer this PR's accounting, #2111 can close. Either way a test with two threads waiting at once would pin the case above. Nothing was run for this comment; I read the diff. AI-assisted (Claude Code). |
Summary
Eliminates mid-gameplay 500 ms PSO wait freezes and periodic 20-second pipeline-worker stalls while raising early-warmup capacity:
pipeline/make.rs:FRAME/WAITED_USaccounting with a lock-free packedAtomicU64FrameBudget(reserve + same-frame refund) so concurrent recording threads cannot collectively overshoot the frame wait budget or corrupt newer frames.Condvarto per-Pendingwait_lock/wait_donewakeups.< 60, 8 ms in steady state) with an explicitVICTORY_PSO_WAIT_MS(0..=5000ms) override.pipeline/library.rs:save(false)onto a dedicated low-priority background saver thread reusing its serialization buffer (pre-sized outsidelibrary.lock()).library.lock()strictly forID3D12PipelineLibrary1::Serialize, skips rewritinghost-pipelines.binwhen onlyearly-pipelines.txtchanged, and performs unique-temp atomic write+rename with cleanup on error outside all locks (restoring dirty counters on failure).save(true)synchronous via FIFOSaveAck, and raisesEARLY_MAXfrom8,192to65,536.victory-gpucovering concurrent 8-thread budget reservation/refund/frame isolation,VICTORY_PSO_WAIT_MSparsing/clamping and adaptive defaults, early-list recording/dedup up to 65,536, and atomic-write overwrite + temp-file cleanup on rename error.Verification
cargo clippy --workspace --all-targets— passed (zero new warnings)cargo clippy -p victory --features diagnostics --all-targets— passedcargo test --workspace— passedcargo xtask policy— passed (151 files ok)