gpu: opt-in async submit pipeline, thin peephole, and parallel recording #4856

Closed
github-bot wants to merge 1 commit from github-bot/gh-4855 into main AGit
Owner

@⁠lyufeng000 on GitHub · 2026-12-01 11:43 UTC · original
lyufeng000:pr/submit-pipeline → main · +4667 −130 · 8 files · 1 commits · closed without merging

Motivation

On an RTX 4090 + Ryzen 9 9950X at 4K DLSS Quality (steady state on upstream e1251c31), actual GPU frame time is 27.7–29.0 ms, yet the main submission thread spends ~24.9 ms/frame synchronously preparing, recording, and submitting under Host::submitted. Because CPU preparation, D3D12 command-list recording for card copies, and queue submission share the same coarse submission lock, the GPU frequently starves for ~7.0 ms/frame (~80% GPU utilization) waiting for the next batch of command lists.

This PR ports an independent, strictly opt-in asynchronous submission pipeline onto upstream e1251c31 with four composable stages—all disabled by default—so maintainers can merge with zero default-path risk and A/B benchmark each stage individually or together.


Architecture

1. Stage 0: Zero-Allocation Thin-Stream Peephole Folding (VICTORY_THIN_PEEPHOLE=1)

  • Implemented in crates/victory-gpu/src/list/thin.rs (PeepholeWindow, translate_peephole).
  • Stack-allocated, single-pass window ahead of list::thin replay:
    • Class A (scalar/pipeline state): folds consecutive writes and suppresses zero-diff redundant bindings (PIPELINE, ROOT, TOPOLOGY, STENCIL_REF, BLEND_FACTOR, SAMPLE_MASK, VIEWPORTS, SCISSORS, INDEX_BUFFER, TARGETS, HEAPS, SHADING_RATE), resetting committed history on RESET and CLEAR_STATE. TARGETS flushes any pending coalesced copy first to preserve copy-vs-target ordering.
    • Class B (root slots & vertex buffers): dead-write elimination for identical (kind, slot) or vertex-buffer range overwrites before a flush boundary.
    • Class C (barriers & contiguous copies): skips truly empty BARRIER/BARRIER_GROUPS (w[0] == 0) while strictly preserving upstream's bit-63 narrow BARRIER_GROUPS skip marker (w[0] == 1 << 63 -> state.synced()), and merges adjacent COPY_BUFFER/COPY_MEMORY calls under four gates (same kind/buffers, contiguous offsets, dst != src non-aliasing including buffer_base overlap check, and capped byte budget).
    • Hard boundaries (draws, dispatches, clears, resolves, queries, waits, indirects, EXTERNAL, UPLOAD, CLOSE) flush all pending state in original order before replay, and abandoned recordings stop immediately before emitting actions.

2. Stage 2/3 Decoupled Submission (VICTORY_SUBMIT_STAGE_SPLIT=1)

  • Implemented in crates/victory-gpu/src/host/pipeline.rs (Host::submit_pipelined, QueueOrder, AirScoreboard, PipelineStageBus, stage3_worker) with minimal hooks in host.rs and queue/behind.rs.
  • Lock decoupling & deferred card_before recording: Stage 2 runs CPU preparation under a dedicated parallel_rec::prep_lock() without holding Host::submitted, while Stage 3 (victory-stage3) performs deferred card_record_parallel command-list recording outside both Host::submitted and prep_lock (offloading ~1.9–2.5 ms/frame off Stage 2), drains heap sync waits, issues ExecuteCommandLists + Signal, registers flights into LINE, and retires lists concurrently with Batch N+1's Stage 2 preparation.
  • Two-phase QueueOrder { assigned, queued }:
    • Stage 2 briefly increments assigned to tag shadow::card_dirty(sent_as) without holding QUEUE_ORDER across recording.
    • Stage 3 advances queued = queued.max(sent_as) strictly after ExecuteCommandLists and Signal.
    • victory-relay observes only queued, guaranteeing it never treats an unsubmitted Stage 2 batch as already queued.
  • AirScoreboard zero-gap handoff:
    • Tracks declared shader writes, texture read-backs, card_steps::Taken::copied_ranges(), and bottom-of-pipe writes for batches sitting in PipelineStageBus between Stage 2 and Stage 3.
    • Stage 3 registers Late::Run into LINE (calling line.joined(...) so VICTORY_LAZY_NARROW=1 stays exact), releases LINE, and then calls air_retire(token).
    • Readers (late_blocked, late_met_known, late_met_by, land_before_remap, and Stage 2 air assembly) snapshot AirScoreboard first, then lock LINE—eliminating observation gaps without ever nesting AIR_SCOREBOARD and LINE.
  • Bounded FIFO PipelineStageBus (capacity 8):
    • Preserves strict submission order and interleaves late_signal (Stage3Item::Signal retaining crate::fence::FenceRef) directly into the FIFO when Stage 3 is active.
    • Takes precedence over VICTORY_SUBMIT_SPLIT (split_send() automatically yields when stage_split_on() is active).

3. Parallel card_before Recording (VICTORY_PARALLEL_REC=1)

  • Implemented in crates/victory-gpu/src/host/parallel_rec.rs (EpochSlotRing, D3d12AllocatorPool, ParallelRecPool, Host::card_before_parallel).
  • Fence-epoch allocator pooling: reclaims (ID3D12CommandAllocator, ID3D12GraphicsCommandList) slots only when retired_fence <= completed_fence and explicitly rejects completed_fence == u64::MAX (device lost).
  • Zero-allocation, panic-safe worker pool: lazily initialized only when a burst exceeds thresholds (>= 64 hashed shadows or >= 128 compared ranges); steady-state batches (~13 hashed shadows, ~18 compares) record inline in a single command list with zero worker wakeups.
  • Full parity with upstream e1251c31 card_record: preserves send::Own (+ own.copied() synchronization for VICTORY_SEND_BESIDE=1), upcheck, upq (only when !defer_sync, safely skipped in Stage 2 outside Host::submitted), private CPU mirror snapshot_private_ranges fallback, pre-computed lazy::hold_back strictly ahead of lazy::select/lazy::sweep, VICTORY_LAND_CAPTURE=1 (bind_capture + mode 6), VICTORY_CARD_BATCH=1 (CARD_COMPARE_BATCH + pre-allocated disjoint take_card_jobs ranges), scoped_uav_barriers, barstat::rb, and cardmeter.

4. Full-Segment R/W State-Closure Coalescing (VICTORY_COALESCE_CUTS=1)

  • Implemented in crates/victory-gpu/src/host/parallel_rec.rs (coalesce_execute_cuts) with lightweight tracking on HostList (has_unbounded_uav, set on Use::Builds in draw.rs) and Deferred (copy_source_shadows / copy_dest_shadows, populated in host/place.rs).
  • Merges up to MAX_COALESCED_PARTS = 2 adjacent non-conflicting parts into fewer ExecuteCommandLists calls only when scanning every list in G \cup P satisfies:
    W(G) \cap (R_{\text{buf}}(P) \cup W(P)) = \emptyset \quad \land \quad R_{\text{buf}}(G) \cap W(P) = \emptyset
  • Always preserves hard cuts on bottom-of-pipe writes (deferred.writes), Step::Placed, Step::Run, unbounded UAV shaders (Use::Builds), card_steps prefix segments (own.is_some()), and unscoped picked.written ranges.

