queue, host: exclude skipped PageRange runs in land_before_remap #3277

Manually merged
github merged 1 commit from github-bot/gh-3277 into gh-pr/3277/base 2026-11-30 14:16:42 +00:00 AGit
Owner

@⁠Maverick0351a on GitHub · 2026-11-29 21:15 UTC · original
Maverick0351a:fix/copy-page-mappings-skip-ranges → main · +46 −4 · 2 files · 1 commits · merged 2026-11-30 14:12 UTC

Problem

In copy_page_mappings (crates/victory-gpu/src/queue.rs:1723-1731), each PageBatch starts at b.destination and contains PageRange entries where r.kind == 3 means left as they are (D3D12_TILE_RANGE_FLAG_SKIP, which simply advances at += len without changing page mappings).

Previously:

  1. copy_page_mappings summed u64::from(r.count) * PAGE across all ranges in the batch (including r.kind == 3 skip ranges) and called crate::host::land_before_remap(b.destination, len) over the entire span from b.destination. When the title skipped across a tiled heap from b.destination to remap a single streamed texture tile, [b.destination, b.destination + len) spanned the entire skipped prefix of the heap and falsely overlapped unrelated UAVs in line.written.
  2. In land_before_remap (crates/victory-gpu/src/host.rs:5533 and 5543), pending checked line.settling || touches(&line.written, from, to). Because relay_land keeps the write ranges of flights currently being landed inside line.written until relay_land finishes and clears written and settling under the same lock (host.rs:8101), touches(&line.written, from, to) already covers flights currently being landed. Checking line.settling || caused land_before_remap to block whenever the relay thread was landing any flight (~29 ms/frame) even when touches(&line.written, from, to) was false.

