perf: the texture pool keeps only the empty blocks that fit under the 85 % line (8 GB: -512 MB at the peak, no 640 MB churn) #550

Open
KainanP wants to merge 1 commit from upstream-pr/550 into main
KainanP commented 2026-11-27 21:00:59 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T21:00:59Z.


Change

The texture pool (victory-gpu pool.rs) keeps empty 64 MB blocks while the card is under a line, and makes 12 of them ahead of need (VICTORY_RIPE_BLOCKS). Since #564 that line is resource::room_percent() − 5: 80 % under the LowVram preset (VICTORY_TEXTURE_ROOM_PERCENT=85), 85 % by default. Below the line main keeps a flat 64 empty blocks (4 GiB), whatever room is left under it. So the 12 blocks made ahead (768 MB) land at once, even when the card is a few blocks short of the line.

On an 8 GB card that is the normal place to be: resource::room does not count the empty blocks, so the card's real use sits at the texture share plus the empty blocks. What happens then, measured below:

  • the made-ahead blocks take the card from 74 % to 86 % of its budget, past the 80 % line;
  • the next once-a-second look (pool::room) sees the card over the line and lets 10 of them go;
  • the look after sees room again and makes them anew.

That is 640 MB made and given back every two seconds. While the blocks are there the card is that much closer to its budget, which is where the system starts moving memory to the PC.

Now, below the line, the pool keeps the empty blocks it has plus as many more as fit under the line, between SPARE (2) and SPARE_KEPT (64). The blocks made ahead follow that count (Ripe::now already takes the smaller of 12 and it).

  • The count is made only under the pool's lock, from pool.empty().
  • If the lock is busy below the line, the look keeps the last count. Before LooperSalty's review, the last count was taken for the empty blocks and climbed back to 64.
  • If the lock is busy over the line or under memory pressure, the look still brings the count down to SPARE (akimfomin).
  • Staging reclamation is unchanged.

Nothing else changes:

  • On a card with room the pool still keeps up to 64 empty blocks and makes 12 ahead.
  • Over the line it still keeps 2.

Linked issue: Refs #549, the VRAM census of the base under LowVram that found it. The 8 GB numbers that motivated it are on VIctory #3505: RTX 4060 Laptop 8 GB, AnyXboxX main with the LowVram values, 6,559 → 7,145 MiB against a budget of about 6.4 GB.

Verification

RTX 4060 Laptop 8 GB (budget 7,188 MB) and Intel UHD; third_party/victory on main 132da615; CARGO_TARGET_DIR outside the tree.

Device check pool::tests::blocks_made_ahead_stay_under_the_line, run with VICTORY_TEXTURE_ROOM_PERCENT=85 (line 80 % = 5,750 MB). The test is ignored because it fills the card to the line minus 5 blocks with buffers of ours. It then tells the pool the room, as the host does once a second, and asks for 16 textures of 1 MiB after each of four looks. Three runs each, identical:

