GPU: a wider loose window covers a later smaller ask #2856

Open
github-bot wants to merge 2 commits from github-bot/gh-2856 into main AGit
Owner

@⁠Luislariosss on GitHub · 2026-11-25 22:27 UTC · original
Luislariosss:gpu/loose-window-reuse → main · +117 −0 · 2 files · 2 commits · open

Why

Title memory outside buffer objects gets host copies of the aligned windows it touches (shadow::loose). These windows are the shared segment's own content on a machine whose system RAM is half the card's: one measured run held 878 of them totalling 3,926 MB, and the non-local segment (budget: half of system RAM) was pinned at its budget in every long run. At that ceiling the run dies two ways: a host command list's Close() returns E_OUTOFMEMORY, or a staging allocation the runtime could not make feeds the title a value it dereferences (its own missing check; our failure is the trigger either way).

The windows were keyed to their exact (start, length): a memory range a wider window already spanned made its own host buffer and its own copy anyway.

What

A miss now takes the first window that covers it (start at or before ours, end at or past ours, nearest start first). The reuses are counted and printed with the periodic lines, and the windows themselves are too (count and bytes; they are never freed by design, so what they reach is what the segment carries).

Measured

One hardware run (AMD, RDNA4, 15.2 GB system RAM, diagnostics build, 5+ minutes to the world):

  • 120,323 asks were covered by a wider window; each would have allocated its own host buffer.
  • The map held 878 windows / 3,926 MB at the run's peak.
  • In-world frame rate averaged 0.48 fps with a 1.5 peak, against 0.22-0.26 in the immediately preceding runs without the reuse (same build otherwise, same world entry point).
  • No host failures changed in this run: the ceiling is still the ceiling, and the windows still total what they total; this stops the growth, not the standing content.

Verification

  • cargo clippy --workspace --all-targets --locked -- -D warnings and the --all-features variant: clean.
  • cargo test --workspace --locked: green.
  • A hardware-gated test pins the covering reuse (a narrower ask returns the same window and counts one reuse; an ask past the covering window still gets its own). It skips on a machine without a GPU.

No shader bytes, hashes, or program names from any title (asset policy).

