The sweep lets go placed host copies whose title memory is unmapped #1348
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1348"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by HailLucifer666 on 2026-11-28T17:42:45Z.
The census counts a state nothing acts on: placed textures the title fills whose title memory is not mapped any more (
resource.rscount[8], sampled every 16th because asking Windows about all of them takes too long). Such a copy's source is gone — it can never be refreshed from title memory — so past its last use it is pure VRAM waste, which the reports show the cost of: #453 (graphics memory full within a minute, 29→<10 fps over 30 min), #609 (3,072 MB kept for render targets never given back on an 8 GB card).The mechanism
title_memory_unmappingrecords the range in O(1) (resource::unmapped);title_memory_remappedclears ranges it covers; the sweep drains the record and, for a placed texture overlapping it, applies the census's own idle window for that exact state (30 s / 60 frames —UNMAPPED_IDLE_MS/UNMAPPED_IDLE_FRAMES, one constant now shared by the census's count and the sweep's gate) instead of the VRAM-pressure line, which can be minutes.host_wrotetextures keep their existing skip (conservative: fewer evictions, never more). The per-sweep byte budget still bounds work; unmapped copies compete under it and continue over successive looks.title_memory_unmapping's walk and adds no per-texture Windows query to the sweep (the census samples every 16th for exactly that cost).Tests and probes (
resource::tests, 24 → part of victory-gpu's 458 passed / 0 failed / 36 ignored, clippy--all-targets --all-features -D warningsclean):overlap_any_is_half_open_on_both_ends— half-open boundaries, containment, zero-length, and the top-of-space saturation (my own first assertion there was wrong; the arithmetic was right — the test was corrected, noted here).the_unmapped_record_is_bounded_oldest_first— with the sweep off, the record ages out instead of growing without end.the_idle_gate_borrows_the_census_window_only_for_an_unmapped_source— mutation probes run and recorded: the unmapped arm disabled → red; the overlap boundary flipped → red. Restored byte-identical.the_unmapped_window_is_the_census_window— one constant, two readers, pinned.Stacks on #1290/#1294/#1326 for CI. The behavior claim that remains unproven is the in-game one (no machine here runs the title): what this PR provably does is make the sweep act on a state the census already measures, under the census's own safety window, with the sweep's own liveness gates unchanged.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gut0to on 2026-12-01T14:43:49Z.
Code review location:
crates/victory-gpu/src/resource.rs; line 2344This drops an entire recorded interval on any overlap, but
XMemMapPhysicalPagescan remap only part of a previously unmapped range. For example, after unmapping[0, 64 KiB), remapping[16, 32 KiB)should leave the prefix and suffix recorded; removing the whole interval makes the next texture sweep miss those still-unmapped pages and retain their placed copies as if the source were mapped. Could you subtract the remapped interval and preserve the remaining pieces, with a middle-range remap test? AI-assisted review; I traced the map notification and sweep bookkeeping.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gut0to on 2026-12-01T14:43:49Z.
Review: COMMENTED
AI-assisted review; I used an AI assistant to inspect this diff.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.