Count why the idle sweep keeps loose windows (#3646) #3825

Closed
github-bot wants to merge 3 commits from github-bot/gh-3825 into main AGit
Owner

@⁠xiepeixuan on GitHub · 2026-11-30 08:26 UTC · original
xiepeixuan:auto/3646 → main · +81 −4 · 2 files · 3 commits · closed without merging

Part of #3646

What it changes

The idle sweep already decides why a loose window must stay, but the predicate on main only returns yes or no. In a diagnostics build, set VICTORY_LOG=info,victory_gpu::shadow=debug to get one line per nonempty sweep, after the table lock is released:

  • other_owner: the table is not the only owner of the Arc.
  • recent: the window did not meet the sweep's actual time and frame requirements.
  • buffer_held, staging_held: another reference to the host buffer or its shared staging buffer kept the entry.
  • eligible: entries the unchanged sweep removed.

These are entries, classified by the first failed check, not bytes or independent totals. A window failing two checks is counted once. The change does not diagnose the cause of the reported crash, change the eviction policy, or introduce a cap.

How it was tested

  • GPU: none for the new test; synthetic unit tests only, no game data. Console profile, resolution, DLSS, frame generation, ray tracing and shader wave sizes: not applicable.
  • Wrote loose_sweep_counts_only_the_first_failed_check first. It checks every one of the 16 combinations of the four gates, the exact order of the checks that ran, and which entry is eligible. Counts: 8 other owners, 4 recent, 2 host-buffer refs, 1 staging ref, 1 eligible. On an otherwise identical scratch copy with only the counter increment disabled, the test compiled and failed with [0, 0, 0, 0] instead of [8, 4, 2, 1] (exit 101); the exact draft passed (exit 0). Windows test and negative control
  • cargo check --workspace --locked: passed on pristine 41adb551 and draft 03b16eae. The fork CI explicitly checked out and verified those two source SHAs; the validation workflow is not in this PR.

Unfiltered Windows victory-gpu library results (passed / failed / ignored); both full crate runs also executed the available integration and doc tests:

Configuration Before: main After: draft
Default 920 / 2 / 60 921 / 1 / 60
Diagnostics 991 / 4 / 62 992 / 4 / 62

The diagnostics replay integration test also passed on both. Every draft failure reproduced on the same main in the same feature configuration. The default draft failed only the translator-switch cache-key test; main also failed the card-steps test. Both diagnostics runs failed those two plus the BGRX-view and timeline-waits tests. Unfiltered fork CI

  • cargo test passed for the crate it touches: yes with the verified baseline exclusions; no unfiltered. Using identical exclusions on both commits, the default library passed 920 → 920 (2 filtered) and the diagnostics library passed 991 → 992 (4 filtered). Zero failures in all four jobs. Baseline-filtered Windows CI

Upstream CI stops before tests at the same victory-loader Clippy error on plain main and this draft: unwind_copy is never used.

Checked for overlap

  • Searched the 800-PR list and the complete inventory (1,707 at the pre-claim refresh), including recent closures/merges, for #3646, shadow.rs, let_go_idle, LOOSE, the reference and age checks, and related diagnostics. Checked #1138: the shadow-copy work in #318, #1094 and #1157 concerns refresh costs, not this sweep. The issue had no assignee, comments or linked work before the draft claim.
  • Read the changed sweep hunks in #831, #2884, #3500, #3503, #3509 and #3723. #2884 samples overlapping byte totals with a fixed five-second age, outside the sweep; #3723 counts holds introduced by its tiering policy. Neither reports the first blocker at this sweep's live threshold. The existing #1784 census has a separate fixed-age in-use/idle split.

Uses audit: host::sweep is the only production caller of shadow::let_go_idle and still calls it at the same point. The only production use of LooseSweep::eligible is the original filter: same four checks, same order and thresholds, same short circuit, same keys removed. No extra clock or COM reference query. Derived Default initializes one local accumulator per sweep (also used by the unit test). The new first_hold field is incremented only at the first rejection and read only by the debug line and the test; it does not exist without the diagnostics feature. The new test has no production callers. No statics, switches, or other call sites changed.

Diagnostic requested by Zendothony in #3646. This is not a ported patch.

Opened as a draft early so others know this is being worked on (README: 'Opening a draft pull request early works too').

AI-assisted (Codex). Not run in the game.

**@⁠xiepeixuan** on GitHub · 2026-11-30 08:26 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3825) `xiepeixuan:auto/3646` → `main` · +81 −4 · 2 files · 3 commits · closed without merging Part of #3646 ## What it changes The idle sweep already decides why a loose window must stay, but the [predicate on main](https://github.com/trustno1-coder/VIctory-NVIDIA/blob/41adb55167fa778fcaa5dc36fa18a1fa8dacd657/crates/victory-gpu/src/shadow.rs#L4941-L4956) only returns yes or no. In a diagnostics build, set `VICTORY_LOG=info,victory_gpu::shadow=debug` to get one line per nonempty sweep, after the table lock is released: - `other_owner`: the table is not the only owner of the `Arc`. - `recent`: the window did not meet the sweep's actual time **and** frame requirements. - `buffer_held`, `staging_held`: another reference to the host buffer or its shared staging buffer kept the entry. - `eligible`: entries the unchanged sweep removed. These are **entries, classified by the first failed check**, not bytes or independent totals. A window failing two checks is counted once. The change does not diagnose the cause of the reported crash, change the eviction policy, or introduce a cap. ## How it was tested - GPU: none for the new test; synthetic unit tests only, no game data. Console profile, resolution, DLSS, frame generation, ray tracing and shader wave sizes: not applicable. - Wrote `loose_sweep_counts_only_the_first_failed_check` first. It checks every one of the 16 combinations of the four gates, the exact order of the checks that ran, and which entry is eligible. Counts: 8 other owners, 4 recent, 2 host-buffer refs, 1 staging ref, 1 eligible. On an otherwise identical scratch copy with only the counter increment disabled, the test compiled and failed with `[0, 0, 0, 0]` instead of `[8, 4, 2, 1]` (exit 101); the exact draft passed (exit 0). [Windows test and negative control](https://github.com/xiepeixuan/VIctory-NVIDIA/actions/runs/46382311962/job/141724079275) - `cargo check --workspace --locked`: passed on pristine `41adb551` and draft `03b16eae`. The fork CI explicitly checked out and verified those two source SHAs; the validation workflow is **not** in this PR. Unfiltered Windows `victory-gpu` **library** results (passed / failed / ignored); both full crate runs also executed the available integration and doc tests: | Configuration | Before: main | After: draft | | --- | ---: | ---: | | Default | 920 / 2 / 60 | 921 / 1 / 60 | | Diagnostics | 991 / 4 / 62 | 992 / 4 / 62 | The diagnostics replay integration test also passed on both. Every draft failure reproduced on the same main in the same feature configuration. The default draft failed only the translator-switch cache-key test; main also failed the card-steps test. Both diagnostics runs failed those two plus the BGRX-view and timeline-waits tests. [Unfiltered fork CI](https://github.com/xiepeixuan/VIctory-NVIDIA/actions/runs/46382311962) - `cargo test` passed for the crate it touches: **yes with the verified baseline exclusions; no unfiltered**. Using identical exclusions on both commits, the default library passed 920 → 920 (2 filtered) and the diagnostics library passed 991 → 992 (4 filtered). Zero failures in all four jobs. [Baseline-filtered Windows CI](https://github.com/xiepeixuan/VIctory-NVIDIA/actions/runs/46383500180) Upstream CI stops before tests at the same `victory-loader` Clippy error on [plain main](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46320380085/job/141526872705) and [this draft](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46382145959/job/141723554144): `unwind_copy` is never used. ## Checked for overlap - [x] Searched the 800-PR list and the complete inventory (1,707 at the pre-claim refresh), including recent closures/merges, for #3646, `shadow.rs`, `let_go_idle`, `LOOSE`, the reference and age checks, and related diagnostics. Checked #1138: the shadow-copy work in #318, #1094 and #1157 concerns refresh costs, not this sweep. The issue had no assignee, comments or linked work before the draft claim. - Read the changed sweep hunks in #831, #2884, #3500, #3503, #3509 and #3723. #2884 samples overlapping byte totals with a fixed five-second age, outside the sweep; #3723 counts holds introduced by its tiering policy. Neither reports the first blocker at this sweep's live threshold. The existing #1784 census has a separate fixed-age in-use/idle split. **Uses audit:** `host::sweep` is the only production caller of `shadow::let_go_idle` and still calls it at the same point. The only production use of `LooseSweep::eligible` is the original filter: same four checks, same order and thresholds, same short circuit, same keys removed. No extra clock or COM reference query. Derived `Default` initializes one local accumulator per sweep (also used by the unit test). The new `first_hold` field is incremented only at the first rejection and read only by the debug line and the test; it does not exist without the diagnostics feature. The new test has no production callers. No statics, switches, or other call sites changed. Diagnostic requested by Zendothony in #3646. This is not a ported patch. Opened as a draft early so others know this is being worked on (README: 'Opening a draft pull request early works too'). AI-assisted (Codex). Not run in the game.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 08:28:23 +00:00
github-bot closed this pull request 2026-11-30 08:55:06 +00:00
Author
Owner

@⁠dyshay on GitHub · 2026-11-30 08:55 UTC · original

Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics, and the CPU tests of the touched code pass. A run on an RTX 4090 is queued. Frame times will follow here.

**@⁠dyshay** on GitHub · 2026-11-30 08:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3825#issuecomment-7273514905) Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with `--profile diag --features diagnostics`, and the CPU tests of the touched code pass. A run on an RTX 4090 is queued. Frame times will follow here.

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!3825
No description provided.