**@⁠Luislariosss** on GitHub · 2026-11-25 22:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856) `Luislariosss:gpu/loose-window-reuse` → `main` · +117 −0 · 2 files · 2 commits · open ### Why Title memory outside buffer objects gets host copies of the aligned windows it touches (`shadow::loose`). These windows are the shared segment's own content on a machine whose system RAM is half the card's: one measured run held 878 of them totalling 3,926 MB, and the non-local segment (budget: half of system RAM) was pinned at its budget in every long run. At that ceiling the run dies two ways: a host command list's Close() returns E_OUTOFMEMORY, or a staging allocation the runtime could not make feeds the title a value it dereferences (its own missing check; our failure is the trigger either way). The windows were keyed to their exact (start, length): a memory range a wider window already spanned made its own host buffer and its own copy anyway. ### What A miss now takes the first window that covers it (start at or before ours, end at or past ours, nearest start first). The reuses are counted and printed with the periodic lines, and the windows themselves are too (count and bytes; they are never freed by design, so what they reach is what the segment carries). ### Measured One hardware run (AMD, RDNA4, 15.2 GB system RAM, diagnostics build, 5+ minutes to the world): - 120,323 asks were covered by a wider window; each would have allocated its own host buffer. - The map held 878 windows / 3,926 MB at the run's peak. - In-world frame rate averaged 0.48 fps with a 1.5 peak, against 0.22-0.26 in the immediately preceding runs without the reuse (same build otherwise, same world entry point). - No host failures changed in this run: the ceiling is still the ceiling, and the windows still total what they total; this stops the growth, not the standing content. ### Verification - `cargo clippy --workspace --all-targets --locked -- -D warnings` and the `--all-features` variant: clean. - `cargo test --workspace --locked`: green. - A hardware-gated test pins the covering reuse (a narrower ask returns the same window and counts one reuse; an ask past the covering window still gets its own). It skips on a machine without a GPU. No shader bytes, hashes, or program names from any title (asset policy).
Loose windows were keyed to their exact (start, length): a memory range a wider window already spanned made its own host buffer and its own copy anyway, although one measured run saw most asks covered by a wider neighbour (36,611 reuses, 153 GB not copied). A miss now takes the first window that covers it - the shared segment these buffers fill is the one that dies (measured: its budget hit 103-104% while the card's own stayed at 50%, and the run ended in a Close() failure the old message mislabeled as an invalid command). A reuse is counted and printed with the periodic lines; a hardware-gated test pins the covering reuse and the ask past the window.
The loose windows are the shared segment's own content and are never freed; a run could not see how many there were or what they weighed. Their count and bytes join the reuse count in the periodic lines, so the next lever (freeing or merging them) starts from a measured size.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:16:02 +00:00
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 23:00 UTC · original

Reviewed and tested 24e65566 on Windows 11 (RTX 5090 + WARP) against main (842b0cb):

Verification

  • cargo xtask policy (190 files ok), cargo clippy --locked -p victory-gpu --all-targets (default & --features diagnostics, 0 warnings).
  • shadow::tests 10/10 (including a_wider_loose_window_covers_a_later_smaller_ask) and draw::tests 20/20 passed on both RTX 5090 and WARP.

Three edge cases / concerns to address

  1. Non-power-of-two structured view alignment regression (shadow.rs:1479): loose() aligns start to WINDOW = 4 MiB (4,194,304, which is not a multiple of 3). For a structured buffer with stride 12/24/48 bytes aligned to its own 4 MiB window (offset == 0), reusing an earlier wider window shifted by 4 MiB makes shadow.offset(address) % 12 == 4 != 0, forcing for_view to fall back to exact() and allocate a separate copy anyway.
  2. Coupled dirty/tracking granularity & scan: reusing a huge (e.g. 512 MiB) loose window for a hot 4 MiB sub-range couples Shadow::clean() and MARKS tracking across the entire wide window; on misses, .range(..(start, u64::MAX)).rev().find(...) linearly scans all earlier entries.
  3. Overflow & feature-gating nits: at + *l >= start + len (shadow.rs:1094) should use saturating_add, and the "loose windows: ..." counters/logging in host.rs:3080-3090 and shadow.rs:1066 are under plain #[cfg(windows)] instead of #[cfg(feature = "diagnostics")].
**@⁠fuzeofficlal** on GitHub · 2026-11-25 23:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856#issuecomment-7177041347) Reviewed and tested `24e65566` on Windows 11 (RTX 5090 + WARP) against `main` (`842b0cb`): ### Verification - `cargo xtask policy` (`190 files ok`), `cargo clippy --locked -p victory-gpu --all-targets` (default & `--features diagnostics`, 0 warnings). - `shadow::tests` 10/10 (including `a_wider_loose_window_covers_a_later_smaller_ask`) and `draw::tests` 20/20 passed on both RTX 5090 and WARP. ### Three edge cases / concerns to address 1. **Non-power-of-two structured view alignment regression (`shadow.rs:1479`)**: `loose()` aligns `start` to `WINDOW = 4 MiB` (`4,194,304`, which is not a multiple of 3). For a structured buffer with stride `12`/`24`/`48` bytes aligned to its own `4 MiB` window (`offset == 0`), reusing an earlier wider window shifted by `4 MiB` makes `shadow.offset(address) % 12 == 4 != 0`, forcing `for_view` to fall back to `exact()` and allocate a separate copy anyway. 2. **Coupled dirty/tracking granularity & scan**: reusing a huge (e.g. `512 MiB`) loose window for a hot `4 MiB` sub-range couples `Shadow::clean()` and `MARKS` tracking across the entire wide window; on misses, `.range(..(start, u64::MAX)).rev().find(...)` linearly scans all earlier entries. 3. **Overflow & feature-gating nits**: `at + *l >= start + len` (`shadow.rs:1094`) should use `saturating_add`, and the `"loose windows: ..."` counters/logging in `host.rs:3080-3090` and `shadow.rs:1066` are under plain `#[cfg(windows)]` instead of `#[cfg(feature = "diagnostics")]`.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 03:26 UTC · original

Automated triage for the maintainers.

Verdict: merge candidate. crates/victory-gpu/src/shadow.rs loose: on a miss for the exact (start, len) window, it now looks for an existing window that starts at or before start and reaches past start + len, and returns that copy instead of allocating another host buffer for memory already copied. host.rs Meter::frame adds the window count, bytes and reuses to the 5-second line.

Checked: callers only use the returned Shadow through offset(address), so a copy that starts earlier serves the same bytes. One copy of a range instead of several overlapping ones also can't make GPU writes less consistent. On the structured-view concern raised above: when the offset into the wider copy isn't element-aligned, for_view already falls back to exact, so that case costs a copy but stays correct. The measured effect (120k covered asks in one run) is one run, but the change is a straightforward reduction in duplicate copies.

CI: failing, in descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait. This PR doesn't touch that code, and other PRs report it flaking on main too. A re-run should clear it.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 03:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856#issuecomment-7181716539) <!-- victory-triage v1 head=24e65566c11ae5b4e53e47d4341a1c5ca7a9a0b1 verdict=merge-candidate at=2026-11-26T03:26:07Z --> Automated triage for the maintainers. **Verdict: merge candidate.** `crates/victory-gpu/src/shadow.rs` `loose`: on a miss for the exact `(start, len)` window, it now looks for an existing window that starts at or before `start` and reaches past `start + len`, and returns that copy instead of allocating another host buffer for memory already copied. `host.rs` `Meter::frame` adds the window count, bytes and reuses to the 5-second line. Checked: callers only use the returned `Shadow` through `offset(address)`, so a copy that starts earlier serves the same bytes. One copy of a range instead of several overlapping ones also can't make GPU writes less consistent. On the structured-view concern raised above: when the offset into the wider copy isn't element-aligned, `for_view` already falls back to `exact`, so that case costs a copy but stays correct. The measured effect (120k covered asks in one run) is one run, but the change is a straightforward reduction in duplicate copies. CI: failing, in `descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait`. This PR doesn't touch that code, and other PRs report it flaking on `main` too. A re-run should clear it. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 04:16 UTC · original

Independent Wine/NVIDIA fixture verification: 1/1 PASS, actual RTX 4060 Laptop GPU 8 GiB, driver 590.48.01, 16 GiB system RAM, Wine 11.0 / vkd3d-proton 3.2.0; DXVK_CONFIG='dxgi.hideNvidiaGpu = False'. Windows-MSVC test build, Rust 1.98.1, one test process/thread in a 9 GiB / 512 MiB-swap scope.

Runtime source is exact head 24e65566c1; local test-only strengthening disclosed: replaced all three optional host-buffer lookups (wide/narrow/beyond) with expect, rather than allowing this run to pass by skipping assertions. No production changes. a_wider_loose_window_covers_a_later_smaller_ask verified Arc identity for the narrower covered request, a distinct backing for the beyond-range request, and the isolated reuse-counter delta. Output: verified all three host lookups; covered backing 8388608 bytes, noncovered 8388608 bytes. Physical NVIDIA adapter explicitly enumerated. This is buffer creation/reuse correctness, not a GPU shader dispatch or gameplay test.

Command: cargo test --locked --target x86_64-pc-windows-msvc -p victory-gpu --lib a_wider_loose_window_covers_a_later_smaller_ask -- --nocapture --test-threads=1 via local Wine runner. Fresh compilation from this checkout confirmed; log verify-pr2856-wine-rtx4060-strict-window.log.

Why this matters on this host: a separate, instrumented main 63bcca4 load without this PR measured loose-window backing 256 -> 2,012 MiB before the unchanged free-RAM guard stopped loading; texture staging stayed at 32 MiB. Full owner measurements and caveats: #3012 . That makes this PR relevant, but I have not measured its reduction in that title run, nor does the fixture show bounded growth/reclamation of retained windows.

Suggested fixture improvement remains the one earlier reviewers identified: require narrow/beyond lookups after successful hardware creation so allocation failures cannot skip the consumer-visible assertions; keep global counter checks isolated from unrelated tests. No objection from this isolated laptop/Wine lookup fixture.

AI assistance: OpenAI Codex ran the local verification and drafted this report. No title assets attached.

**@⁠pickles976** on GitHub · 2026-11-26 04:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856#issuecomment-7182457101) Independent Wine/NVIDIA fixture verification: **1/1 PASS**, actual **RTX 4060 Laptop GPU 8 GiB**, driver 590.48.01, 16 GiB system RAM, Wine 11.0 / vkd3d-proton 3.2.0; `DXVK_CONFIG='dxgi.hideNvidiaGpu = False'`. Windows-MSVC test build, Rust 1.98.1, one test process/thread in a 9 GiB / 512 MiB-swap scope. Runtime source is exact head **24e65566c11ae5b4e53e47d4341a1c5ca7a9a0b1**; **local test-only strengthening disclosed**: replaced all three optional host-buffer lookups (wide/narrow/beyond) with `expect`, rather than allowing this run to pass by skipping assertions. No production changes. `a_wider_loose_window_covers_a_later_smaller_ask` verified Arc identity for the narrower covered request, a distinct backing for the beyond-range request, and the isolated reuse-counter delta. Output: `verified all three host lookups; covered backing 8388608 bytes, noncovered 8388608 bytes`. Physical NVIDIA adapter explicitly enumerated. This is buffer creation/reuse correctness, **not a GPU shader dispatch or gameplay test**. Command: `cargo test --locked --target x86_64-pc-windows-msvc -p victory-gpu --lib a_wider_loose_window_covers_a_later_smaller_ask -- --nocapture --test-threads=1` via local Wine runner. Fresh compilation from this checkout confirmed; log `verify-pr2856-wine-rtx4060-strict-window.log`. Why this matters on this host: a separate, instrumented main `63bcca4` load **without this PR** measured loose-window backing **256 -> 2,012 MiB** before the unchanged free-RAM guard stopped loading; texture staging stayed at 32 MiB. Full owner measurements and caveats: https://git.gtahub.st/github/Marvisak--VIctory/issues/3012 . That makes this PR relevant, but I have **not** measured its reduction in that title run, nor does the fixture show bounded growth/reclamation of retained windows. Suggested fixture improvement remains the one earlier reviewers identified: require narrow/beyond lookups after successful hardware creation so allocation failures cannot skip the consumer-visible assertions; keep global counter checks isolated from unrelated tests. No objection from this isolated laptop/Wine lookup fixture. AI assistance: OpenAI Codex ran the local verification and drafted this report. No title assets attached.
Author
Owner

@⁠pickles976 on GitHub · 2026-11-26 04:20 UTC · original

Follow-up retail loading measurement on the same RTX 4060 Laptop GPU 8 GiB / 16 GiB RAM / Wine 11.0 host: the reuse path executes, but this change alone did not clear the guarded world-load RAM blocker.

Provenance: main 63bcca43c6a00a758510398fa43096ce7e4f7df0 + the same local read-only memory probe described in #3012 . Candidate adds this PR's exact covering-range lookup and return behavior from 24e65566, with a cumulative reuse counter in the probe (rather than the PR's 5-second presentation logger). This is a local main integration, not an exact PR-head title run. No other runtime changes. Fresh release diagnostics compilation verified.

Both arms: Series S, reported 1920x1080/window 1280x720, VICTORY_KEYS=20:Enter, 110 s maximum, 9 GiB scope / 512 MiB swap, global MemAvailable floor 2,048 MiB, GPU limit 6,000 MiB. Existing caches retained between arms; no cache reset. Initial available RAM differed (11,517.5 vs 11,217.7 MiB), and file-cache/background state was not controlled. Treat wall-time samples as descriptive, not matched world progress or a causal FPS/memory improvement.

Loose-shadow backing, nearest 2 s sample (MiB) Main + probe + covering reuse
~40 s 272 244
~60 s 1,240 1,312
~72 s 2,012 1,940
Last sampled before each arm's stop (different times) 2,012 2,604

Candidate recorded 7,707 covering hits by its last sample. This is reuse-hit count, not unique buffers or bytes saved. The standing map still grows: overlapping reuse prevents some allocations but does not retire windows or bound distinct required content.

The baseline guard stopped at 73.90 s / 2,032.4 MiB available. Candidate stopped at 90.14 s / 1,960.5 MiB available, scope 7,647.3 MiB (anon 2,814.0), global GPU 3,113 MiB, disk 16.53 GiB; exit 137 was the guard, not a title crash. At ~70 s the candidate screenshot remained loading artwork, not gameplay. Candidate last diagnostics reported 3,873 decimal MB non-local video-memory use; its texture chunks stayed at 32 MiB and registered shadow backing reached ~895.7 MiB. Its final 2.5 FPS line describes loading, not gameplay performance or a demonstrated regression.

Suggested next measurable owner change: guest-lifetime-aware retirement/reuse of loose backing, with GPU-write/list/view/fence preservation, or an ownership census that identifies how much remains genuinely required. Do not turn the missing reclaim path into an indefinite admission wait. This does not retract the focused lookup-test pass; it limits what that pass and the reuse count establish for 16 GiB playability.

Local logs: baseline 20261126T041203Z-{console.log,resources.csv}; candidate 20261126T041844Z-{console.log,resources.csv} and main-63bcca4-pr2856-memory-build.log. Candidate screenshot menu-20261126T041954164984Z.png remains local. AI-assisted (OpenAI Codex); no assets attached.

**@⁠pickles976** on GitHub · 2026-11-26 04:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856#issuecomment-7182516879) Follow-up retail loading measurement on the same **RTX 4060 Laptop GPU 8 GiB / 16 GiB RAM / Wine 11.0** host: the reuse path executes, but **this change alone did not clear the guarded world-load RAM blocker**. Provenance: main `63bcca43c6a00a758510398fa43096ce7e4f7df0` + the same local read-only memory probe described in https://git.gtahub.st/github/Marvisak--VIctory/issues/3012 . Candidate adds this PR's exact covering-range lookup and return behavior from `24e65566`, with a cumulative reuse counter in the probe (rather than the PR's 5-second presentation logger). This is a **local main integration**, not an exact PR-head title run. No other runtime changes. Fresh release diagnostics compilation verified. Both arms: Series S, reported 1920x1080/window 1280x720, `VICTORY_KEYS=20:Enter`, 110 s maximum, 9 GiB scope / 512 MiB swap, global MemAvailable floor 2,048 MiB, GPU limit 6,000 MiB. Existing caches retained between arms; no cache reset. Initial available RAM differed (11,517.5 vs 11,217.7 MiB), and file-cache/background state was not controlled. Treat wall-time samples as descriptive, not matched world progress or a causal FPS/memory improvement. | Loose-shadow backing, nearest 2 s sample (MiB) | Main + probe | + covering reuse | |---|---:|---:| | ~40 s | 272 | 244 | | ~60 s | 1,240 | 1,312 | | ~72 s | 2,012 | 1,940 | | Last sampled before each arm's stop (different times) | 2,012 | 2,604 | Candidate recorded **7,707 covering hits** by its last sample. This is reuse-hit count, not unique buffers or bytes saved. The standing map still grows: overlapping reuse prevents some allocations but does not retire windows or bound distinct required content. The baseline guard stopped at 73.90 s / 2,032.4 MiB available. Candidate stopped at **90.14 s / 1,960.5 MiB available**, scope **7,647.3 MiB** (anon 2,814.0), global GPU 3,113 MiB, disk 16.53 GiB; exit 137 was the guard, not a title crash. At ~70 s the candidate screenshot remained loading artwork, **not gameplay**. Candidate last diagnostics reported 3,873 decimal MB non-local video-memory use; its texture chunks stayed at 32 MiB and registered shadow backing reached ~895.7 MiB. Its final 2.5 FPS line describes loading, not gameplay performance or a demonstrated regression. Suggested next measurable owner change: guest-lifetime-aware retirement/reuse of loose backing, with GPU-write/list/view/fence preservation, or an ownership census that identifies how much remains genuinely required. Do not turn the missing reclaim path into an indefinite admission wait. This does not retract the focused lookup-test pass; it limits what that pass and the reuse count establish for 16 GiB playability. Local logs: baseline `20261126T041203Z-{console.log,resources.csv}`; candidate `20261126T041844Z-{console.log,resources.csv}` and `main-63bcca4-pr2856-memory-build.log`. Candidate screenshot `menu-20261126T041954164984Z.png` remains local. AI-assisted (OpenAI Codex); no assets attached.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 22:51 UTC · original · reviewed

Sound reuse: a covering window serves the same memory by construction, the range(..(start, MAX)).rev() walk finds candidates starting at-or-before ours nearest-first, and 'first whose end reaches past ours' is exactly the containment test. The diagnostics counters make the savings measurable. LGTM.

**@⁠kotekompotek** on GitHub · 2026-11-25 22:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856#pullrequestreview-6066073587) · **reviewed** Sound reuse: a covering window serves the same memory by construction, the range(..(start, MAX)).rev() walk finds candidates starting at-or-before ours nearest-first, and 'first whose end reaches past ours' is exactly the containment test. The diagnostics counters make the savings measurable. LGTM.
Author
Owner

@⁠AwsAli05 on GitHub · 2026-11-25 22:56 UTC · original · reviewed

The new covering-window test at 24e6556 passed on an RTX 5070 Ti. I found one reliability issue in that test. REUSES is process-wide, so another test that finds a covered window between the two loads can invalidate the exact before + 1 assertion. Once the wide window exists, the conditional narrow and beyond checks also allow a failed lookup to skip the assertion they are meant to exercise.

Could the coverage test assert identity and the returned range on both lookups, with the global counter check moved to an isolated run? That would keep the regression test focused on the reuse that reduces world-streaming memory.

AI-assisted review and test.

**@⁠AwsAli05** on GitHub · 2026-11-25 22:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856#pullrequestreview-6066119986) · **reviewed** The new covering-window test at `24e6556` passed on an RTX 5070 Ti. I found one reliability issue in that test. `REUSES` is process-wide, so another test that finds a covered window between the two loads can invalidate the exact `before + 1` assertion. Once the wide window exists, the conditional `narrow` and `beyond` checks also allow a failed lookup to skip the assertion they are meant to exercise. Could the coverage test assert identity and the returned range on both lookups, with the global counter check moved to an isolated run? That would keep the regression test focused on the reuse that reduces world-streaming memory. AI-assisted review and test.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 03:49 UTC · original · approved these changes

Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):

  • cargo test -p victory-gpu --lib shadow::tests: 10 passed, 0 failed (including new a_wider_loose_window_covers_a_later_smaller_ask).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 03:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856#pullrequestreview-6068296878) · **approved these changes** Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090): - `cargo test -p victory-gpu --lib shadow::tests`: **10 passed, 0 failed** (including new `a_wider_loose_window_covers_a_later_smaller_ask`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 11:47 UTC · original · approved these changes

