Preserve budget charges for fallback windows #4145

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

@⁠john-9474 on GitHub · 2026-11-30 16:44 UTC · original
john-9474:codex/window-fallback-charge → main · +233 −63 · 4 files · 1 commits · closed without merging

What it changes

With VICTORY_WINDOWS_OWN=1, a window whose second side falls back to system memory takes no device-local budget reservation. Dropping it nevertheless subtracts its size from CARD_BYTES[0]; failing its private CPU-mirror allocation subtracts from WINDOW_CARD_BYTES. A 64 KiB fallback can therefore wrap an unrelated zero counter to 18446744073709486080.

This carries the allocator's actual counter and byte reservation in a non-copyable Charge, through second-side allocation into Card. A failed mirror releases that reservation with the allocated side. Window fallbacks carry no charge; ordinary CARD_ALL fallback keeps its existing charge. Device-local windows, late promotion and arena sides retain their original counters. Allocation order, admission limits and placement policy stay the same.

Includes five production charge-helper tests and three ignored native allocation/drop fixtures, plus the existing file-backing fixture's constructor update.

How it was tested

  • Windows/D3D12 allocation and drop fixtures; no Series X/S game profile, resolution, DLSS, frame generation or ray tracing workload.
  • Before: a 64 KiB uncharged window wraps CARD_BYTES[0] from zero to 18446744073709486080, with both shared and private mirrors. Injected mirror failure wraps WINDOW_CARD_BYTES by the same amount.
  • After: five native cases pass, keeping all four captured budget counters unchanged for window drop/failure and preserving ordinary CARD_ALL success/drop/rollback accounting in both mirror modes.
  • Nine fresh-process RED/GREEN outcomes match expectations, including a RED-after-GREEN reversal. All five production Charge tests pass standalone and in the integrated test binary.
  • Native comparisons use pinned c71899d9. Both diagnostic test builds include the complete existing-test repair from #4018 equally as a separate local prerequisite; it is excluded from this PR.
  • The refreshed contribution is based on 7d93ee07. Compared with the original 84bd61e2 contribution, only upstream's unused ranged helper removal differs; the charge implementation and all authored fixtures are byte-identical. The native evidence above remains scoped to the original c718 paired builds, not a new-main native run.
  • On refreshed 7d93ee07: all five production Charge CPU tests pass again. cargo check --locked --jobs 2 -p victory-gpu --lib and strict cargo clippy --locked --jobs 2 -p victory-gpu --all-targets -- -D warnings both pass with default features and with --features diagnostics. These focused checks do not execute the ignored native fixtures.
  • cargo run --locked --quiet --jobs 2 -p xtask -- policy --staged passes for all four files; git diff --cached --check passes and Cargo.lock is unchanged.
  • Focused tests pass; the full crate/workspace test suite was not run.

Historical CI on original head 3c47d211 failed on three unchanged baseline Clippy findings, matching clean 84bd CI. Upstream #4297 has since addressed them; the refreshed focused strict checks above pass without authored suppressions. New remote workspace CI is separate from these local results.

The native fixtures submit no GPU commands and use no title data. Diagnostics and error-drain assertions were enabled, but actual InfoQueue availability was not asserted, so this is not a claim of clean D3D12 validation. No gameplay/FPS improvement is claimed; WINDOWS_OWN was off in our gameplay benchmarks.

Checked for overlap

  • Searched open PRs for WINDOWS_OWN, CARD_BYTES, window charges, fallback rollback and reservation counters, and inspected related source changes. The original audit found no matching active repair; the refresh now records the material overlap with #4243 below.
  • The placement split from #2538 remains intact. #3723 changes retention, #3074 adds memory logging, and #3869 adds lifetime telemetry. Latest .02 does not change these allocation/drop charge paths.
  • #4243 now also repairs the same window Drop and failed-mirror accounting using a system-memory counter and on_card provenance, bundled with admission-line, twin-size and ordinary CARD_ALL accounting changes. This existing PR keeps the narrower actual-reservation ownership fix and its paired native drop/rollback tests; the broader policy changes remain separate. Neither feature is in refreshed main.