In dense streaming scenes (such as the Leonida Keys mangrove channel and island compound at 6,444-8,073 draws/frame), this caused 0.8-1.1 synchronous GPU pipeline drains per frame costing 11.3-12.4 ms/frame (settled for: a synchronous submission or present 1.2 (pages remapped under flights' writes 1.1)).

Fix

  1. Extract remapped_spans(destination, ranges) in crates/victory-gpu/src/queue.rs to coalesce adjacent r.kind <= 2 ranges and skip r.kind == 3 untouched ranges before calling land_before_remap.
  2. Check touches(&line.written, from, to) directly in land_before_remap (crates/victory-gpu/src/host.rs:5533, 5543).

Verification

  • Added unit test remapped_spans_skips_untouched_ranges_and_joins_adjacent_ones in crates/victory-gpu/src/queue.rs.
  • Verified in live gameplay across the dense island scene (4,229-8,073 draws/frame): settled for: a synchronous submission or present (pages remapped under flights' writes) dropped from 11.3-12.4 ms/frame (0.8-1.1 settles/frame) to 0.0 ms/frame (0.0 settles/frame).
**@⁠Maverick0351a** on GitHub · 2026-11-29 21:15 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3277) `Maverick0351a:fix/copy-page-mappings-skip-ranges` → `main` · +46 −4 · 2 files · 1 commits · merged 2026-11-30 14:12 UTC ## Problem In `copy_page_mappings` (`crates/victory-gpu/src/queue.rs:1723-1731`), each `PageBatch` starts at `b.destination` and contains `PageRange` entries where `r.kind == 3` means `left as they are` (`D3D12_TILE_RANGE_FLAG_SKIP`, which simply advances `at += len` without changing page mappings). Previously: 1. `copy_page_mappings` summed `u64::from(r.count) * PAGE` across **all** ranges in the batch (including `r.kind == 3` skip ranges) and called `crate::host::land_before_remap(b.destination, len)` over the entire span from `b.destination`. When the title skipped across a tiled heap from `b.destination` to remap a single streamed texture tile, `[b.destination, b.destination + len)` spanned the entire skipped prefix of the heap and falsely overlapped unrelated UAVs in `line.written`. 2. In `land_before_remap` (`crates/victory-gpu/src/host.rs:5533` and `5543`), `pending` checked `line.settling || touches(&line.written, from, to)`. Because `relay_land` keeps the write ranges of flights currently being landed inside `line.written` until `relay_land` finishes and clears `written` and `settling` under the same lock (`host.rs:8101`), `touches(&line.written, from, to)` already covers flights currently being landed. Checking `line.settling ||` caused `land_before_remap` to block whenever the relay thread was landing any flight (~29 ms/frame) even when `touches(&line.written, from, to)` was `false`. In dense streaming scenes (such as the Leonida Keys mangrove channel and island compound at 6,444-8,073 draws/frame), this caused **0.8-1.1 synchronous GPU pipeline drains per frame costing 11.3-12.4 ms/frame** (`settled for: a synchronous submission or present 1.2 (pages remapped under flights' writes 1.1)`). ## Fix 1. Extract `remapped_spans(destination, ranges)` in `crates/victory-gpu/src/queue.rs` to coalesce adjacent `r.kind <= 2` ranges and skip `r.kind == 3` untouched ranges before calling `land_before_remap`. 2. Check `touches(&line.written, from, to)` directly in `land_before_remap` (`crates/victory-gpu/src/host.rs:5533, 5543`). ## Verification - Added unit test `remapped_spans_skips_untouched_ranges_and_joins_adjacent_ones` in `crates/victory-gpu/src/queue.rs`. - Verified in live gameplay across the dense island scene (4,229-8,073 draws/frame): `settled for: a synchronous submission or present` (`pages remapped under flights' writes`) dropped from **11.3-12.4 ms/frame (0.8-1.1 settles/frame)** to **0.0 ms/frame (0.0 settles/frame)**.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 21:16:24 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-29 23:08 UTC · original

Independent local verification (Windows, Rust 1.100.0/MSVC, synthetic inputs only, no game data):

  • PR #3277 at head d34d2dee5e670f28a8019d793892bd543bbb17c3, base/parent f72cec7714aa6d6e274b761fb6fa40bfcf44243b.
  • cargo test --locked -p victory-gpu --lib -- queue::tests::remapped_spans_skips_untouched_ranges_and_joins_adjacent_ones --exact --test-threads=1 --quiet → 1 passed, 0 failed, 975 filtered, exit 0 (pre-existing warnings in the victory-gpu lib test build).
  • git grep -F for the test name on the base returned no match (test is new on this PR); git diff --check f72cec7 HEAD clean (2 files, +46/-4).
  • Used a per-worktree CARGO_TARGET_DIR (never shared) with CARGO_BUILD_JOBS=2.
  • Only the named synthetic test was replayed; full workspace suite and clippy were not run locally.
  • GPU/driver: N/A (CPU-only queue range test). No game data, assets, extracted shaders, DRM or decrypt involved.

AI-assisted (Hy4 flash).

**@⁠cloph-dsp** on GitHub · 2026-11-29 23:08 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3277#issuecomment-7264230523) Independent local verification (Windows, Rust 1.100.0/MSVC, synthetic inputs only, no game data): - PR #3277 at head `d34d2dee5e670f28a8019d793892bd543bbb17c3`, base/parent `f72cec7714aa6d6e274b761fb6fa40bfcf44243b`. - `cargo test --locked -p victory-gpu --lib -- queue::tests::remapped_spans_skips_untouched_ranges_and_joins_adjacent_ones --exact --test-threads=1 --quiet` → 1 passed, 0 failed, 975 filtered, exit 0 (pre-existing warnings in the victory-gpu lib test build). - `git grep -F` for the test name on the base returned no match (test is new on this PR); `git diff --check f72cec7 HEAD` clean (2 files, +46/-4). - Used a per-worktree `CARGO_TARGET_DIR` (never shared) with `CARGO_BUILD_JOBS=2`. - Only the named synthetic test was replayed; full workspace suite and clippy were not run locally. - GPU/driver: N/A (CPU-only queue range test). No game data, assets, extracted shaders, DRM or decrypt involved. AI-assisted (Hy4 flash).
github-bot changed target branch from main to gh-pr/3277/base 2026-11-30 14:16:29 +00:00
github manually merged commit d34d2dee5e into gh-pr/3277/base 2026-11-30 14:16:33 +00:00
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!3277
No description provided.