Opt-In Switches (All Default OFF)

All switches use crate::asked_for! ("1" enables; unset / "0" disables). No apps/victory/src/play.rs defaults are changed.

Environment Variable Default Scope Description
VICTORY_THIN_PEEPHOLE 0 (off) Stage 0 (list/thin.rs) Stack-allocated zero-allocation peephole folding/merging during thin stream replay
VICTORY_SUBMIT_STAGE_SPLIT 0 (off) Stage 2/3 (host/pipeline.rs) Decouples Stage 2 CPU prep (prep_lock) from Stage 3 GPU submit (Host::submitted) via QueueOrder, AirScoreboard, and bounded FIFO victory-stage3
VICTORY_PARALLEL_REC 0 (off) card_before (host/parallel_rec.rs) Fence-epoch allocator ring + inline steady-state / multi-core burst recording for card_before sync/hash/check lists
VICTORY_COALESCE_CUTS 0 (off) Submit cuts (host/parallel_rec.rs) Full-segment R/W state-closure coalescing of up to 2 adjacent non-conflicting ExecuteCommandLists parts

When all four switches are unset, list::thin::translate, Host::send_late, Host::submit, Host::card_before, and cuts execute upstream e1251c31's exact original paths without spawning any extra threads.


Ordering, Streamline & Safety Invariants

  1. Streamline Commit-Window Red Line:
    • run.take_upscale(), run.deferred().framegen_camera (when streamline::fsr::ml_active()), streamline::submitted(id, camera), run.take_hudless(), and streamline::hudless_submitted(id) execute strictly inside Stage 3's Host::submitted window—never in Stage 2 and never across a Present.
    • pipeline::flush_stage3() runs before show_planes in queue/behind.rs (Job::Present), at the entry of Host::present_placed (covering VICTORY_ASYNC_SUBMIT=0 as well), in Lane::drain(), in settle_now(), and in Host::submit / Host::execute_unwaited.
  2. slot0 Standalone COMMON Decay Boundary:
    • Whenever send::Own records copies/scatters into pre_lists[0] (has_own_slot0 == true), submit_pre_lists (partition_pre_lists) executes pre_lists[0] in its own standalone ExecuteCommandLists call (with before_send for VICTORY_RESIDENT_LATER=1) before any parallel hash lists or runs, guaranteeing unhashed buffers decay back to COMMON.
  3. Acyclic Lock Hierarchy:
    • Lane::state < prep_lock < PipelineStageBus (not_full / flush) < Host::submitted < QUEUE_ORDER < CARD_WORK < LINE, with AIR_SCOREBOARD and PipelineStageBus::state as strict leaf locks.
    • victory-stage3 calls crate::queue::no_drain_here() at startup, never acquires prep_lock, wraps its loop in catch_unwind -> fail(...), and executes card_steps::put_off, beside::send_fills, land(), and bury() (uav_pool::drain_retired_uavs) cleanly.
  4. host.rs Size Gate:
    • Core Stage 2/3 and parallel recording logic lives in crates/victory-gpu/src/host/pipeline.rs and crates/victory-gpu/src/host/parallel_rec.rs; host.rs grows by only ~4.7 KiB (~951.5 KiB total, well under the 1 MiB policy limit).

Verification & Unit Tests

Added Unit Tests (14 new tests, all passing under default and --features diagnostics)

  • Stage 0 Peephole (crates/victory-gpu/src/list/thin.rs):
    • peep_class_a_folds_and_suppresses_zero_diff_until_reset_or_clear_state
    • peep_class_b_dead_write_elimination_respects_slots_and_ranges
    • peep_class_c_skips_empty_barriers_preserves_narrow_skip_and_enforces_copy_four_gates
    • peep_hard_boundaries_flush_pending_and_abandoned_stops_before_action
  • ParallelRec & CoalesceCuts (crates/victory-gpu/src/host/parallel_rec.rs):
    • epoch_slot_ring_reclaims_only_completed_fences_and_rejects_lost_device
    • parallel_rec_pool_executes_all_items_across_reuses
    • coalesce_never_crosses_hard_cuts_or_cap
    • coalesce_closure_checks_middle_lists_place_source_and_rw_hazards
    • card_before_fanout_thresholds_keep_steady_state_inline_and_fan_out_bursts
  • Stage 2/3 Decoupled Pipeline (crates/victory-gpu/src/host/pipeline.rs):
    • queue_order_two_stage_keeps_assigned_ahead_of_queued_monotonically
    • air_scoreboard_tracks_overlapping_in_flight_writes_and_retires
    • air_scoreboard_line_handoff_has_no_observation_gap
    • stage_bus_preserves_fifo_order_interleaves_signals_and_flushes
    • slot0_partition_isolates_send_own_when_active

Gate Results (against base e1251c31, rustc 1.98.1)

  • cargo clippy --workspace --all-targets --locked & --all-features: 0 warnings in all modified/added files. (Pre-existing warnings on upstream e1251c31 untouched: victory-shader/src/emit/lower.rs:114, victory-gpu/src/shadow.rs:7197, victory-gpu/src/copystat.rs:1470, victory-gpu/src/host.rs:5106, victory-hle/src/modules/xmem.rs:1933.)
  • cargo xtask policy: 0 violations in all modified/added files. (Pre-existing upstream e1251c31 notice in untouched crates/victory-shader/src/native.rs.)
  • cargo test: All 14 new PR unit tests pass under both default and --features diagnostics; all touched/dependent crates (victory, victory-core, victory-formats, victory-game, victory-hle, victory-loader, victory-pe, victory-pipeline, 6/7 in xtask, and 1144 tests in victory-gpu) pass. (Pre-existing upstream e1251c31 failures untouched: xtask::policy::tests::repository_passes_policy on crates/victory-shader/src/native.rs, list::thin::tests::bindings_record_no_work, shader_cache::tests::every_switch_of_the_translator_is_in_the_key, victory-shader::emit::bitcode::opt::tests::hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity, and RTX 4090 fast-GPU round-0 timing on card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end.)
  • cargo build --release --locked -p victory: builds cleanly.

A/B Benchmark Results (RTX 4090 + 9950X, 4K DLSS Quality + FG 2x)

