Tiered memory for unified memory emulation #3723

Closed
fl4rion wants to merge 5 commits from upstream-pr/3723 into main
fl4rion commented 2026-11-30 04:52:45 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fl4rion on 2026-11-30T04:52:45Z.


The problem

The Xbox Series X has one pool of memory that the CPU and the GPU share. A game writes a buffer with the CPU and the GPU reads it a moment later, from the same bytes, at no cost.

A PC has two pools: system RAM, and the graphics card's own memory. Its GPU reads its own memory fast and system RAM slowly, over PCIe. So VIctory keeps copies of the console's memory, and each copy lives in one of several places:

  • on the card (fast for the GPU, but the card's budget is limited);
  • in system RAM the card can read over the bus (slow per read, and it uses commit);
  • in plain system RAM (CPU only);
  • nowhere: dropped, and made again from the console's memory the next time it is needed.

Every copy costs something wherever it lives:

  • card budget;
  • the system's commit charge;
  • bus traffic;
  • CPU time to refresh it when the game writes;
  • or, when it was dropped too early, the time to rebuild it.

Today, every kind of copy decides this on its own. Textures, buffer copies, windows of memory, staging, send buffers and scratch each have a separate rule: their own idea of "idle", their own thresholds, their own reaction to memory pressure. We counted over a dozen independent idle rules and as many separate "are we under pressure?" switches. None of them knows how often a copy is actually used, and none can tell whether dropping a copy was a mistake.

One example of what that costs. VIctory copies memory outside buffers in "windows" (6 MiB each). When the PC runs short of memory, the window rule shortens its idle time to 2–5 seconds. A window that a game reads in bursts goes idle for a few seconds between them. It is dropped, then rebuilt moments later: a new buffer, a wait for it to become resident, and a full copy. In one play log with the system nearly out of commit, a third of all windows dropped came back within 30 seconds, and three in four did in the worst stretch, about 7.6 seconds later on average. The memory freed came straight back, and each rebuild was a small stall.

What this PR does

It gives VIctory a shared foundation for deciding where copies live, modelled on how storage systems tier data: keep what is used close to the compute, push out what is not, and decide from measured use rather than per-feature guesses. It then uses that foundation to fix the window problem above.

1. A small, reusable crate: victory-tiers. It has no Direct3D, no game code and no OS calls, so other forks and other emulators of shared-memory consoles can use it. It provides:

  • Usage statistics per copy: when it was last used, and in which of the last 44 seconds it was used, written by the CPU, or written by the GPU. They are kept in a few atomics on the copy itself, and noting a use costs a load and a compare.
  • A record of what was dropped, so a copy rebuilt soon after counts as a refault: the one number that says whether dropping it was a mistake.
  • One budget type for "how much may we hold": a limit, a line where we are over, hysteresis so it does not flap, and a cooling period after being over.
  • Rules built on these, starting with the window rule below.
  • A benchmark for memory rules that needs no game. It replays a workload, made up from a seed or recorded in play, against two or more rules. It prints what each rule rebuilt, copied and held. Every run gives the same numbers, every scenario has a control in which all rules must agree, and it runs the same rule code the emulator runs.

2. The window fix (victory-gpu). Under memory pressure, a window is no longer dropped just because it sat idle for 2–5 seconds:

  • a window used in at least 8 of the last 44 seconds waits at least 10 seconds;
  • a window that came back soon after being dropped waits 20 seconds the next time, then 40, then at most 60.

With memory to spare nothing changes, and the idle time is never made shorter than today's. A log line next to the frame-rate line says how many windows were kept and how many still came back.

Why it matters beyond windows

The window fix is the first user. The point is that these decisions can now be made in one place, from the same measurements, and checked before they ship. The benchmark already shows this on its own scenarios:

  • Card memory (textures in 64 MiB blocks, the card's budget cut mid-run): ranking evictions by "used most often" sounds right but doubles pop-in when play moves between areas. Plain least-recently-used stays best.
  • Spare buffers under a tight commit limit: freeing the coldest spares across all pools, only as much as needed, makes about half as many buffers as trimming each pool on its own, with the same memory left at every second.

Both are made-up loads, not play. They show the kind of question the benchmark answers in seconds, without a play session. This PR changes neither the card nor the spare pools.

What to expect

  • Under memory pressure: fewer rebuild stalls. In the stretch above, that was 11–15 rebuilds a second, each 1–3 ms plus a 6 MiB copy.
  • Memory held under pressure is a little higher: the windows kept are ones that were coming back anyway.
  • Frame rate in normal play: no change expected. This is about memory decisions and stutter under pressure, not the frame's critical path.

How it was tested

  • Unit tests:

    • cargo test -p victory-tiers --locked: 33 passed, including checks that replays are deterministic and that notes from many threads on the same seconds count once;
    • cargo test -p victory-gpu --lib --locked -- tiers:: shadow::: 76 passed.
  • Fixed after review: with VICTORY_WINDOW_GROW=1, windows made by grown() were never reported to the tiers' refault book, so the "came back soon" half of the rule did nothing (only "in use" worked). grown() now reports each window it makes, keyed by its 4 MiB cell, since a regrown window rarely has the extent of the one dropped. A test covers it: a grown window dropped and made again counts as a refault and its hold goes up.

  • cargo test -p victory-gpu --lib --locked: all pass but tests outside this PR that also fail or flake without it:

    • shader_cache::tests::every_switch_of_the_translator_is_in_the_key fails the same way on untouched 41adb551;
    • watch::tests::a_late_fault_leaves_the_guard_taken_since and host::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end each failed once in a full parallel run, and pass alone, with and without this PR.
  • Clippy: cargo clippy -p victory-tiers --all-targets --locked -- -D warnings is clean. Nothing new in the victory-gpu lines touched. The workspace -D warnings run stops in victory-shader on 41adb551, before this change.

  • Benchmark for the window rule (cargo run -p victory-tiers --release --example tiers_bench, made-up load: 900 windows, memory pressure rising over 5 minutes):

    Windows built Rebuilt within 30 s of being dropped Time spent building Memory held under pressure
    Before 3,290 1,289 10.7 s 2.1 GB
    This PR 2,655 (−19 %) 791 (−39 %) 8.7 s (−19 %) 2.5 GB (+21 %)

    The same load with plenty of memory gives identical results for both. Almost all of the gain comes from the "came back soon" part; the "in use" part adds little.

  • Limit of the benchmark: sim::commit looks at each rule once a simulated second (replay() calls look() once per second, and its load is modelled per second). It can't fairly evaluate rules whose state changes within a second, such as send::trim's low-water mark: sampled once a second, the mark sits at the pool's low point and the rule frees nothing, so any "win" comes from the harness's own cap eviction. Comparing such rules needs a finer-grained load and replay, which this PR does not add.

  • Not yet verified: a play session on this branch. The play figures in "The problem" come from a fork build running the same rule.

Checked for overlap

Searched open PRs at 41adb551 for "tier", "idle window", "windows let go", "commit pressure", "spare", "memory bench", "unified memory", "eviction".

  • #2717 (3-tier memguard commit admission): a different area, limiting shader compiles under commit pressure. This PR does not touch memguard.
  • #3381, #3411 (trimming or keeping spare pools): spare pools, not windows. The benchmark's commit model can't evaluate them as they are (see the benchmark's limit above).
  • #1562, #3454, #2724 (texture eviction): textures, not windows. The benchmark's card model ranks eviction among fixed 64 MiB blocks, so it can't express #1562's block sizes, and #3454 changes when eviction starts rather than the rule.
  • host/membench.rs (existing) measures what the real GPU layer holds over synthetic frames. victory-tiers compares decision rules on modelled loads. They complement each other.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5559221107 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3723). Originally posted by [fl4rion](https://github.com/fl4rion) on 2026-11-30T04:52:45Z. --- ## The problem The Xbox Series X has **one pool of memory** that the CPU and the GPU share. A game writes a buffer with the CPU and the GPU reads it a moment later, from the same bytes, at no cost. A PC has **two pools**: system RAM, and the graphics card's own memory. Its GPU reads its own memory fast and system RAM slowly, over PCIe. So VIctory keeps **copies** of the console's memory, and each copy lives in one of several places: - on the card (fast for the GPU, but the card's budget is limited); - in system RAM the card can read over the bus (slow per read, and it uses commit); - in plain system RAM (CPU only); - nowhere: dropped, and made again from the console's memory the next time it is needed. Every copy costs something wherever it lives: - card budget; - the system's commit charge; - bus traffic; - CPU time to refresh it when the game writes; - or, when it was dropped too early, the time to rebuild it. **Today, every kind of copy decides this on its own.** Textures, buffer copies, windows of memory, staging, send buffers and scratch each have a separate rule: their own idea of "idle", their own thresholds, their own reaction to memory pressure. We counted over a dozen independent idle rules and as many separate "are we under pressure?" switches. None of them knows how often a copy is actually used, and none can tell whether dropping a copy was a mistake. **One example of what that costs.** VIctory copies memory outside buffers in "windows" (6 MiB each). When the PC runs short of memory, the window rule shortens its idle time to 2–5 seconds. A window that a game reads in bursts goes idle for a few seconds between them. It is dropped, then rebuilt moments later: a new buffer, a wait for it to become resident, and a full copy. In one play log with the system nearly out of commit, **a third of all windows dropped came back within 30 seconds, and three in four did in the worst stretch**, about 7.6 seconds later on average. The memory freed came straight back, and each rebuild was a small stall. ## What this PR does It gives VIctory a **shared foundation for deciding where copies live**, modelled on how storage systems tier data: keep what is used close to the compute, push out what is not, and decide from measured use rather than per-feature guesses. It then uses that foundation to fix the window problem above. **1. A small, reusable crate: `victory-tiers`.** It has no Direct3D, no game code and no OS calls, so other forks and other emulators of shared-memory consoles can use it. It provides: - **Usage statistics per copy:** when it was last used, and in which of the last 44 seconds it was used, written by the CPU, or written by the GPU. They are kept in a few atomics on the copy itself, and noting a use costs a load and a compare. - **A record of what was dropped,** so a copy rebuilt soon after counts as a **refault**: the one number that says whether dropping it was a mistake. - **One budget type** for "how much may we hold": a limit, a line where we are over, hysteresis so it does not flap, and a cooling period after being over. - **Rules built on these,** starting with the window rule below. - **A benchmark for memory rules that needs no game.** It replays a workload, made up from a seed or recorded in play, against two or more rules. It prints what each rule rebuilt, copied and held. Every run gives the same numbers, every scenario has a control in which all rules must agree, and it runs the same rule code the emulator runs. **2. The window fix** (`victory-gpu`). Under memory pressure, a window is no longer dropped just because it sat idle for 2–5 seconds: - a window used in at least 8 of the last 44 seconds waits at least 10 seconds; - a window that came back soon after being dropped waits 20 seconds the next time, then 40, then at most 60. With memory to spare nothing changes, and the idle time is never made shorter than today's. A log line next to the frame-rate line says how many windows were kept and how many still came back. ## Why it matters beyond windows The window fix is the first user. The point is that these decisions can now be made in one place, from the same measurements, and **checked before they ship**. The benchmark already shows this on its own scenarios: - **Card memory** (textures in 64 MiB blocks, the card's budget cut mid-run): ranking evictions by "used most often" sounds right but **doubles pop-in** when play moves between areas. Plain least-recently-used stays best. - **Spare buffers** under a tight commit limit: freeing the coldest spares across all pools, only as much as needed, makes **about half as many buffers** as trimming each pool on its own, with the same memory left at every second. Both are made-up loads, not play. They show the kind of question the benchmark answers in seconds, without a play session. This PR changes neither the card nor the spare pools. ## What to expect - **Under memory pressure:** fewer rebuild stalls. In the stretch above, that was 11–15 rebuilds a second, each 1–3 ms plus a 6 MiB copy. - **Memory held under pressure is a little higher:** the windows kept are ones that were coming back anyway. - **Frame rate in normal play:** no change expected. This is about memory decisions and stutter under pressure, not the frame's critical path. ## How it was tested - **Unit tests:** - `cargo test -p victory-tiers --locked`: 33 passed, including checks that replays are deterministic and that notes from many threads on the same seconds count once; - `cargo test -p victory-gpu --lib --locked -- tiers:: shadow::`: 76 passed. - **Fixed after review:** with `VICTORY_WINDOW_GROW=1`, windows made by `grown()` were never reported to the tiers' refault book, so the "came back soon" half of the rule did nothing (only "in use" worked). `grown()` now reports each window it makes, keyed by its 4 MiB cell, since a regrown window rarely has the extent of the one dropped. A test covers it: a grown window dropped and made again counts as a refault and its hold goes up. - **`cargo test -p victory-gpu --lib --locked`:** all pass but tests outside this PR that also fail or flake without it: - `shader_cache::tests::every_switch_of_the_translator_is_in_the_key` fails the same way on untouched `41adb551`; - `watch::tests::a_late_fault_leaves_the_guard_taken_since` and `host::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end` each failed once in a full parallel run, and pass alone, with and without this PR. - **Clippy:** `cargo clippy -p victory-tiers --all-targets --locked -- -D warnings` is clean. Nothing new in the victory-gpu lines touched. The workspace `-D warnings` run stops in `victory-shader` on `41adb551`, before this change. - **Benchmark for the window rule** (`cargo run -p victory-tiers --release --example tiers_bench`, made-up load: 900 windows, memory pressure rising over 5 minutes): | | Windows built | Rebuilt within 30 s of being dropped | Time spent building | Memory held under pressure | |---|---|---|---|---| | Before | 3,290 | 1,289 | 10.7 s | 2.1 GB | | This PR | 2,655 (−19 %) | 791 (−39 %) | 8.7 s (−19 %) | 2.5 GB (+21 %) | The same load with plenty of memory gives identical results for both. Almost all of the gain comes from the "came back soon" part; the "in use" part adds little. - **Limit of the benchmark:** `sim::commit` looks at each rule once a simulated second (`replay()` calls `look()` once per second, and its load is modelled per second). It can't fairly evaluate rules whose state changes within a second, such as `send::trim`'s low-water mark: sampled once a second, the mark sits at the pool's low point and the rule frees nothing, so any "win" comes from the harness's own cap eviction. Comparing such rules needs a finer-grained load and replay, which this PR does not add. - **Not yet verified:** a play session on this branch. The play figures in "The problem" come from a fork build running the same rule. ## Checked for overlap Searched open PRs at `41adb551` for "tier", "idle window", "windows let go", "commit pressure", "spare", "memory bench", "unified memory", "eviction". - **#2717** (3-tier memguard commit admission): a different area, limiting shader compiles under commit pressure. This PR does not touch `memguard`. - **#3381, #3411** (trimming or keeping spare pools): spare pools, not windows. The benchmark's commit model can't evaluate them as they are (see the benchmark's limit above). - **#1562, #3454, #2724** (texture eviction): textures, not windows. The benchmark's card model ranks eviction among fixed 64 MiB blocks, so it can't express #1562's block sizes, and #3454 changes when eviction starts rather than the rule. - **`host/membench.rs`** (existing) measures what the real GPU layer holds over synthetic frames. `victory-tiers` compares decision rules on modelled loads. They complement each other.
mia03ther commented 2026-11-30 11:10:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mia03ther on 2026-11-30T11:10:57Z.


Sharing a v2026.11.29.05 measurement from a 16 GB RAM / RTX 5070 Ti Laptop setup (#3909) in support of tiered/residency reductions like this PR:

  • Setup: Series S 540p, DLSS Performance, FG off, VICTORY_TEXTURE_ROOM_PERCENT=78, VICTORY_ROOT_CACHE=0, VICTORY_PROCESS_MEMORY=0.
  • Numbers: While GPU card time was only 24.8 ms (48% busy), preparing per frame spent 56.2–64.5 ms (lists' steps 29.8 ms, descriptor 13.5 ms with 13,253 raw twins/frame, card copies 8.2 ms), locking steady gameplay to ~19.8 fps (50.6 ms median). Meanwhile, 21.0 GB private commit (including ~3.3 GB buffer mirror span) could only keep 5.86 GB resident on 16 GB RAM (487 MB free), driving 694 / 10,933 frames over 100 ms (worst 4,295.9 ms). Lowering copy/commit footprint + submit work would be huge for 16 GB laptops.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7276653957 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3723#issuecomment-7276653957). Originally posted by [mia03ther](https://github.com/mia03ther) on 2026-11-30T11:10:57Z. --- Sharing a `v2026.11.29.05` measurement from a 16 GB RAM / RTX 5070 Ti Laptop setup (#3909) in support of tiered/residency reductions like this PR: - **Setup:** Series S 540p, DLSS Performance, FG off, `VICTORY_TEXTURE_ROOM_PERCENT=78`, `VICTORY_ROOT_CACHE=0`, `VICTORY_PROCESS_MEMORY=0`. - **Numbers:** While GPU card time was only `24.8 ms` (48% busy), `preparing per frame` spent `56.2–64.5 ms` (`lists' steps 29.8 ms`, `descriptor 13.5 ms` with `13,253` raw twins/frame, `card copies 8.2 ms`), locking steady gameplay to `~19.8 fps` (`50.6 ms` median). Meanwhile, `21.0 GB` private commit (including `~3.3 GB` buffer mirror span) could only keep `5.86 GB` resident on 16 GB RAM (`487 MB` free), driving `694 / 10,933` frames over 100 ms (worst `4,295.9 ms`). Lowering copy/commit footprint + submit work would be huge for 16 GB laptops.
shurhundo commented 2026-11-30 15:31:24 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by shurhundo on 2026-11-30T15:31:24Z.


Ran the crate's own tooling independently (Linux, via WSL) and read through the diff. One bug, and a limitation of the benchmark worth knowing about before using it to settle the other open memory PRs.

VICTORY_WINDOW_GROW=1 silently disables the refault/Holds half of the fix.

grown() in shadow.rs (around line 8570) makes a new window copy with made_window() but never calls crate::tiers::window_made(), unlike the plain path in loose() (line 8448) that does. grow() is checked first thing in loose() (line 8409), so once that flag is set, every window creation in the process goes through grown() and window_made() is never called at all.

Consequence: Ghosts::made() never runs, so a window remade soon after being let go is never counted as a refault, and Holds::made() never advances, so the 20/40/60 s escalation never engages. Only the "Hot" (used in N of 44 s) half of IdleRule still works under this flag, since the shared note() closure that updates seconds is called from grown() too. The "Back" half, which the benchmark table in the PR description credits with almost all of the measured gain, does nothing for anyone running with VICTORY_WINDOW_GROW=1. No test exercises this; grown_windows_hold_the_asks_and_what_was_there only checks grown_extent's arithmetic, not the tiers integration.

The benchmark can't fairly evaluate the other open memory PRs it names in "Checked for overlap."

Tried using sim::commit to compare #3381/#3411's low-water-mark spare trimming against Today and Ranked, since the PR description says the benchmark's commit model could do this. First pass gave a clean table with the low-water rule beating both existing rules on every metric. Instrumented it to check why, and the rule's own look() was returning zero frees in the TIGHT scenario; the "win" was entirely the harness's own cap-eviction fallback in replay(), not the rule being tested.

The reason: send::trim()'s low-water mark is updated on every take and give-back, many times a second. sim::commit::replay() only calls rule.look() once a second. At that sampling rate the mark collapses to the pool's near-instantaneous low point almost every look, which in a cycling workload is often 0, so the rule degenerates into a no-op. This isn't a bug in victory-tiers, it's a real gap in what the harness can evaluate: any rule that depends on sub-second state can't be ported to it without either changing the harness's time resolution or giving rules a way to see finer-grained events than one snapshot a second.

The other two named PRs don't fit the rule-comparison abstraction either, for different reasons. #1562 changes block layout and placement (16/8 MiB size-segregated pools against sim::card's hardcoded 64 MiB BLOCK), which isn't something CardRule can express; it ranks eviction order among fixed-size-block candidates, it doesn't model allocation strategy. #3454 isn't a competing rule at all, it's a one-line fix to when an existing eviction trigger becomes reachable, and the PR's own A/B is explicit that the result was inconclusive.

None of this is a problem with the PR as written, since it never claims to have run these comparisons itself, just that the tool could. Worth knowing before anyone takes a sim::commit or sim::card table as settling one of those PRs though.

Tested: cargo test -p victory-tiers --locked (33 passed) and cargo clippy -p victory-tiers --all-targets --locked -- -D warnings (clean), both on Linux/x86_64 via WSL, matching the PR's own Windows results. That also confirms the crate's "no Direct3D, no game code, no OS calls" portability claim independently, for whatever that's worth to other forks.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7283135789 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3723#issuecomment-7283135789). Originally posted by [shurhundo](https://github.com/shurhundo) on 2026-11-30T15:31:24Z. --- Ran the crate's own tooling independently (Linux, via WSL) and read through the diff. One bug, and a limitation of the benchmark worth knowing about before using it to settle the other open memory PRs. **`VICTORY_WINDOW_GROW=1` silently disables the refault/Holds half of the fix.** `grown()` in `shadow.rs` (around line 8570) makes a new window copy with `made_window()` but never calls `crate::tiers::window_made()`, unlike the plain path in `loose()` (line 8448) that does. `grow()` is checked first thing in `loose()` (line 8409), so once that flag is set, every window creation in the process goes through `grown()` and `window_made()` is never called at all. Consequence: `Ghosts::made()` never runs, so a window remade soon after being let go is never counted as a refault, and `Holds::made()` never advances, so the 20/40/60 s escalation never engages. Only the "Hot" (used in N of 44 s) half of `IdleRule` still works under this flag, since the shared `note()` closure that updates `seconds` is called from `grown()` too. The "Back" half, which the benchmark table in the PR description credits with almost all of the measured gain, does nothing for anyone running with `VICTORY_WINDOW_GROW=1`. No test exercises this; `grown_windows_hold_the_asks_and_what_was_there` only checks `grown_extent`'s arithmetic, not the tiers integration. **The benchmark can't fairly evaluate the other open memory PRs it names in "Checked for overlap."** Tried using `sim::commit` to compare #3381/#3411's low-water-mark spare trimming against `Today` and `Ranked`, since the PR description says the benchmark's commit model could do this. First pass gave a clean table with the low-water rule beating both existing rules on every metric. Instrumented it to check why, and the rule's own `look()` was returning zero frees in the TIGHT scenario; the "win" was entirely the harness's own cap-eviction fallback in `replay()`, not the rule being tested. The reason: `send::trim()`'s low-water mark is updated on every take and give-back, many times a second. `sim::commit::replay()` only calls `rule.look()` once a second. At that sampling rate the mark collapses to the pool's near-instantaneous low point almost every look, which in a cycling workload is often 0, so the rule degenerates into a no-op. This isn't a bug in `victory-tiers`, it's a real gap in what the harness can evaluate: any rule that depends on sub-second state can't be ported to it without either changing the harness's time resolution or giving rules a way to see finer-grained events than one snapshot a second. The other two named PRs don't fit the rule-comparison abstraction either, for different reasons. #1562 changes block layout and placement (16/8 MiB size-segregated pools against `sim::card`'s hardcoded 64 MiB `BLOCK`), which isn't something `CardRule` can express; it ranks eviction order among fixed-size-block candidates, it doesn't model allocation strategy. #3454 isn't a competing rule at all, it's a one-line fix to when an existing eviction trigger becomes reachable, and the PR's own A/B is explicit that the result was inconclusive. None of this is a problem with the PR as written, since it never claims to have run these comparisons itself, just that the tool could. Worth knowing before anyone takes a `sim::commit` or `sim::card` table as settling one of those PRs though. Tested: `cargo test -p victory-tiers --locked` (33 passed) and `cargo clippy -p victory-tiers --all-targets --locked -- -D warnings` (clean), both on Linux/x86_64 via WSL, matching the PR's own Windows results. That also confirms the crate's "no Direct3D, no game code, no OS calls" portability claim independently, for whatever that's worth to other forks.
fl4rion commented 2026-11-30 23:34:02 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fl4rion on 2026-11-30T23:34:02Z.


Thanks for running it independently and for reading the diff this closely. You're right on both counts.

VICTORY_WINDOW_GROW=1: fixed in fc7d3930. grown() now reports every window it makes to the tiers, except one that takes in the cell's existing window (a growth, not a remake, so it doesn't reset the hold). With growing on, the refault book keys a window by its 4 MiB cell: a regrown window rarely has the extent of the one dropped, and keyed by extent the remake still wouldn't have counted. There's a test that drops a grown window, makes a smaller one in the same cell, and checks that it counts as a refault and its hold goes up.

The benchmark: agreed. sim::commit looks at each rule once a simulated second, and its load is per second too, so a rule like send::trim's low-water mark degenerates and the harness's cap eviction gets the credit. A finer-grained replay would need a sub-second load model, which is more than this PR should take on. I've added that limit to the description and corrected "Checked for overlap": the commit model can't evaluate #3381/#3411 as they are, and the card model can't express #1562's block sizes or #3454's change to when eviction starts.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7295273605 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3723#issuecomment-7295273605). Originally posted by [fl4rion](https://github.com/fl4rion) on 2026-11-30T23:34:02Z. --- Thanks for running it independently and for reading the diff this closely. You're right on both counts. **`VICTORY_WINDOW_GROW=1`:** fixed in fc7d3930. `grown()` now reports every window it makes to the tiers, except one that takes in the cell's existing window (a growth, not a remake, so it doesn't reset the hold). With growing on, the refault book keys a window by its 4 MiB cell: a regrown window rarely has the extent of the one dropped, and keyed by extent the remake still wouldn't have counted. There's a test that drops a grown window, makes a smaller one in the same cell, and checks that it counts as a refault and its hold goes up. **The benchmark:** agreed. `sim::commit` looks at each rule once a simulated second, and its load is per second too, so a rule like `send::trim`'s low-water mark degenerates and the harness's cap eviction gets the credit. A finer-grained replay would need a sub-second load model, which is more than this PR should take on. I've added that limit to the description and corrected "Checked for overlap": the commit model can't evaluate #3381/#3411 as they are, and the card model can't express #1562's block sizes or #3454's change to when eviction starts.
fl4rion commented 2026-11-30 23:34:06 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fl4rion on 2026-11-30T23:34:06Z.


Thanks for the numbers. A 16 GB laptop with 21 GB of commit and under 6 GB resident is exactly the squeeze this is aimed at. To be clear about scope: this PR cuts the churn of rebuilding window copies under memory pressure, so it helps the stalls more than the frame rate. Your 50 ms frames are mostly CPU-side preparation (lists, descriptors, card copies), which this doesn't touch. The commit and copy footprint you mention is the next step we're working on.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7295274899 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3723#issuecomment-7295274899). Originally posted by [fl4rion](https://github.com/fl4rion) on 2026-11-30T23:34:06Z. --- Thanks for the numbers. A 16 GB laptop with 21 GB of commit and under 6 GB resident is exactly the squeeze this is aimed at. To be clear about scope: this PR cuts the churn of rebuilding window copies under memory pressure, so it helps the stalls more than the frame rate. Your 50 ms frames are mostly CPU-side preparation (lists, descriptors, card copies), which this doesn't touch. The commit and copy footprint you mention is the next step we're working on.
shurhundo commented 2026-12-01 02:37:40 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by shurhundo on 2026-12-01T02:37:40Z.


Flagging for awareness: #2910 (open) flips VICTORY_WINDOW_GROW on by default and reshapes grown()/grow_reach()/made_window()/buffer_sides() for its own memory-ledger/pooling work. It doesn't reference crate::tiers or this PR's grown_made()/tiers_key() fix (fc7d3930) at all. Once #2910's default flip lands, that fix here stops being opt-in-only coverage and becomes the default-path correctness for everyone, so the two will need a careful rebase against each other rather than landing independently.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7298819954 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3723#issuecomment-7298819954). Originally posted by [shurhundo](https://github.com/shurhundo) on 2026-12-01T02:37:40Z. --- Flagging for awareness: #2910 (open) flips `VICTORY_WINDOW_GROW` on by default and reshapes `grown()`/`grow_reach()`/`made_window()`/`buffer_sides()` for its own memory-ledger/pooling work. It doesn't reference `crate::tiers` or this PR's `grown_made()`/`tiers_key()` fix (fc7d3930) at all. Once #2910's default flip lands, that fix here stops being opt-in-only coverage and becomes the default-path correctness for everyone, so the two will need a careful rebase against each other rather than landing independently.
fl4rion commented 2026-12-01 05:14:26 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fl4rion on 2026-12-01T05:14:26Z.


@shurhundo Makes sense. fwiw, I'm in favor of not using flags for functionality that is objectively more performant/correct. Once your PR lands I can rebase mine and make sure it keeps working correctly.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7301562837 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3723#issuecomment-7301562837). Originally posted by [fl4rion](https://github.com/fl4rion) on 2026-12-01T05:14:26Z. --- @shurhundo Makes sense. fwiw, I'm in favor of not using flags for functionality that is objectively more performant/correct. Once your PR lands I can rebase mine and make sure it keeps working correctly.
trustno1-coder commented 2026-12-01 18:49:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:49:27Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321616720 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3723#issuecomment-7321616720). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:49:27Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!3723
No description provided.