**@⁠john-9474** on GitHub · 2026-11-30 16:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4145) `john-9474:codex/window-fallback-charge` → `main` · +233 −63 · 4 files · 1 commits · closed without merging ## What it changes With `VICTORY_WINDOWS_OWN=1`, a window whose second side falls back to system memory takes no device-local budget reservation. Dropping it nevertheless subtracts its size from `CARD_BYTES[0]`; failing its private CPU-mirror allocation subtracts from `WINDOW_CARD_BYTES`. A 64 KiB fallback can therefore wrap an unrelated zero counter to `18446744073709486080`. This carries the allocator's actual counter and byte reservation in a non-copyable `Charge`, through second-side allocation into `Card`. A failed mirror releases that reservation with the allocated side. Window fallbacks carry no charge; ordinary `CARD_ALL` fallback keeps its existing charge. Device-local windows, late promotion and arena sides retain their original counters. Allocation order, admission limits and placement policy stay the same. Includes five production charge-helper tests and three ignored native allocation/drop fixtures, plus the existing file-backing fixture's constructor update. ## How it was tested - Windows/D3D12 allocation and drop fixtures; no Series X/S game profile, resolution, DLSS, frame generation or ray tracing workload. - Before: a 64 KiB uncharged window wraps `CARD_BYTES[0]` from zero to `18446744073709486080`, with both shared and private mirrors. Injected mirror failure wraps `WINDOW_CARD_BYTES` by the same amount. - After: five native cases pass, keeping all four captured budget counters unchanged for window drop/failure and preserving ordinary `CARD_ALL` success/drop/rollback accounting in both mirror modes. - Nine fresh-process RED/GREEN outcomes match expectations, including a RED-after-GREEN reversal. All five production `Charge` tests pass standalone and in the integrated test binary. - Native comparisons use pinned `c71899d9`. Both diagnostic test builds include the complete existing-test repair from #4018 equally as a separate local prerequisite; it is excluded from this PR. - The refreshed contribution is based on `7d93ee07`. Compared with the original `84bd61e2` contribution, only upstream's unused `ranged` helper removal differs; the charge implementation and all authored fixtures are byte-identical. The native evidence above remains scoped to the original c718 paired builds, not a new-main native run. - On refreshed `7d93ee07`: all five production `Charge` CPU tests pass again. `cargo check --locked --jobs 2 -p victory-gpu --lib` and strict `cargo clippy --locked --jobs 2 -p victory-gpu --all-targets -- -D warnings` both pass with default features and with `--features diagnostics`. These focused checks do not execute the ignored native fixtures. - `cargo run --locked --quiet --jobs 2 -p xtask -- policy --staged` passes for all four files; `git diff --cached --check` passes and Cargo.lock is unchanged. - Focused tests pass; the full crate/workspace test suite was not run. Historical [CI on original head `3c47d211`](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46466416974/job/142016218090) failed on three unchanged baseline Clippy findings, matching [clean 84bd CI](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46462292806/job/142001487347). Upstream #4297 has since addressed them; the refreshed focused strict checks above pass without authored suppressions. New remote workspace CI is separate from these local results. The native fixtures submit no GPU commands and use no title data. Diagnostics and error-drain assertions were enabled, but actual InfoQueue availability was not asserted, so this is not a claim of clean D3D12 validation. No gameplay/FPS improvement is claimed; `WINDOWS_OWN` was off in our gameplay benchmarks. ## Checked for overlap - [x] Searched open PRs for `WINDOWS_OWN`, `CARD_BYTES`, window charges, fallback rollback and reservation counters, and inspected related source changes. The original audit found no matching active repair; the refresh now records the material overlap with #4243 below. - The placement split from #2538 remains intact. #3723 changes retention, #3074 adds memory logging, and #3869 adds lifetime telemetry. Latest .02 does not change these allocation/drop charge paths. - #4243 now also repairs the same window Drop and failed-mirror accounting using a system-memory counter and `on_card` provenance, bundled with admission-line, twin-size and ordinary `CARD_ALL` accounting changes. This existing PR keeps the narrower actual-reservation ownership fix and its paired native drop/rollback tests; the broader policy changes remain separate. Neither feature is in refreshed main.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 16:45:48 +00:00
github-bot force-pushed github-bot/gh-4145 from 3c47d21165 to b0267a96db 2026-12-01 00:17:40 +00:00 Compare
github-bot closed this pull request 2026-12-01 18:50:40 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:46 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:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4145#issuecomment-7321519446) 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!4145
No description provided.