Measured on the same 4K DLSS Quality + FG 2x configuration with VICTORY_PLACED_COPIED=0, comparing the matched upstream e1251c31 baseline against Full PR 3 Pipeline (VICTORY_THIN_PEEPHOLE=1 VICTORY_SUBMIT_STAGE_SPLIT=1 VICTORY_PARALLEL_REC=1 VICTORY_COALESCE_CUTS=1) over a 19m10s continuous gameplay run (victory-nvidia-play-20261201-105326-39804.log, 0 errors / 0 panics / 0 device-lost):

Load Bucket (Draws/Frame) Config FPS Frame / P95 (ms) preparing / card (ms) GPU Idle (ms) GPU Util (%) Stutter Notes
Light-Medium (4k–5.5k) Baseline (e1251c31, PC=0) 23.10 43.35 / 44.10 22.85 / 4.00 9.65 78.0% >100ms: 2/707
Full PR 3 Pipeline 23.80 42.00 / 42.90 22.20 / 1.80 7.70 82.0% >100ms: 0/752
Mid-Heavy (5.5k–7k) Baseline (e1251c31, PC=0) 21.40 46.80 / 49.30 25.00 / 4.30 9.30 81.0% >50ms: 32.7%
Full PR 3 Pipeline 21.40 46.75 / 48.50 22.60 / 1.90 7.70 84.0% >50ms: 5.4%
Heavy (7k–8.5k) Baseline (e1251c31, PC=0) 21.45 46.60 / 48.60 27.35 / 4.40 5.50 89.0% —
Full PR 3 Pipeline 21.75 45.90 / 47.55 25.50 / 2.00 3.85 91.5% Reaches 92–93% util at 8.5k+ draws

Optional isolated per-switch A/B runs (if maintainers want a single-stage breakdown on identical static camera saves):