look 0 (told 5,388 MB) look 1 look 2 look 3 peak against the 80 % line
before (main's rule) 6,220 MB, 64 kept 5,580, 2 kept 6,220, 64 kept 5,580, 2 kept 6,220 MB (86 %) +469 MB → FAILED
after 5,708 MB, 4 kept 5,580, 2 kept 5,644, 3 kept 5,644, 3 kept 5,708 MB (79 %) under → ok

So −512 MB at the peak, and no block made and let go every other second.

cargo test -p victory-gpu --lib --release -- pool::tests            → the 6 rule tests ok (default room, line 85 %;
                                                                      and with VICTORY_TEXTURE_ROOM_PERCENT=85, line 80 %)
  (failing cases, run before the rebase on the same test logic:)
  empty_blocks_kept_fit_under_the_line with the flat-64 rule         → FAILED: left: 64, right: 4
  a_busy_pool_keeps_the_last_count with the earlier fallback         → FAILED: [8, 12, 16, … 60, 64, 64]
  a_busy_pool_over_the_line_comes_down_to_spare without the lowering → FAILED: [4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
cargo test -p victory-gpu --lib --release -- --test-threads=1 (RTX)  → 646 passed; 0 failed; 52 ignored on 4 of 5 full runs;
  one run failed watch::many_askers_tests::no_mapping_is_lost_between_askers (5/5 ok alone, watch.rs does not touch the pool)
VICTORY_D3D12_ADAPTER=Intel cargo test … -- shadow:: pool::          → 80 passed; 0 failed; 7 ignored
VICTORY_TEXTURE_ROOM_PERCENT=85 … --ignored --exact pool::tests::blocks_made_ahead_stay_under_the_line
  before → FAILED ×3: 469 MB over the line; after → ok ×3 (table above)
cargo clippy -p victory-gpu --all-targets --release                  → no warning in pool.rs (only those main has)
cargo xtask policy                                                   → asset policy: 377 files ok

Oracle and test data

The fixtures follow the effective line, line_percent() of the test process, through by_the_line(budget, n): the use sits n and a half blocks under the line, or n blocks over it.

Test What it checks
empty_blocks_kept_fit_under_the_line 4 blocks under the line on a 7,188 MB budget: 4 are kept. Empty blocks already there stay. The count never goes under SPARE, and the kept blocks plus the use stay under the line. Fails with main's rule.
a_busy_pool_keeps_the_last_count With the lock held, 16 looks below the line keep the last count (4). Fails with the earlier fallback, which took the count for the empty blocks.
a_busy_pool_over_the_line_comes_down_to_spare (akimfomin) With the lock held, five looks below the line then five over it give 4, 4, 4, 4, 4, 2, 2, 2, 2, 2. Fails without the busy-lock lowering.
a_12_gb_card_keeps_its_blocks_below_the_line Simulated 12 GB card: only spares is tested, with an assumed budget of 11,000 MB; no such card was at hand. With 4 GiB or more under the line the count is the old one. The blocks made ahead are the old ones while 768 MB fit. The count is never under the empty blocks there are. At line 80 % it differs from 4,720 MB in use, and the blocks made ahead from 8,048 MB. A native datapoint is asked on PortBridge#132.
empty_blocks_stay_while_the_card_has_room, spares_scales_with_room_target (from #564) Kept and adapted to the new count. At 1 GiB under the line #564's test now expects the 16 blocks that fit instead of 64.
blocks_made_ahead_stay_under_the_line (device, ignored) The before/after measurement above.

No test data from a title.

Not measured: a game run. What it can change in game is the card's use while textures stream in near the line, which should stay lower and steady. It does not change the frame time directly.

Checklist

  • The PR covers a single reviewable behaviour.
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success. (n/a)
  • README: no README change.
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: only the VRAM figures of VIctory #3505, as posted by their author.
  • Code taken from another project: none. Review points by LooperSalty (busy-lock count) and akimfomin (busy-lock lowering over the line, main's threshold for both branches, fixtures tied to the effective limit) are credited in the commit (Suggested-by: akimfomin).

AI use: made with Claude Code (Claude Opus 5.5): code reading, the census, the change, the tests and this description. The device checks were run on my RTX 4060 Laptop.

🤖 Generated with Claude Code

<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5533040725 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/550). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T21:00:59Z. --- ## Change The texture pool (`victory-gpu` `pool.rs`) keeps empty 64 MB blocks while the card is under a line, and makes 12 of them ahead of need (`VICTORY_RIPE_BLOCKS`). Since #564 that line is `resource::room_percent() − 5`: 80 % under the `LowVram` preset (`VICTORY_TEXTURE_ROOM_PERCENT=85`), 85 % by default. Below the line `main` keeps a flat 64 empty blocks (4 GiB), whatever room is left under it. So the 12 blocks made ahead (768 MB) land at once, even when the card is a few blocks short of the line. On an 8 GB card that is the normal place to be: `resource::room` does not count the empty blocks, so the card's real use sits at the texture share plus the empty blocks. What happens then, measured below: - the made-ahead blocks take the card from 74 % to 86 % of its budget, past the 80 % line; - the next once-a-second look (`pool::room`) sees the card over the line and lets 10 of them go; - the look after sees room again and makes them anew. That is 640 MB made and given back every two seconds. While the blocks are there the card is that much closer to its budget, which is where the system starts moving memory to the PC. Now, below the line, the pool keeps the empty blocks it has plus as many more as fit under the line, between `SPARE` (2) and `SPARE_KEPT` (64). The blocks made ahead follow that count (`Ripe::now` already takes the smaller of 12 and it). - The count is made only under the pool's lock, from `pool.empty()`. - If the lock is busy below the line, the look keeps the last count. Before LooperSalty's review, the last count was taken for the empty blocks and climbed back to 64. - If the lock is busy over the line or under memory pressure, the look still brings the count down to `SPARE` (akimfomin). - Staging reclamation is unchanged. Nothing else changes: - On a card with room the pool still keeps up to 64 empty blocks and makes 12 ahead. - Over the line it still keeps 2. Linked issue: Refs #549, the VRAM census of the base under `LowVram` that found it. The 8 GB numbers that motivated it are on [VIctory #3505](https://github.com/Marvisak/VIctory/issues/3505): RTX 4060 Laptop 8 GB, AnyXboxX main with the LowVram values, 6,559 → 7,145 MiB against a budget of about 6.4 GB. ## Verification RTX 4060 Laptop 8 GB (budget 7,188 MB) and Intel UHD; `third_party/victory` on main 132da615; `CARGO_TARGET_DIR` outside the tree. **Device check** `pool::tests::blocks_made_ahead_stay_under_the_line`, run with `VICTORY_TEXTURE_ROOM_PERCENT=85` (line 80 % = 5,750 MB). The test is ignored because it fills the card to the line minus 5 blocks with buffers of ours. It then tells the pool the room, as the host does once a second, and asks for 16 textures of 1 MiB after each of four looks. Three runs each, identical: | | look 0 (told 5,388 MB) | look 1 | look 2 | look 3 | peak | against the 80 % line | |---|---|---|---|---|---|---| | before (`main`'s rule) | 6,220 MB, 64 kept | 5,580, 2 kept | 6,220, 64 kept | 5,580, 2 kept | **6,220 MB (86 %)** | +469 MB → FAILED | | after | 5,708 MB, 4 kept | 5,580, 2 kept | 5,644, 3 kept | 5,644, 3 kept | **5,708 MB (79 %)** | under → ok | So −512 MB at the peak, and no block made and let go every other second. ``` cargo test -p victory-gpu --lib --release -- pool::tests → the 6 rule tests ok (default room, line 85 %; and with VICTORY_TEXTURE_ROOM_PERCENT=85, line 80 %) (failing cases, run before the rebase on the same test logic:) empty_blocks_kept_fit_under_the_line with the flat-64 rule → FAILED: left: 64, right: 4 a_busy_pool_keeps_the_last_count with the earlier fallback → FAILED: [8, 12, 16, … 60, 64, 64] a_busy_pool_over_the_line_comes_down_to_spare without the lowering → FAILED: [4, 4, 4, 4, 4, 4, 4, 4, 4, 4] cargo test -p victory-gpu --lib --release -- --test-threads=1 (RTX) → 646 passed; 0 failed; 52 ignored on 4 of 5 full runs; one run failed watch::many_askers_tests::no_mapping_is_lost_between_askers (5/5 ok alone, watch.rs does not touch the pool) VICTORY_D3D12_ADAPTER=Intel cargo test … -- shadow:: pool:: → 80 passed; 0 failed; 7 ignored VICTORY_TEXTURE_ROOM_PERCENT=85 … --ignored --exact pool::tests::blocks_made_ahead_stay_under_the_line before → FAILED ×3: 469 MB over the line; after → ok ×3 (table above) cargo clippy -p victory-gpu --all-targets --release → no warning in pool.rs (only those main has) cargo xtask policy → asset policy: 377 files ok ``` ## Oracle and test data The fixtures follow the effective line, `line_percent()` of the test process, through `by_the_line(budget, n)`: the use sits n and a half blocks under the line, or n blocks over it. | Test | What it checks | |---|---| | `empty_blocks_kept_fit_under_the_line` | 4 blocks under the line on a 7,188 MB budget: 4 are kept. Empty blocks already there stay. The count never goes under `SPARE`, and the kept blocks plus the use stay under the line. Fails with `main`'s rule. | | `a_busy_pool_keeps_the_last_count` | With the lock held, 16 looks below the line keep the last count (4). Fails with the earlier fallback, which took the count for the empty blocks. | | `a_busy_pool_over_the_line_comes_down_to_spare` (akimfomin) | With the lock held, five looks below the line then five over it give `4, 4, 4, 4, 4, 2, 2, 2, 2, 2`. Fails without the busy-lock lowering. | | `a_12_gb_card_keeps_its_blocks_below_the_line` | **Simulated** 12 GB card: only `spares` is tested, with an assumed budget of 11,000 MB; no such card was at hand. With 4 GiB or more under the line the count is the old one. The blocks made ahead are the old ones while 768 MB fit. The count is never under the empty blocks there are. At line 80 % it differs from 4,720 MB in use, and the blocks made ahead from 8,048 MB. A native datapoint is asked on PortBridge#132. | | `empty_blocks_stay_while_the_card_has_room`, `spares_scales_with_room_target` (from #564) | Kept and adapted to the new count. At 1 GiB under the line #564's test now expects the 16 blocks that fit instead of 64. | | `blocks_made_ahead_stay_under_the_line` (device, ignored) | The before/after measurement above. | No test data from a title. **Not measured:** a game run. What it can change in game is the card's use while textures stream in near the line, which should stay lower and steady. It does not change the frame time directly. ## Checklist - [x] The PR covers a single reviewable behaviour. - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. (n/a) - [x] README: no README change. - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: only the VRAM figures of VIctory #3505, as posted by their author. - [x] Code taken from another project: none. Review points by LooperSalty (busy-lock count) and akimfomin (busy-lock lowering over the line, main's threshold for both branches, fixtures tied to the effective limit) are credited in the commit (`Suggested-by: akimfomin`). _AI use: made with Claude Code (Claude Opus 5.5): code reading, the census, the change, the tests and this description. The device checks were run on my RTX 4060 Laptop._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LooperSalty commented 2026-11-27 21:24:03 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T21:24:03Z.


Thanks, the fit-under-the-line rule reads right and empty_blocks_kept_fit_under_the_line fails without it. One issue in pool.rs room() (line 47): when TEXTURES.try_lock() fails, empty falls back to SPARES.load(), which is the previous limit, not a count of empty blocks. The next limit is then computed from it, so under repeated contention the limit can climb back toward SPARE_KEPT, which undoes the fix. On a busy lock, please keep the last limit unchanged (skip the update this tick) instead of feeding it back in as empty. Since this changes the default on every card, a check on a 12 GB card that the limit stays at its old value below the line would also help.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7228409980 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/550#issuecomment-7228409980). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-27T21:24:03Z. --- Thanks, the fit-under-the-line rule reads right and `empty_blocks_kept_fit_under_the_line` fails without it. One issue in `pool.rs` `room()` (line 47): when `TEXTURES.try_lock()` fails, `empty` falls back to `SPARES.load()`, which is the previous *limit*, not a count of empty blocks. The next limit is then computed from it, so under repeated contention the limit can climb back toward `SPARE_KEPT`, which undoes the fix. On a busy lock, please keep the last limit unchanged (skip the update this tick) instead of feeding it back in as `empty`. Since this changes the default on every card, a check on a 12 GB card that the limit stays at its old value below the line would also help.
akimfomin commented 2026-11-27 23:02:14 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by akimfomin on 2026-11-27T23:02:14Z.


I replayed LooperSalty's lock-contention case with the policy at a088a1c. At a 7,188 MiB budget and a fixed use of 5,822 MiB, four busy ticks turn an allowed limit of 4 into 8 → 12 → 16 → 20, even if no empty block was created.

A useful boundary for the correction: a busy lock can hold the last limit below the line, but it should still be able to lower the limit when the process crosses 85% or pressure is active. Those branches already know they want 2 without inspecting the pool. Keep staging reclamation on its existing separate path. With that rule, the arithmetic control gives 4 → 4 → 4 → 4 → 4 below the line and 4 → 2 → 2 → 2 → 2 after crossing it. The roomy 12 GiB control (6 GiB used) still allows 64 blocks, while at 80% only 9 additional empty blocks fit. That last pair is an arithmetic check and still needs the physical check requested above.

PortBridge modeled the public code with Codex. This is a deterministic policy check, with no new GPU or in-game run.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7229819508 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/550#issuecomment-7229819508). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-27T23:02:14Z. --- I replayed LooperSalty's lock-contention case with the [policy at `a088a1c`](https://github.com/LooperSalty/AnyXboxX/blob/a088a1c4675574bc2d3f949c504fd41c8690ea77/third_party/victory/crates/victory-gpu/src/pool.rs#L44-L89). At a 7,188 MiB budget and a fixed use of 5,822 MiB, four busy ticks turn an allowed limit of 4 into **8 → 12 → 16 → 20**, even if no empty block was created. A useful boundary for the correction: a busy lock can hold the last limit below the line, but it should still be able to lower the limit when the process crosses 85% or pressure is active. Those branches already know they want 2 without inspecting the pool. Keep staging reclamation on its existing separate path. With that rule, the arithmetic control gives **4 → 4 → 4 → 4 → 4** below the line and **4 → 2 → 2 → 2 → 2** after crossing it. The roomy 12 GiB control (6 GiB used) still allows 64 blocks, while at 80% only 9 additional empty blocks fit. That last pair is an arithmetic check and still needs the physical check requested above. [PortBridge](https://github.com/akimfomin/PortBridge) modeled the public code with Codex. This is a deterministic policy check, with no new GPU or in-game run.
KainanP commented 2026-11-27 23:14:59 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T23:14:59Z.


Merci, bien vu : c'était exactement ça. Corrigé dans 0ea1c912 (poussé sur la même branche).

Correctif. room() ne calcule plus la limite que sous le verrou de TEXTURES, à partir de pool.empty(). Si le verrou est pris, ce passage ne change rien : SPARES garde la valeur du passage précédent, et le suivant (une seconde plus tard) la recalcule. Le pool de staging est toujours repris avec cette dernière limite. La limite n'est donc plus jamais réinjectée comme nombre de blocs vides.

Test qui échoue sur l'ancienne tête (a088a1c4). pool::tests::a_busy_pool_keeps_the_last_count tient le verrou du pool et met SPARES à 4. Le budget est de 7 188 MB à 81 % (4 blocs tiennent sous la ligne des 85 %). Il appelle ensuite room() 16 fois.

  • avec l'ancien room() : FAILED, compte à chaque passage [8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 64], soit la remontée jusqu'à SPARE_KEPT que tu décrivais ;
  • avec le correctif : ok, 4 à chaque passage.

Carte de 12 Go : SIMULÉE. Je n'ai pas de carte de 12 Go. pool::tests::a_12_gb_card_keeps_its_blocks_below_the_line teste seulement le calcul (spares), avec un budget de 11 000 MB supposé, soit à peu près ce que le système donne à une telle carte en jeu. Pour chaque utilisation de 0 à la ligne (9 350 MB, par pas de 16 MB) et 0, 3, 12, 40 ou 64 blocs déjà vides, il compare à l'ancienne règle (64 sous 85 %, sinon 2). Réponse franche : la limite ne reste pas partout à son ancienne valeur, mais ce que fait le pool, si, sauf près de la ligne.

  • La limite vaut l'ancienne (64) tant que 4 Gio tiennent sous la ligne, c'est-à-dire jusqu'à 5 264 MB utilisés (48 % du budget). Au-delà, elle vaut vides + ce qui tient, donc moins que 64.
  • Elle n'est jamais inférieure au nombre de blocs vides présents. Aucun bloc vide que l'ancienne règle gardait n'est donc lâché au moment du passage sous la ligne.
  • Les blocs faits d'avance (min(12, limite)) sont les mêmes qu'avant tant que 768 MB tiennent sous la ligne, soit jusqu'à 8 592 MB utilisés (78 %). Au-delà, il y en a moins : c'est le correctif lui-même.
  • Une différence reste, et je préfère la dire : entre 48 % et 85 %, si plus de textures que vides + ce qui tient partent dans la même seconde, les blocs vidés au-delà de la limite sont lâchés au lieu d'être gardés (l'ancienne règle en gardait jusqu'à 64). Ils redeviennent des blocs à refaire si des textures reviennent.

Une vérification sur une vraie carte de 12 Go reste à faire. Si quelqu'un en a une, pool::tests::blocks_made_ahead_stay_under_the_line (ignoré) donne la mesure en une seconde.

Vérifications (RTX 4060 Laptop 8 Go, Intel UHD) :

cargo test -p victory-gpu --lib --release -- pool::tests::a_busy_pool_keeps_the_last_count
  ancien room() (a088a1c4) → FAILED : [8, 12, 16, … 60, 64, 64] ; 0ea1c912 → ok
cargo test -p victory-gpu --lib --release -- --test-threads=1            → 486 passed; 0 failed; 45 ignored (RTX)
VICTORY_D3D12_ADAPTER=Intel cargo test … -- shadow:: pool::              → 59 passed; 0 failed; 4 ignored (Intel UHD)
cargo test … -- --ignored --exact pool::tests::blocks_made_ahead_stay_under_the_line (×3)
  → ok ×3 : carte remplie à 5 772 MB (80 %), pic 5 964 MB (82 %), ligne 6 109 MB, limite stable sur les 4 passages
cargo clippy -p victory-gpu --all-targets --release                      → les 2 avertissements déjà sur main (overlay.rs, draw.rs)
cargo xtask policy                                                       → asset policy: 306 files ok
ANYXBOXX_REQUIRE_RUNTIME=1 python -m pytest -n auto                      → 1979 passed
python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools    → All checks passed!
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7229991999 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/550#issuecomment-7229991999). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T23:14:59Z. --- Merci, bien vu : c'était exactement ça. Corrigé dans 0ea1c912 (poussé sur la même branche). **Correctif.** `room()` ne calcule plus la limite que sous le verrou de `TEXTURES`, à partir de `pool.empty()`. Si le verrou est pris, ce passage ne change rien : `SPARES` garde la valeur du passage précédent, et le suivant (une seconde plus tard) la recalcule. Le pool de staging est toujours repris avec cette dernière limite. La limite n'est donc plus jamais réinjectée comme nombre de blocs vides. **Test qui échoue sur l'ancienne tête (a088a1c4).** `pool::tests::a_busy_pool_keeps_the_last_count` tient le verrou du pool et met `SPARES` à 4. Le budget est de 7 188 MB à 81 % (4 blocs tiennent sous la ligne des 85 %). Il appelle ensuite `room()` 16 fois. - avec l'ancien `room()` : `FAILED`, compte à chaque passage `[8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 64]`, soit la remontée jusqu'à `SPARE_KEPT` que tu décrivais ; - avec le correctif : `ok`, 4 à chaque passage. **Carte de 12 Go : SIMULÉE.** Je n'ai pas de carte de 12 Go. `pool::tests::a_12_gb_card_keeps_its_blocks_below_the_line` teste seulement le calcul (`spares`), avec un budget de 11 000 MB supposé, soit à peu près ce que le système donne à une telle carte en jeu. Pour chaque utilisation de 0 à la ligne (9 350 MB, par pas de 16 MB) et 0, 3, 12, 40 ou 64 blocs déjà vides, il compare à l'ancienne règle (64 sous 85 %, sinon 2). Réponse franche : **la limite ne reste pas partout à son ancienne valeur, mais ce que fait le pool, si, sauf près de la ligne.** - La limite vaut l'ancienne (64) tant que 4 Gio tiennent sous la ligne, c'est-à-dire jusqu'à **5 264 MB** utilisés (48 % du budget). Au-delà, elle vaut `vides + ce qui tient`, donc moins que 64. - Elle n'est jamais inférieure au nombre de blocs vides présents. Aucun bloc vide que l'ancienne règle gardait n'est donc lâché au moment du passage sous la ligne. - Les blocs faits d'avance (`min(12, limite)`) sont les mêmes qu'avant tant que 768 MB tiennent sous la ligne, soit jusqu'à **8 592 MB** utilisés (78 %). Au-delà, il y en a moins : c'est le correctif lui-même. - Une différence reste, et je préfère la dire : entre 48 % et 85 %, si plus de textures que `vides + ce qui tient` partent dans la même seconde, les blocs vidés au-delà de la limite sont lâchés au lieu d'être gardés (l'ancienne règle en gardait jusqu'à 64). Ils redeviennent des blocs à refaire si des textures reviennent. Une vérification sur une vraie carte de 12 Go reste à faire. Si quelqu'un en a une, `pool::tests::blocks_made_ahead_stay_under_the_line` (ignoré) donne la mesure en une seconde. **Vérifications** (RTX 4060 Laptop 8 Go, Intel UHD) : ``` cargo test -p victory-gpu --lib --release -- pool::tests::a_busy_pool_keeps_the_last_count ancien room() (a088a1c4) → FAILED : [8, 12, 16, … 60, 64, 64] ; 0ea1c912 → ok cargo test -p victory-gpu --lib --release -- --test-threads=1 → 486 passed; 0 failed; 45 ignored (RTX) VICTORY_D3D12_ADAPTER=Intel cargo test … -- shadow:: pool:: → 59 passed; 0 failed; 4 ignored (Intel UHD) cargo test … -- --ignored --exact pool::tests::blocks_made_ahead_stay_under_the_line (×3) → ok ×3 : carte remplie à 5 772 MB (80 %), pic 5 964 MB (82 %), ligne 6 109 MB, limite stable sur les 4 passages cargo clippy -p victory-gpu --all-targets --release → les 2 avertissements déjà sur main (overlay.rs, draw.rs) cargo xtask policy → asset policy: 306 files ok ANYXBOXX_REQUIRE_RUNTIME=1 python -m pytest -n auto → 1979 passed python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools → All checks passed! ```
KainanP commented 2026-11-27 23:21:56 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T23:21:56Z.


@akimfomin merci, tu as raison : 0ea1c912 gardait la dernière limite sur tout passage où le verrou était pris, même une fois la carte passée au-dessus de 85 % ou sous pression mémoire. Une limite de 64 pouvait alors rester tant qu'aucun passage ne trouvait le verrou libre.

Corrigé dans 4d8fb188 avec ta règle :

  • Verrou pris, au-dessus de la ligne ou sous pression : la limite passe à SPARE (2), ce qui ne demande rien au pool. L'allocateur lâche les blocs en trop à sa prochaine prise de morceau.
  • Verrou pris, sous la ligne : la dernière limite est gardée, comme demandé par LooperSalty.
  • Pool de staging : il est repris sur son chemin séparé, sans changement.

Test pool::tests::a_busy_pool_over_the_line_comes_down_to_spare (verrou tenu, limite à 4, cinq passages à 81 % puis cinq à 90 %) :

  • sur 0ea1c912 : FAILED, [4, 4, 4, 4, 4, 4, 4, 4, 4, 4] ;
  • avec 4d8fb188 : [4, 4, 4, 4, 4, 2, 2, 2, 2, 2], ta séquence.

Les deux tests de verrou pris attendent maintenant 2 sous la ligne si la machine est sous pression mémoire au moment du test. Sinon ils échoueraient pour une autre raison que celle qu'ils testent.

cargo test -p victory-gpu --lib --release -- pool::tests                 → les 5 tests de règle passent (verrou pris ×2, 12 Go simulé, ligne ×2)
cargo test -p victory-gpu --lib --release -- --test-threads=1            → 487 passed; 0 failed; 45 ignored (RTX 4060 Laptop)
VICTORY_D3D12_ADAPTER=Intel … -- shadow:: pool::                         → 60 passed; 0 failed; 4 ignored (Intel UHD)
… --ignored --exact pool::tests::blocks_made_ahead_stay_under_the_line   → ok : rempli à 5 772 MB (80 %), pic 5 964 MB (82 %), ligne 6 109 MB
cargo clippy -p victory-gpu --all-targets --release                      → les 2 avertissements déjà sur main
cargo xtask policy                                                       → asset policy: 306 files ok
<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7230084159 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/550#issuecomment-7230084159). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T23:21:56Z. --- @akimfomin merci, tu as raison : 0ea1c912 gardait la dernière limite sur tout passage où le verrou était pris, même une fois la carte passée au-dessus de 85 % ou sous pression mémoire. Une limite de 64 pouvait alors rester tant qu'aucun passage ne trouvait le verrou libre. Corrigé dans 4d8fb188 avec ta règle : - **Verrou pris, au-dessus de la ligne ou sous pression :** la limite passe à `SPARE` (2), ce qui ne demande rien au pool. L'allocateur lâche les blocs en trop à sa prochaine prise de morceau. - **Verrou pris, sous la ligne :** la dernière limite est gardée, comme demandé par LooperSalty. - **Pool de staging :** il est repris sur son chemin séparé, sans changement. Test `pool::tests::a_busy_pool_over_the_line_comes_down_to_spare` (verrou tenu, limite à 4, cinq passages à 81 % puis cinq à 90 %) : - **sur 0ea1c912 :** `FAILED`, `[4, 4, 4, 4, 4, 4, 4, 4, 4, 4]` ; - **avec 4d8fb188 :** `[4, 4, 4, 4, 4, 2, 2, 2, 2, 2]`, ta séquence. Les deux tests de verrou pris attendent maintenant 2 sous la ligne si la machine est sous pression mémoire au moment du test. Sinon ils échoueraient pour une autre raison que celle qu'ils testent. ``` cargo test -p victory-gpu --lib --release -- pool::tests → les 5 tests de règle passent (verrou pris ×2, 12 Go simulé, ligne ×2) cargo test -p victory-gpu --lib --release -- --test-threads=1 → 487 passed; 0 failed; 45 ignored (RTX 4060 Laptop) VICTORY_D3D12_ADAPTER=Intel … -- shadow:: pool:: → 60 passed; 0 failed; 4 ignored (Intel UHD) … --ignored --exact pool::tests::blocks_made_ahead_stay_under_the_line → ok : rempli à 5 772 MB (80 %), pic 5 964 MB (82 %), ligne 6 109 MB cargo clippy -p victory-gpu --all-targets --release → les 2 avertissements déjà sur main cargo xtask policy → asset policy: 306 files ok ```
akimfomin commented 2026-11-28 00:00:35 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by akimfomin on 2026-11-28T00:00:35Z.


I checked 4d8fb188 against current main 4079f2b. There's one conflict, in pool.rs. Main now derives the threshold from resource::room_percent().saturating_sub(5). On rebase, use that same threshold for both the real empty-count branch and the busy-lock lowering branch. The hardware test currently fills to 81%, so at a configured room of 85% that fill would already be over the new 80% threshold. A fixture tied to the effective limit would still exercise the intended below-line case.

I opened one PortBridge Test Lab request for the missing native 12 GB datapoint. It names your existing fixture and keeps the current head separate from the rebased result. Your 8 GB result and the new busy-lock tests are already recorded.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7230573166 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/550#issuecomment-7230573166). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-28T00:00:35Z. --- I checked `4d8fb188` against current main [`4079f2b`](https://github.com/LooperSalty/AnyXboxX/commit/4079f2b50b073935a8c64bf575b15f87ec91989b). There's one conflict, in [`pool.rs`](https://github.com/LooperSalty/AnyXboxX/blob/4079f2b50b073935a8c64bf575b15f87ec91989b/third_party/victory/crates/victory-gpu/src/pool.rs#L44-L76). Main now derives the threshold from `resource::room_percent().saturating_sub(5)`. On rebase, use that same threshold for both the real empty-count branch and the busy-lock lowering branch. The hardware test currently fills to 81%, so at a configured room of 85% that fill would already be over the new 80% threshold. A fixture tied to the effective limit would still exercise the intended below-line case. I opened one [PortBridge Test Lab request](https://github.com/akimfomin/PortBridge/issues/132) for the missing native 12 GB datapoint. It names your existing fixture and keeps the current head separate from the rebased result. Your 8 GB result and the new busy-lock tests are already recorded.
LooperSalty commented 2026-11-28 00:15:37 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-28T00:15:37Z.


Main just took #563 (the VIctory copy moved to Vice-Tay 4f15f09e) and #564 (memory stack), and this PR now conflicts in third_party/victory/crates/victory-gpu/src/pool.rs. Please rebase on current main, rerun the tests for the files you touch, and force-push. (akimfomin's note on the pool.rs conflict above applies.)

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7230772900 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/550#issuecomment-7230772900). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-28T00:15:37Z. --- Main just took #563 (the VIctory copy moved to Vice-Tay `4f15f09e`) and #564 (memory stack), and this PR now conflicts in `third_party/victory/crates/victory-gpu/src/pool.rs`. Please rebase on current main, rerun the tests for the files you touch, and force-push. (akimfomin's note on the `pool.rs` conflict above applies.)
KainanP commented 2026-11-28 00:32:45 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-28T00:32:45Z.


Rebasée sur main (132da615, avec #563 et #564) : b45603a0. J'ai réuni les trois commits en un seul, puisque room() et spares() étaient réécrits des deux côtés. Les crédits sont dans le message de commit. Merci @akimfomin pour les deux indications, je les ai appliquées toutes les deux.

Seuil de main, pour les deux branches. line_percent() = resource::room_percent().saturating_sub(5), comme dans #564, soit 80 % avec le préréglage 8 Go. Ce même seuil sert :

  • au compte réel sous le verrou (spares_for(memory, keep, pool.empty(), line), vides + ce qui tient sous la ligne) ;
  • à l'abaissement à SPARE quand le verrou est pris (below_line(memory, keep, line)).

Le pool de staging reste sur son chemin séparé, sans changement.

Ce que #564 a changé dans le pool. Seulement le seuil (85 → room_percent − 5), plus l'argument first_attempt de texture(). Rien n'y remplace la règle de cette PR : sous le seuil, main garde toujours 64 blocs vides quelle que soit la place restante. La PR reste donc nécessaire, avec ce nouveau seuil. J'ai adapté spares_scales_with_room_target (le test de #564) à la nouvelle signature. À 1 Gio sous la ligne il attend maintenant les 16 blocs qui tiennent, au lieu de 64. Les autres cas sont inchangés.

Fixtures liées à la limite effective. Elles suivent line_percent() du processus de test au lieu d'un 81 % fixe :

  • unitaires : by_the_line(budget, n) place l'utilisation à n blocs et demi sous la ligne, ou n blocs au-dessus ;
  • test matériel ignoré : il remplit la carte jusqu'à la ligne moins 5 blocs.

Le cas « sous la ligne » reste donc sous la ligne quel que soit VICTORY_TEXTURE_ROOM_PERCENT.

Résultats (RTX 4060 Laptop 8 Go, Intel UHD) :

cargo test -p victory-gpu --lib --release -- pool::tests                 → 6 tests de règle : ok (seuil 85 % par défaut, et ok aussi avec VICTORY_TEXTURE_ROOM_PERCENT=85, seuil 80 %)
  12 Go simulé, seuil 80 % : le compte diffère de l'ancien à partir de 4 720 MB utilisés, les blocs faits d'avance à partir de 8 048 MB
cargo test -p victory-gpu --lib --release -- --test-threads=1 (RTX)      → 646 passed; 0 failed; 52 ignored sur 4 des 5 passes
  1 passe : watch::many_askers_tests::no_mapping_is_lost_between_askers FAILED (assertion published(at, end), watch.rs:5963) ;
  seul, 5/5 ok ; watch.rs ne touche pas au pool. Sur main (pool.rs de main), 2 passes complètes : 642 passed, 0 failed. Je le note sans pouvoir l'attribuer.
VICTORY_D3D12_ADAPTER=Intel … -- shadow:: pool::                         → 80 passed; 0 failed; 7 ignored (Intel UHD)
VICTORY_TEXTURE_ROOM_PERCENT=85 … --ignored --exact pool::tests::blocks_made_ahead_stay_under_the_line (×3 chacun)
  avant (règle de main) → FAILED ×3 : rempli à 5 388 MB (74 %), pic 6 220 MB (86 %), 469 MB au-dessus de la ligne (80 % = 5 750 MB), 64 ↔ 2 blocs gardés un passage sur deux
  après                 → ok ×3 : pic 5 708 MB (79 %), 4 → 2 → 3 → 3 blocs gardés, stable  (−512 MB au pic)
cargo clippy -p victory-gpu --all-targets --release                      → aucun avertissement dans pool.rs (ceux de main seulement)
cargo xtask policy                                                       → asset policy: 377 files ok

La carte de 12 Go reste simulée : seul le calcul est testé, avec un budget supposé de 11 000 MB (a_12_gb_card_keeps_its_blocks_below_the_line). Merci aussi pour PortBridge#132 : une mesure native sur 12 Go dira si ce budget supposé est le bon.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7230999315 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/550#issuecomment-7230999315). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-28T00:32:45Z. --- Rebasée sur `main` (132da615, avec #563 et #564) : **b45603a0**. J'ai réuni les trois commits en un seul, puisque `room()` et `spares()` étaient réécrits des deux côtés. Les crédits sont dans le message de commit. Merci @akimfomin pour les deux indications, je les ai appliquées toutes les deux. **Seuil de `main`, pour les deux branches.** `line_percent()` = `resource::room_percent().saturating_sub(5)`, comme dans #564, soit 80 % avec le préréglage 8 Go. Ce même seuil sert : - au compte réel sous le verrou (`spares_for(memory, keep, pool.empty(), line)`, vides + ce qui tient sous la ligne) ; - à l'abaissement à `SPARE` quand le verrou est pris (`below_line(memory, keep, line)`). Le pool de staging reste sur son chemin séparé, sans changement. **Ce que #564 a changé dans le pool.** Seulement le seuil (85 → `room_percent − 5`), plus l'argument `first_attempt` de `texture()`. Rien n'y remplace la règle de cette PR : sous le seuil, `main` garde toujours 64 blocs vides quelle que soit la place restante. La PR reste donc nécessaire, avec ce nouveau seuil. J'ai adapté `spares_scales_with_room_target` (le test de #564) à la nouvelle signature. À 1 Gio sous la ligne il attend maintenant les 16 blocs qui tiennent, au lieu de 64. Les autres cas sont inchangés. **Fixtures liées à la limite effective.** Elles suivent `line_percent()` du processus de test au lieu d'un 81 % fixe : - unitaires : `by_the_line(budget, n)` place l'utilisation à n blocs et demi sous la ligne, ou n blocs au-dessus ; - test matériel ignoré : il remplit la carte jusqu'à la ligne moins 5 blocs. Le cas « sous la ligne » reste donc sous la ligne quel que soit `VICTORY_TEXTURE_ROOM_PERCENT`. **Résultats** (RTX 4060 Laptop 8 Go, Intel UHD) : ``` cargo test -p victory-gpu --lib --release -- pool::tests → 6 tests de règle : ok (seuil 85 % par défaut, et ok aussi avec VICTORY_TEXTURE_ROOM_PERCENT=85, seuil 80 %) 12 Go simulé, seuil 80 % : le compte diffère de l'ancien à partir de 4 720 MB utilisés, les blocs faits d'avance à partir de 8 048 MB cargo test -p victory-gpu --lib --release -- --test-threads=1 (RTX) → 646 passed; 0 failed; 52 ignored sur 4 des 5 passes 1 passe : watch::many_askers_tests::no_mapping_is_lost_between_askers FAILED (assertion published(at, end), watch.rs:5963) ; seul, 5/5 ok ; watch.rs ne touche pas au pool. Sur main (pool.rs de main), 2 passes complètes : 642 passed, 0 failed. Je le note sans pouvoir l'attribuer. VICTORY_D3D12_ADAPTER=Intel … -- shadow:: pool:: → 80 passed; 0 failed; 7 ignored (Intel UHD) VICTORY_TEXTURE_ROOM_PERCENT=85 … --ignored --exact pool::tests::blocks_made_ahead_stay_under_the_line (×3 chacun) avant (règle de main) → FAILED ×3 : rempli à 5 388 MB (74 %), pic 6 220 MB (86 %), 469 MB au-dessus de la ligne (80 % = 5 750 MB), 64 ↔ 2 blocs gardés un passage sur deux après → ok ×3 : pic 5 708 MB (79 %), 4 → 2 → 3 → 3 blocs gardés, stable (−512 MB au pic) cargo clippy -p victory-gpu --all-targets --release → aucun avertissement dans pool.rs (ceux de main seulement) cargo xtask policy → asset policy: 377 files ok ``` La carte de 12 Go reste **simulée** : seul le calcul est testé, avec un budget supposé de 11 000 MB (`a_12_gb_card_keeps_its_blocks_below_the_line`). Merci aussi pour PortBridge#132 : une mesure native sur 12 Go dira si ce budget supposé est le bon.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/550:upstream-pr/550'
git switch 'upstream-pr/550'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/550'
git switch 'upstream-pr/550'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/550'
git switch 'upstream-pr/550'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/550'
git switch 'main'
git merge --squash 'upstream-pr/550'
git switch 'main'
git merge --ff-only 'upstream-pr/550'
git switch 'main'
git merge 'upstream-pr/550'
git push origin 'main'
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
LooperSalty/AnyXboxX!550
No description provided.