Reviewed and verified 24e65566 on Windows 11 with RTX 5090, WARP (VICTORY_D3D12_WARP=1), and D3D12 Debug Layer (VICTORY_D3D12_DEBUG=1).

  • The covering-window lookup in shadow::loose (crates/victory-gpu/src/shadow.rs:1091-1104) scans .range(..(start, u64::MAX)).rev() and selects the nearest-start window whose end reaches past start + len, covering both strictly earlier starts and wider windows at the exact same start.
  • Downstream callers index into the returned Shadow through offset/left/gpu and refresh/write-back only their [address, address + len) sub-range; for structured views whose stride does not divide the shifted offset, for_view already falls back to exact(), preserving correctness.

Verification:

  • cargo xtask policy (190 files ok) and cargo clippy -p victory-gpu --tests -- -D warnings (default and --all-features): clean.
  • RTX 5090 (default and VICTORY_D3D12_DEBUG=1): shadow::tests 10/10 (including a_wider_loose_window_covers_a_later_smaller_ask) and draw::tests 20/20 passed.
  • WARP + VICTORY_D3D12_DEBUG=1: shadow::tests 10/10 passed.

Two minor non-blocking notes: using saturating_add on at + *l >= start + len (shadow.rs:1094) would guard against extreme high addresses, and in a_wider_loose_window_covers_a_later_smaller_ask (shadow.rs:1457-1522), asserting narrow.expect(...) / beyond.expect(...) and avoiding an exact before + 1 check against the process-wide REUSES atomic would keep the test strict and immune to parallel test interference.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2856#pullrequestreview-6073610666) · **approved these changes** Reviewed and verified `24e65566` on Windows 11 with RTX 5090, WARP (`VICTORY_D3D12_WARP=1`), and D3D12 Debug Layer (`VICTORY_D3D12_DEBUG=1`). - The covering-window lookup in `shadow::loose` (`crates/victory-gpu/src/shadow.rs:1091-1104`) scans `.range(..(start, u64::MAX)).rev()` and selects the nearest-start window whose end reaches past `start + len`, covering both strictly earlier starts and wider windows at the exact same `start`. - Downstream callers index into the returned `Shadow` through `offset`/`left`/`gpu` and refresh/write-back only their `[address, address + len)` sub-range; for structured views whose stride does not divide the shifted offset, `for_view` already falls back to `exact()`, preserving correctness. Verification: - `cargo xtask policy` (`190 files ok`) and `cargo clippy -p victory-gpu --tests -- -D warnings` (default and `--all-features`): clean. - RTX 5090 (default and `VICTORY_D3D12_DEBUG=1`): `shadow::tests` 10/10 (including `a_wider_loose_window_covers_a_later_smaller_ask`) and `draw::tests` 20/20 passed. - WARP + `VICTORY_D3D12_DEBUG=1`: `shadow::tests` 10/10 passed. Two minor non-blocking notes: using `saturating_add` on `at + *l >= start + len` (`shadow.rs:1094`) would guard against extreme high addresses, and in `a_wider_loose_window_covers_a_later_smaller_ask` (`shadow.rs:1457-1522`), asserting `narrow.expect(...)` / `beyond.expect(...)` and avoiding an exact `before + 1` check against the process-wide `REUSES` atomic would keep the test strict and immune to parallel test interference.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2856/head:github-bot/gh-2856'
git switch 'github-bot/gh-2856'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2856'
git switch 'github-bot/gh-2856'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2856'
git switch 'github-bot/gh-2856'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2856'
git switch 'main'
git merge --squash 'github-bot/gh-2856'
git switch 'main'
git merge --ff-only 'github-bot/gh-2856'
git switch 'main'
git merge 'github-bot/gh-2856'
git push origin 'main'
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/Marvisak--VIctory!2856
No description provided.