Configuration Env Overrides Frame (ms) Preparing (ms) GPU Idle (ms) GPU Util (%)
Stage 0 only VICTORY_THIN_PEEPHOLE=1 Optional Optional Optional Optional
Stage 2/3 Split only VICTORY_SUBMIT_STAGE_SPLIT=1 Optional Optional Optional Optional
ParallelRec + CoalesceCuts VICTORY_PARALLEL_REC=1 VICTORY_COALESCE_CUTS=1 Optional Optional Optional Optional
**@⁠lyufeng000** on GitHub · 2026-12-01 11:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4855) `lyufeng000:pr/submit-pipeline` → `main` · +4667 −130 · 8 files · 1 commits · closed without merging ## Motivation On an RTX 4090 + Ryzen 9 9950X at 4K DLSS Quality (steady state on upstream `e1251c31`), actual GPU frame time is **27.7–29.0 ms**, yet the main submission thread spends **~24.9 ms/frame** synchronously preparing, recording, and submitting under `Host::submitted`. Because CPU preparation, D3D12 command-list recording for card copies, and queue submission share the same coarse submission lock, the GPU frequently starves for **~7.0 ms/frame** (~80% GPU utilization) waiting for the next batch of command lists. This PR ports an independent, strictly opt-in asynchronous submission pipeline onto upstream `e1251c31` with four composable stages—all **disabled by default**—so maintainers can merge with zero default-path risk and A/B benchmark each stage individually or together. --- ## Architecture ### 1. Stage 0: Zero-Allocation Thin-Stream Peephole Folding (`VICTORY_THIN_PEEPHOLE=1`) - Implemented in `crates/victory-gpu/src/list/thin.rs` (`PeepholeWindow`, `translate_peephole`). - Stack-allocated, single-pass window ahead of `list::thin` replay: - **Class A (scalar/pipeline state)**: folds consecutive writes and suppresses zero-diff redundant bindings (`PIPELINE`, `ROOT`, `TOPOLOGY`, `STENCIL_REF`, `BLEND_FACTOR`, `SAMPLE_MASK`, `VIEWPORTS`, `SCISSORS`, `INDEX_BUFFER`, `TARGETS`, `HEAPS`, `SHADING_RATE`), resetting committed history on `RESET` and `CLEAR_STATE`. `TARGETS` flushes any pending coalesced copy first to preserve copy-vs-target ordering. - **Class B (root slots & vertex buffers)**: dead-write elimination for identical `(kind, slot)` or vertex-buffer range overwrites before a flush boundary. - **Class C (barriers & contiguous copies)**: skips truly empty `BARRIER`/`BARRIER_GROUPS` (`w[0] == 0`) while strictly preserving upstream's bit-63 narrow `BARRIER_GROUPS` skip marker (`w[0] == 1 << 63` -> `state.synced()`), and merges adjacent `COPY_BUFFER`/`COPY_MEMORY` calls under four gates (same kind/buffers, contiguous offsets, `dst != src` non-aliasing including `buffer_base` overlap check, and capped byte budget). - Hard boundaries (draws, dispatches, clears, resolves, queries, waits, indirects, `EXTERNAL`, `UPLOAD`, `CLOSE`) flush all pending state in original order before replay, and abandoned recordings stop immediately before emitting actions. ### 2. Stage 2/3 Decoupled Submission (`VICTORY_SUBMIT_STAGE_SPLIT=1`) - Implemented in `crates/victory-gpu/src/host/pipeline.rs` (`Host::submit_pipelined`, `QueueOrder`, `AirScoreboard`, `PipelineStageBus`, `stage3_worker`) with minimal hooks in `host.rs` and `queue/behind.rs`. - **Lock decoupling & deferred `card_before` recording**: Stage 2 runs CPU preparation under a dedicated `parallel_rec::prep_lock()` without holding `Host::submitted`, while Stage 3 (`victory-stage3`) performs deferred `card_record_parallel` command-list recording outside **both** `Host::submitted` and `prep_lock` (offloading ~1.9–2.5 ms/frame off Stage 2), drains heap sync waits, issues `ExecuteCommandLists` + `Signal`, registers flights into `LINE`, and retires lists concurrently with Batch N+1's Stage 2 preparation. - **Two-phase `QueueOrder { assigned, queued }`**: - Stage 2 briefly increments `assigned` to tag `shadow::card_dirty(sent_as)` without holding `QUEUE_ORDER` across recording. - Stage 3 advances `queued = queued.max(sent_as)` strictly **after** `ExecuteCommandLists` and `Signal`. - `victory-relay` observes only `queued`, guaranteeing it never treats an unsubmitted Stage 2 batch as already queued. - **`AirScoreboard` zero-gap handoff**: - Tracks declared shader writes, texture read-backs, `card_steps::Taken::copied_ranges()`, and bottom-of-pipe writes for batches sitting in `PipelineStageBus` between Stage 2 and Stage 3. - Stage 3 registers `Late::Run` into `LINE` (calling `line.joined(...)` so `VICTORY_LAZY_NARROW=1` stays exact), releases `LINE`, and **then** calls `air_retire(token)`. - Readers (`late_blocked`, `late_met_known`, `late_met_by`, `land_before_remap`, and Stage 2 `air` assembly) snapshot `AirScoreboard` **first**, then lock `LINE`—eliminating observation gaps without ever nesting `AIR_SCOREBOARD` and `LINE`. - **Bounded FIFO `PipelineStageBus` (capacity 8)**: - Preserves strict submission order and interleaves `late_signal` (`Stage3Item::Signal` retaining `crate::fence::FenceRef`) directly into the FIFO when Stage 3 is active. - Takes precedence over `VICTORY_SUBMIT_SPLIT` (`split_send()` automatically yields when `stage_split_on()` is active). ### 3. Parallel `card_before` Recording (`VICTORY_PARALLEL_REC=1`) - Implemented in `crates/victory-gpu/src/host/parallel_rec.rs` (`EpochSlotRing`, `D3d12AllocatorPool`, `ParallelRecPool`, `Host::card_before_parallel`). - **Fence-epoch allocator pooling**: reclaims `(ID3D12CommandAllocator, ID3D12GraphicsCommandList)` slots only when `retired_fence <= completed_fence` and explicitly rejects `completed_fence == u64::MAX` (device lost). - **Zero-allocation, panic-safe worker pool**: lazily initialized only when a burst exceeds thresholds (`>= 64` hashed shadows or `>= 128` compared ranges); steady-state batches (~13 hashed shadows, ~18 compares) record inline in a single command list with zero worker wakeups. - Full parity with upstream `e1251c31` `card_record`: preserves `send::Own` (+ `own.copied()` synchronization for `VICTORY_SEND_BESIDE=1`), `upcheck`, `upq` (only when `!defer_sync`, safely skipped in Stage 2 outside `Host::submitted`), private CPU mirror `snapshot_private_ranges` fallback, pre-computed `lazy::hold_back` strictly ahead of `lazy::select`/`lazy::sweep`, `VICTORY_LAND_CAPTURE=1` (`bind_capture` + mode 6), `VICTORY_CARD_BATCH=1` (`CARD_COMPARE_BATCH` + pre-allocated disjoint `take_card_jobs` ranges), `scoped_uav_barriers`, `barstat::rb`, and `cardmeter`. ### 4. Full-Segment R/W State-Closure Coalescing (`VICTORY_COALESCE_CUTS=1`) - Implemented in `crates/victory-gpu/src/host/parallel_rec.rs` (`coalesce_execute_cuts`) with lightweight tracking on `HostList` (`has_unbounded_uav`, set on `Use::Builds` in `draw.rs`) and `Deferred` (`copy_source_shadows` / `copy_dest_shadows`, populated in `host/place.rs`). - Merges up to `MAX_COALESCED_PARTS = 2` adjacent non-conflicting `parts` into fewer `ExecuteCommandLists` calls only when scanning **every** list in $G \cup P$ satisfies: $$W(G) \cap (R_{\text{buf}}(P) \cup W(P)) = \emptyset \quad \land \quad R_{\text{buf}}(G) \cap W(P) = \emptyset$$ - Always preserves hard cuts on bottom-of-pipe writes (`deferred.writes`), `Step::Placed`, `Step::Run`, unbounded UAV shaders (`Use::Builds`), `card_steps` prefix segments (`own.is_some()`), and unscoped `picked.written` ranges. --- ## Opt-In Switches (All Default OFF) All switches use `crate::asked_for!` (`"1"` enables; unset / `"0"` disables). No `apps/victory/src/play.rs` defaults are changed. | Environment Variable | Default | Scope | Description | | --- | --- | --- | --- | | `VICTORY_THIN_PEEPHOLE` | `0` (off) | Stage 0 (`list/thin.rs`) | Stack-allocated zero-allocation peephole folding/merging during `thin` stream replay | | `VICTORY_SUBMIT_STAGE_SPLIT` | `0` (off) | Stage 2/3 (`host/pipeline.rs`) | Decouples Stage 2 CPU prep (`prep_lock`) from Stage 3 GPU submit (`Host::submitted`) via `QueueOrder`, `AirScoreboard`, and bounded FIFO `victory-stage3` | | `VICTORY_PARALLEL_REC` | `0` (off) | `card_before` (`host/parallel_rec.rs`) | Fence-epoch allocator ring + inline steady-state / multi-core burst recording for `card_before` sync/hash/check lists | | `VICTORY_COALESCE_CUTS` | `0` (off) | Submit cuts (`host/parallel_rec.rs`) | Full-segment R/W state-closure coalescing of up to 2 adjacent non-conflicting `ExecuteCommandLists` parts | When all four switches are unset, `list::thin::translate`, `Host::send_late`, `Host::submit`, `Host::card_before`, and `cuts` execute upstream `e1251c31`'s exact original paths without spawning any extra threads. --- ## Ordering, Streamline & Safety Invariants 1. **Streamline Commit-Window Red Line**: - `run.take_upscale()`, `run.deferred().framegen_camera` (when `streamline::fsr::ml_active()`), `streamline::submitted(id, camera)`, `run.take_hudless()`, and `streamline::hudless_submitted(id)` execute strictly inside Stage 3's `Host::submitted` window—never in Stage 2 and never across a `Present`. - `pipeline::flush_stage3()` runs before `show_planes` in `queue/behind.rs` (`Job::Present`), at the entry of `Host::present_placed` (covering `VICTORY_ASYNC_SUBMIT=0` as well), in `Lane::drain()`, in `settle_now()`, and in `Host::submit` / `Host::execute_unwaited`. 2. **`slot0` Standalone `COMMON` Decay Boundary**: - Whenever `send::Own` records copies/scatters into `pre_lists[0]` (`has_own_slot0 == true`), `submit_pre_lists` (`partition_pre_lists`) executes `pre_lists[0]` in its own standalone `ExecuteCommandLists` call (with `before_send` for `VICTORY_RESIDENT_LATER=1`) before any parallel hash lists or `runs`, guaranteeing unhashed buffers decay back to `COMMON`. 3. **Acyclic Lock Hierarchy**: - `Lane::state < prep_lock < PipelineStageBus (not_full / flush) < Host::submitted < QUEUE_ORDER < CARD_WORK < LINE`, with `AIR_SCOREBOARD` and `PipelineStageBus::state` as strict leaf locks. - `victory-stage3` calls `crate::queue::no_drain_here()` at startup, never acquires `prep_lock`, wraps its loop in `catch_unwind` -> `fail(...)`, and executes `card_steps::put_off`, `beside::send_fills`, `land()`, and `bury()` (`uav_pool::drain_retired_uavs`) cleanly. 4. **`host.rs` Size Gate**: - Core Stage 2/3 and parallel recording logic lives in `crates/victory-gpu/src/host/pipeline.rs` and `crates/victory-gpu/src/host/parallel_rec.rs`; `host.rs` grows by only ~4.7 KiB (~951.5 KiB total, well under the 1 MiB policy limit). --- ## Verification & Unit Tests ### Added Unit Tests (14 new tests, all passing under default and `--features diagnostics`) - **Stage 0 Peephole (`crates/victory-gpu/src/list/thin.rs`)**: - `peep_class_a_folds_and_suppresses_zero_diff_until_reset_or_clear_state` - `peep_class_b_dead_write_elimination_respects_slots_and_ranges` - `peep_class_c_skips_empty_barriers_preserves_narrow_skip_and_enforces_copy_four_gates` - `peep_hard_boundaries_flush_pending_and_abandoned_stops_before_action` - **ParallelRec & CoalesceCuts (`crates/victory-gpu/src/host/parallel_rec.rs`)**: - `epoch_slot_ring_reclaims_only_completed_fences_and_rejects_lost_device` - `parallel_rec_pool_executes_all_items_across_reuses` - `coalesce_never_crosses_hard_cuts_or_cap` - `coalesce_closure_checks_middle_lists_place_source_and_rw_hazards` - `card_before_fanout_thresholds_keep_steady_state_inline_and_fan_out_bursts` - **Stage 2/3 Decoupled Pipeline (`crates/victory-gpu/src/host/pipeline.rs`)**: - `queue_order_two_stage_keeps_assigned_ahead_of_queued_monotonically` - `air_scoreboard_tracks_overlapping_in_flight_writes_and_retires` - `air_scoreboard_line_handoff_has_no_observation_gap` - `stage_bus_preserves_fifo_order_interleaves_signals_and_flushes` - `slot0_partition_isolates_send_own_when_active` ### Gate Results (against base `e1251c31`, `rustc 1.98.1`) - `cargo clippy --workspace --all-targets --locked` & `--all-features`: **0 warnings** in all modified/added files. *(Pre-existing warnings on upstream `e1251c31` untouched: `victory-shader/src/emit/lower.rs:114`, `victory-gpu/src/shadow.rs:7197`, `victory-gpu/src/copystat.rs:1470`, `victory-gpu/src/host.rs:5106`, `victory-hle/src/modules/xmem.rs:1933`.)* - `cargo xtask policy`: **0 violations** in all modified/added files. *(Pre-existing upstream `e1251c31` notice in untouched `crates/victory-shader/src/native.rs`.)* - `cargo test`: All 14 new PR unit tests pass under both default and `--features diagnostics`; all touched/dependent crates (`victory`, `victory-core`, `victory-formats`, `victory-game`, `victory-hle`, `victory-loader`, `victory-pe`, `victory-pipeline`, 6/7 in `xtask`, and `1144` tests in `victory-gpu`) pass. *(Pre-existing upstream `e1251c31` failures untouched: `xtask::policy::tests::repository_passes_policy` on `crates/victory-shader/src/native.rs`, `list::thin::tests::bindings_record_no_work`, `shader_cache::tests::every_switch_of_the_translator_is_in_the_key`, `victory-shader::emit::bitcode::opt::tests::hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity`, and RTX 4090 fast-GPU round-0 timing on `card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end`.)* - `cargo build --release --locked -p victory`: builds cleanly. --- ## A/B Benchmark Results (RTX 4090 + 9950X, 4K DLSS Quality + FG 2x) Measured on the same 4K DLSS Quality + FG 2x configuration with `VICTORY_PLACED_COPIED=0`, comparing the matched upstream `e1251c31` baseline against **Full PR 3 Pipeline** (`VICTORY_THIN_PEEPHOLE=1 VICTORY_SUBMIT_STAGE_SPLIT=1 VICTORY_PARALLEL_REC=1 VICTORY_COALESCE_CUTS=1`) over a 19m10s continuous gameplay run (`victory-nvidia-play-20261201-105326-39804.log`, **0 errors / 0 panics / 0 device-lost**): | Load Bucket (Draws/Frame) | Config | FPS | Frame / P95 (ms) | `preparing` / `card` (ms) | GPU Idle (ms) | GPU Util (%) | Stutter Notes | | --- | --- | --- | --- | --- | --- | --- | --- | | **Light-Medium (`4k–5.5k`)** | Baseline (`e1251c31`, `PC=0`) | 23.10 | 43.35 / 44.10 | 22.85 / 4.00 | 9.65 | 78.0% | `>100ms`: 2/707 | | | **Full PR 3 Pipeline** | **23.80** | **42.00 / 42.90** | **22.20 / 1.80** | **7.70** | **82.0%** | `>100ms`: **0/752** | | **Mid-Heavy (`5.5k–7k`)** | Baseline (`e1251c31`, `PC=0`) | 21.40 | 46.80 / 49.30 | 25.00 / 4.30 | 9.30 | 81.0% | `>50ms`: 32.7% | | | **Full PR 3 Pipeline** | 21.40 | **46.75 / 48.50** | **22.60 / 1.90** | **7.70** | **84.0%** | `>50ms`: **5.4%** | | **Heavy (`7k–8.5k`)** | Baseline (`e1251c31`, `PC=0`) | 21.45 | 46.60 / 48.60 | 27.35 / 4.40 | 5.50 | 89.0% | — | | | **Full PR 3 Pipeline** | **21.75** | **45.90 / 47.55** | **25.50 / 2.00** | **3.85** | **91.5%** | Reaches **92–93%** util at `8.5k+` draws | Optional isolated per-switch A/B runs (if maintainers want a single-stage breakdown on identical static camera saves): | Configuration | Env Overrides | Frame (ms) | Preparing (ms) | GPU Idle (ms) | GPU Util (%) | | --- | --- | --- | --- | --- | --- | | **Stage 0 only** | `VICTORY_THIN_PEEPHOLE=1` | _Optional_ | _Optional_ | _Optional_ | _Optional_ | | **Stage 2/3 Split only** | `VICTORY_SUBMIT_STAGE_SPLIT=1` | _Optional_ | _Optional_ | _Optional_ | _Optional_ | | **ParallelRec + CoalesceCuts** | `VICTORY_PARALLEL_REC=1 VICTORY_COALESCE_CUTS=1` | _Optional_ | _Optional_ | _Optional_ | _Optional_ |
Introduce an independent, strictly opt-in asynchronous GPU submission pipeline
(all four switches disabled by default via `crate::asked_for!`, leaving the
upstream `e1251c31` submission and `list::thin` paths untouched when unset):

- Stage 0 zero-allocation `PeepholeWindow` in `crates/victory-gpu/src/list/thin.rs`
  (`VICTORY_THIN_PEEPHOLE=1`) to fold redundant state bindings, skip empty
  barriers while preserving upstream narrow-skip markers, and coalesce contiguous
  non-aliasing buffer/memory copies ahead of hard replay boundaries.
- Stage 2/3 decoupled submission in `crates/victory-gpu/src/host/pipeline.rs`
  (`VICTORY_SUBMIT_STAGE_SPLIT=1`) separating Stage 2 CPU preparation under
  `parallel_rec::prep_lock()` from Stage 3 `Host::submitted` execution via
  two-phase `QueueOrder { assigned, queued }`, `AirScoreboard` zero-gap handoff
  into `LINE`, bounded FIFO `PipelineStageBus` (capacity 8), deferred
  `card_record_parallel` recording in Stage 3 outside both `Host::submitted`
  and `prep_lock`, strict Streamline commit-window ordering before `Present`,
  and `slot0` standalone `COMMON` decay isolation.
- Parallel `card_before` command-list recording with a fence-epoch allocator ring
  (`VICTORY_PARALLEL_REC=1`) and full-segment R/W state-closure
  `ExecuteCommandLists` coalescing (`VICTORY_COALESCE_CUTS=1`, up to
  `MAX_COALESCED_PARTS = 2`) in `crates/victory-gpu/src/host/parallel_rec.rs`.
- 14 new unit tests covering Stage 0 peephole folding, two-phase `QueueOrder`,
  `AirScoreboard` zero-gap `LINE` handoff, `PipelineStageBus`, `slot0`
  partitioning, `EpochSlotRing`, `ParallelRecPool`, and cut coalescing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 11:48:08 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-12-01 11:50 UTC · original

Ran the three modules holding the 14 new tests and the full victory-gpu library suite at bc15e0a5 on an NVIDIA Blackwell desktop part with 16 GB of VRAM, with a control on main 5fabb46e in a separate target directory. All four switches of this PR are opt-in and were left unset.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own CARGO_TARGET_DIR, no local patches.

cargo test -q --locked -p victory-gpu --lib list::thin::tests -- --test-threads=1
10 passed; 0 failed; 0 ignored; 1165 filtered out      (exit 0)

cargo test -q --locked -p victory-gpu --lib host::parallel_rec::tests -- --test-threads=1
5 passed; 0 failed; 0 ignored; 1170 filtered out      (exit 0)

cargo test -q --locked -p victory-gpu --lib host::pipeline::tests -- --test-threads=1
5 passed; 0 failed; 0 ignored; 1170 filtered out      (exit 0)

cargo test -q --locked -p victory-gpu --lib -- --test-threads=4      (bc15e0a5)
1108 passed; 1 failed; 66 ignored; 0 filtered out      (exit 101)

same full lib on main 5fabb46e (own CARGO_TARGET_DIR)
1094 passed; 1 failed; 66 ignored; 0 filtered out      (exit 101)

The single failure is host::packed_present_tests::packed_float_single_planes_are_presented, at host.rs:17827 here and host.rs:17713 on main; it fails on this host with and without this head, so it is not introduced by the PR. The PR is based on e1251c31, while current main is 5fabb46e, so the raw pass counts are not directly comparable. No A/B gameplay was done, so the opt-in pipeline's effect on frame time or GPU starvation was not measured here.

Not tested: a title run with any of VICTORY_THIN_PEEPHOLE=1, VICTORY_SUBMIT_STAGE_SPLIT=1, VICTORY_PARALLEL_REC=1 or VICTORY_COALESCE_CUTS=1, the 19-minute RTX 4090 A/B of the description, clippy, the full workspace suite, Wine, AMD adapters, game data.

AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out both commits in detached worktrees, built them, ran the tests, wrote this report; neither worktree was modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-12-01 11:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4855#issuecomment-7310225615) Ran the three modules holding the 14 new tests and the full `victory-gpu` library suite at `bc15e0a5` on an NVIDIA Blackwell desktop part with 16 GB of VRAM, with a control on `main` `5fabb46e` in a separate target directory. All four switches of this PR are opt-in and were left unset. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own `CARGO_TARGET_DIR`, no local patches. ``` cargo test -q --locked -p victory-gpu --lib list::thin::tests -- --test-threads=1 10 passed; 0 failed; 0 ignored; 1165 filtered out (exit 0) cargo test -q --locked -p victory-gpu --lib host::parallel_rec::tests -- --test-threads=1 5 passed; 0 failed; 0 ignored; 1170 filtered out (exit 0) cargo test -q --locked -p victory-gpu --lib host::pipeline::tests -- --test-threads=1 5 passed; 0 failed; 0 ignored; 1170 filtered out (exit 0) cargo test -q --locked -p victory-gpu --lib -- --test-threads=4 (bc15e0a5) 1108 passed; 1 failed; 66 ignored; 0 filtered out (exit 101) same full lib on main 5fabb46e (own CARGO_TARGET_DIR) 1094 passed; 1 failed; 66 ignored; 0 filtered out (exit 101) ``` The single failure is `host::packed_present_tests::packed_float_single_planes_are_presented`, at `host.rs:17827` here and `host.rs:17713` on `main`; it fails on this host with and without this head, so it is not introduced by the PR. The PR is based on `e1251c31`, while current `main` is `5fabb46e`, so the raw pass counts are not directly comparable. No A/B gameplay was done, so the opt-in pipeline's effect on frame time or GPU starvation was not measured here. Not tested: a title run with any of `VICTORY_THIN_PEEPHOLE=1`, `VICTORY_SUBMIT_STAGE_SPLIT=1`, `VICTORY_PARALLEL_REC=1` or `VICTORY_COALESCE_CUTS=1`, the 19-minute RTX 4090 A/B of the description, clippy, the full workspace suite, Wine, AMD adapters, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out both commits in detached worktrees, built them, ran the tests, wrote this report; neither worktree was modified; no game data was used.
Author
Owner

@⁠tikD1337 on GitHub · 2026-12-01 12:18 UTC · original

Tested all four opt-in stages from this PR in paired --release A/B runs on origin/main (5fabb46e + PR head bc15e0a5), providing the isolated per-switch breakdown on a smaller core-count CPU:

Rig & setup: Ryzen 5 7600 (6C/12T) + RTX 4070 Ti SUPER 16 GB (Driver 621.1.0, ReBAR ON) + 32 GB RAM + Windows 11 26300, warm shader cache, VICTORY_SUBMIT_SPLIT=1, VICTORY_DLSS=1 (Quality), VICTORY_PORT_CONSTANTS=1 (upstream default; also tested =0), Series S console mode, 105 s steady 3D in-world runs at the same location (~5.5k–6.5k steady draws/frame).

  • Unit tests (default): list::thin::tests::peep_ 4/4 PASS, host::parallel_rec::tests 5/5 PASS, host::pipeline::tests 5/5 PASS.

Isolated & Combined Stage A/B Results

Configuration 3D FPS (>=200 lists) Frame ms card (GPU) GPU idle submit_prep ww / steps / refr Matched 5.5k–6.5k (FPS / hprep / hcp) Notes
Base (all 4 OFF, PC=1, n=46) 23.24 43.03 ms 38.8 ms 0.3 ms (99%) 35.6 ms 5.20 / 24.7 / 11.4 23.70 / 32.6 / 14.8 ms (n=9) Baseline on 5fabb46e
Stage 0 only (VICTORY_THIN_PEEPHOLE=1) (n=59) 27.00 37.04 ms 34.2 ms 0.2 ms (100%) 28.9 ms 4.40 / 19.0 / 8.9 27.40 / 25.2 / 11.6 ms (n=11) +3.76 FPS (+16.2%), cuts both CPU & GPU!
Stage 2/3 only (VICTORY_SUBMIT_STAGE_SPLIT=1) (n=64) 24.87 40.21 ms 34.7 ms 1.1 ms (97%) 35.4 ms 4.80 / 23.6 / 11.9 25.15 / 30.4 / 15.0 ms (n=12) +1.63 FPS vs Base
THIN_PEEPHOLE=1 + SUBMIT_STAGE_SPLIT=1 (n=67) 26.62 37.57 ms 34.8 ms 0.2 ms (100%) 30.5 ms 4.10 / 18.8 / 9.2 27.35 / 26.1 / 11.6 ms (n=12) Virtually tied with Stage 0 solo
Full (all 4 ON, PC=1) (n=65) 24.75 40.40 ms 35.5 ms 1.2 ms (97%) 35.5 ms 4.50 / 22.1 / 10.8 25.40 / 29.1 / 13.3 ms (n=11) PARALLEL_REC + COALESCE_CUTS regresses on 6C/12T vs Stage 0
Full (all 4 ON, PORT_CONSTANTS=0) (n=64) 24.66 40.55 ms 20.6 ms 9.6 ms (76%) 38.8 ms 4.10 / 25.2 / 15.6 24.90 / 32.5 / 18.9 ms (n=12) CPU copies jump (~72 MB/f vs ~37 MB/f), starving GPU

Key Takeaways

  1. VICTORY_THIN_PEEPHOLE=1 alone is a massive win (0 extra threads): on Ryzen 5 7600 + RTX 4070 Ti SUPER it lifted steady 3D FPS from 23.24 -> 27.00 FPS (+16.2%), cutting submit_prep by -6.7 ms (35.6 -> 28.9 ms), 5s host_prep by -7.4 ms (32.6 -> 25.2 ms), and even GPU card time by -4.6 ms (38.8 -> 34.2 ms) — with 0 crashes or errors across all 6 runs. Worth considering splitting Stage 0 out or keeping it independently mergeable!
  2. VICTORY_SUBMIT_STAGE_SPLIT=1 improves over Base alone (23.24 -> 24.87 FPS) and tracks Stage 0 solo when paired with THIN_PEEPHOLE=1 (27.35 vs 27.40 FPS on matched 5.5k–6.5k draws, slightly higher prep 30.5 vs 28.9 ms).
  3. VICTORY_PARALLEL_REC=1 + VICTORY_COALESCE_CUTS=1 hurt on 6C/12T: adding them on top of THIN_PEEPHOLE + SUBMIT_STAGE_SPLIT added +5.0 ms to submit_prep (30.5 -> 35.5 ms) and dropped FPS back to 24.75 FPS (unlike 16C/32T 9950X where extra worker cores are free).
  4. Note on CI: the current red clippy failure on this PR run is only from origin/main's recently merged host/menu.rs and host/panel.rs, not from PR #4855 files.
**@⁠tikD1337** on GitHub · 2026-12-01 12:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4855#issuecomment-7310942785) Tested all four opt-in stages from this PR in paired `--release` A/B runs on **`origin/main` (`5fabb46e` + PR head `bc15e0a5`)**, providing the isolated per-switch breakdown on a smaller core-count CPU: **Rig & setup:** Ryzen 5 7600 (6C/12T) + RTX 4070 Ti SUPER 16 GB (Driver `621.1.0`, ReBAR ON) + 32 GB RAM + Windows 11 `26300`, warm shader cache, `VICTORY_SUBMIT_SPLIT=1`, `VICTORY_DLSS=1` (Quality), `VICTORY_PORT_CONSTANTS=1` (upstream default; also tested `=0`), Series S console mode, 105 s steady 3D in-world runs at the same location (`~5.5k–6.5k` steady draws/frame). - **Unit tests (default):** `list::thin::tests::peep_` **4/4 PASS**, `host::parallel_rec::tests` **5/5 PASS**, `host::pipeline::tests` **5/5 PASS**. ### Isolated & Combined Stage A/B Results | Configuration | 3D FPS (`>=200` lists) | Frame ms | `card` (GPU) | GPU idle | `submit_prep` | `ww` / `steps` / `refr` | Matched `5.5k–6.5k` (`FPS` / `hprep` / `hcp`) | Notes | |---|---:|---:|---:|---:|---:|---:|---:|---| | **Base** (all 4 OFF, `PC=1`, `n=46`) | 23.24 | 43.03 ms | 38.8 ms | 0.3 ms (99%) | 35.6 ms | 5.20 / 24.7 / 11.4 | 23.70 / 32.6 / 14.8 ms (`n=9`) | Baseline on `5fabb46e` | | **Stage 0 only (`VICTORY_THIN_PEEPHOLE=1`)** (`n=59`) | **27.00** | **37.04 ms** | **34.2 ms** | 0.2 ms (100%) | **28.9 ms** | 4.40 / **19.0** / **8.9** | **27.40** / **25.2** / **11.6 ms** (`n=11`) | **+3.76 FPS (+16.2%)**, cuts both CPU & GPU! | | **Stage 2/3 only (`VICTORY_SUBMIT_STAGE_SPLIT=1`)** (`n=64`) | 24.87 | 40.21 ms | 34.7 ms | 1.1 ms (97%) | 35.4 ms | 4.80 / 23.6 / 11.9 | 25.15 / 30.4 / 15.0 ms (`n=12`) | +1.63 FPS vs Base | | **`THIN_PEEPHOLE=1` + `SUBMIT_STAGE_SPLIT=1`** (`n=67`) | 26.62 | 37.57 ms | 34.8 ms | 0.2 ms (100%) | 30.5 ms | **4.10** / **18.8** / 9.2 | **27.35** / 26.1 / **11.6 ms** (`n=12`) | Virtually tied with Stage 0 solo | | **Full (all 4 ON, `PC=1`)** (`n=65`) | 24.75 | 40.40 ms | 35.5 ms | 1.2 ms (97%) | 35.5 ms | 4.50 / 22.1 / 10.8 | 25.40 / 29.1 / 13.3 ms (`n=11`) | `PARALLEL_REC` + `COALESCE_CUTS` regresses on 6C/12T vs Stage 0 | | **Full (all 4 ON, `PORT_CONSTANTS=0`)** (`n=64`) | 24.66 | 40.55 ms | **20.6 ms** | 9.6 ms (76%) | 38.8 ms | 4.10 / 25.2 / 15.6 | 24.90 / 32.5 / 18.9 ms (`n=12`) | CPU copies jump (`~72 MB/f` vs `~37 MB/f`), starving GPU | ### Key Takeaways 1. **`VICTORY_THIN_PEEPHOLE=1` alone is a massive win (0 extra threads):** on Ryzen 5 7600 + RTX 4070 Ti SUPER it lifted steady 3D FPS from **`23.24 -> 27.00 FPS` (`+16.2%`)**, cutting `submit_prep` by **`-6.7 ms` (`35.6 -> 28.9 ms`)**, 5s `host_prep` by **`-7.4 ms` (`32.6 -> 25.2 ms`)**, and even GPU `card` time by **`-4.6 ms` (`38.8 -> 34.2 ms`)** — with 0 crashes or errors across all 6 runs. Worth considering splitting Stage 0 out or keeping it independently mergeable! 2. **`VICTORY_SUBMIT_STAGE_SPLIT=1`** improves over Base alone (`23.24 -> 24.87 FPS`) and tracks Stage 0 solo when paired with `THIN_PEEPHOLE=1` (`27.35` vs `27.40 FPS` on matched `5.5k–6.5k` draws, slightly higher `prep` `30.5` vs `28.9 ms`). 3. **`VICTORY_PARALLEL_REC=1` + `VICTORY_COALESCE_CUTS=1` hurt on 6C/12T:** adding them on top of `THIN_PEEPHOLE + SUBMIT_STAGE_SPLIT` added **`+5.0 ms` to `submit_prep` (`30.5 -> 35.5 ms`)** and dropped FPS back to **`24.75 FPS`** (unlike 16C/32T `9950X` where extra worker cores are free). 4. Note on CI: the current red `clippy` failure on this PR run is only from `origin/main`'s recently merged `host/menu.rs` and `host/panel.rs`, not from PR `#4855` files.
Author
Owner

@⁠tikD1337 on GitHub · 2026-12-01 12:33 UTC · original

Quick follow-up on the PORT_CONSTANTS=0 observation above:

In pr4855-full-noport, setting VICTORY_PORT_CONSTANTS=0 dropped GPU card time to 20.6 ms, but CPU preparing climbed to 38.8 ms (~72 MB/f copies) and starved the GPU.

Testing a combined --release build on 5fabb46e with VICTORY_THIN_PEEPHOLE=1 stacked together with @POMXARK's 01 GUARD_SHARDED=1 + 03 LOW_L0_DMA=1 + 04 DESC_MIRROR_CAP=1, SOFT_BATCH=1 and #4527 (VICTORY_WC_BAR=3) under VICTORY_PORT_CONSTANTS=0 resolves that CPU copy overhead cleanly (Ryzen 5 7600 + RTX 4070 Ti SUPER, 105 s steady 3D runs, 0 crashes):

Config 3D FPS (>=200 lists) Frame ms card (GPU) GPU idle submit_prep 5.5k–6.5k ~10.9k heavy window
THIN_PEEPHOLE=1 solo (PC=1) 27.00 37.04 ms 34.2 ms 0.2 ms (100%) 28.9 ms 27.40 FPS 16.3 FPS
THIN_PEEPHOLE=1 + LOW_L0_DMA stack (PC=0) 27.52 36.34 ms 21.1 ms 9.1 ms (75%) 32.9 ms 27.90 FPS (peaks 28.8) 21.7 FPS
Same + SUBMIT_STAGE_SPLIT=1 (PC=0) 27.04 36.98 ms 21.1 ms 6.0 ms (84%) 35.5 ms 27.30 FPS 21.7 FPS

VICTORY_THIN_PEEPHOLE=1 composes super cleanly with LOW_L0_DMA=1 (L0_DMA 7.4 MB/f, WW_low 4.74 ms, card_cp 0.7 ms), holding 21.7 FPS even on ~10.9k-draw windows and leaving ~9.1 ms GPU idle headroom for faster CPUs!

**@⁠tikD1337** on GitHub · 2026-12-01 12:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4855#issuecomment-7311295130) Quick follow-up on the `PORT_CONSTANTS=0` observation above: In `pr4855-full-noport`, setting `VICTORY_PORT_CONSTANTS=0` dropped GPU `card` time to **`20.6 ms`**, but CPU `preparing` climbed to `38.8 ms` (`~72 MB/f` copies) and starved the GPU. Testing a combined `--release` build on `5fabb46e` with **`VICTORY_THIN_PEEPHOLE=1`** stacked together with `@POMXARK`'s `01 GUARD_SHARDED=1` + `03 LOW_L0_DMA=1` + `04 DESC_MIRROR_CAP=1, SOFT_BATCH=1` and `#4527` (`VICTORY_WC_BAR=3`) under **`VICTORY_PORT_CONSTANTS=0`** resolves that CPU copy overhead cleanly (Ryzen 5 7600 + RTX 4070 Ti SUPER, 105 s steady 3D runs, 0 crashes): | Config | 3D FPS (`>=200` lists) | Frame ms | `card` (GPU) | GPU idle | `submit_prep` | `5.5k–6.5k` | `~10.9k` heavy window | |---|---:|---:|---:|---:|---:|---:|---:| | **`THIN_PEEPHOLE=1` solo (`PC=1`)** | 27.00 | 37.04 ms | 34.2 ms | 0.2 ms (100%) | **28.9 ms** | 27.40 FPS | 16.3 FPS | | **`THIN_PEEPHOLE=1` + `LOW_L0_DMA` stack (`PC=0`)** | **27.52** | **36.34 ms** | **21.1 ms** | **9.1 ms (75%)** | 32.9 ms | **27.90 FPS** (peaks **28.8**) | **21.7 FPS** | | **Same + `SUBMIT_STAGE_SPLIT=1` (`PC=0`)** | 27.04 | 36.98 ms | **21.1 ms** | 6.0 ms (84%) | 35.5 ms | 27.30 FPS | **21.7 FPS** | `VICTORY_THIN_PEEPHOLE=1` composes super cleanly with `LOW_L0_DMA=1` (`L0_DMA 7.4 MB/f`, `WW_low 4.74 ms`, `card_cp 0.7 ms`), holding **`21.7 FPS`** even on `~10.9k`-draw windows and leaving `~9.1 ms` GPU idle headroom for faster CPUs!
Author
Owner

@⁠lyufeng000 on GitHub · 2026-12-01 12:47 UTC · original

Hi @⁠tikD1337,

Thank you so much for the thorough A/B benchmarks, the follow-up test with LOW_L0_DMA, and the great suggestion!

I've split Stage 0 (VICTORY_THIN_PEEPHOLE=1) out into a standalone PR (#4886) touching only crates/victory-gpu/src/list/thin.rs, so it can be reviewed and merged independently.

**@⁠lyufeng000** on GitHub · 2026-12-01 12:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4855#issuecomment-7311655898) Hi @⁠tikD1337, Thank you so much for the thorough A/B benchmarks, the follow-up test with `LOW_L0_DMA`, and the great suggestion! I've split Stage 0 (`VICTORY_THIN_PEEPHOLE=1`) out into a standalone PR (#4886) touching only `crates/victory-gpu/src/list/thin.rs`, so it can be reviewed and merged independently.
github-bot closed this pull request 2026-12-01 18:36:23 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:30 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4855#issuecomment-7321059744) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4856
No description provided.