fix(gpu): P0 stability fixes for 8 GiB VRAM cards (RTX 3060 Ti) #2929

Closed
xVegetax wants to merge 4 commits from upstream-pr/2929 into main
xVegetax commented 2026-12-01 19:18:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by xVegetax on 2026-12-01T19:18:57Z.


Claimed in the coordination issue as: n/a

Depends on: none

Fixes: none

What and why

P0.1 — VRAM guard (pool.rs): refuse new 64 MiB texture heaps when
used + BLOCK > budget × 95%. Prevents over-budget MakeResident delays
(up to 961 ms) and device losses on 8 GiB cards at ~7–9 min.
Configurable via LEONIDA_VRAM_GUARD_PCT (80–99, default 95).

P0.2 — Pipeline stack (pipeline/make.rs): give each pipeline worker
64 MiB stack instead of OS default 2 MiB. nvgpucomp64.dll overflows
at ~7 min on Ampere/Wave32 (RTX 3060 Ti). Matches upstream PR #2588.
Configurable via LEONIDA_PIPELINE_STACK_MIB (2–256, default 64).

Tested

GPUs tested: NVIDIA RTX 3060 Ti, 8 GiB VRAM, Windows 11

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5592783017 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929). Originally posted by [xVegetax](https://github.com/xVegetax) on 2026-12-01T19:18:57Z. --- Claimed in the coordination issue as: n/a Depends on: none Fixes: none ### What and why **P0.1 — VRAM guard** (`pool.rs`): refuse new 64 MiB texture heaps when `used + BLOCK > budget × 95%`. Prevents over-budget MakeResident delays (up to 961 ms) and device losses on 8 GiB cards at ~7–9 min. Configurable via `LEONIDA_VRAM_GUARD_PCT` (80–99, default 95). **P0.2 — Pipeline stack** (`pipeline/make.rs`): give each pipeline worker 64 MiB stack instead of OS default 2 MiB. `nvgpucomp64.dll` overflows at ~7 min on Ampere/Wave32 (RTX 3060 Ti). Matches upstream PR #2588. Configurable via `LEONIDA_PIPELINE_STACK_MIB` (2–256, default 64). ### Tested GPUs tested: NVIDIA RTX 3060 Ti, 8 GiB VRAM, Windows 11 AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
KelboLive commented 2026-12-01 19:46:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T19:46:25Z.

Review: CHANGES_REQUESTED


Two P0s, two different problems, and neither one does what the title says on its own.

P0.2 (pipeline stack) duplicates open #2588, which already gives pipeline workers a 64 MiB stack and adds a GetCurrentThreadStackLimits test plus a Wine guard. Please drop this half and land #2588 instead — 18 workers × 64 MiB is ~1.1 GiB committed under Wine, which is exactly what #2588's guard avoids.

P0.1 (VRAM guard) does not cap VRAM. A refused block falls straight through to a per-texture committed allocation of the same resource (pool.rs:896-898 → resource.rs:3329, via the miss at :3294-3306), so the bytes are still spent and peak is unchanged — only the allocation path changes. Worse, VRAM_USED is written only in room() (pool.rs:50-52), called once a second from sweep() (host.rs:518-532), and is not incremented when a block is approved: between samples the guard re-approves against the same stale value, so one interval can create many 64 MiB blocks past 95 %. Staging (pool.rs:676), small, shadow/targets and buffers are ungated entirely. And LEONIDA_SWEEP=0 or a failed DXGI query leaves VRAM_BUDGET == 0, silently disabling it.

Neither change targets the failure mode we measured on this machine: the device removal is a driver-requested adapter PnP stop, not memory exhaustion — LEONIDA_D3D12_BACKGROUND=0 roughly doubles survival, while a 95 % threshold and a bigger thread stack do not address it. That does not mean the PR is wrong, but "P0 stability fixes for 8 GiB cards" needs an A/B run (or logs) showing which failure it removes; the 7–9 minute result is one card and two confounded changes.

Two concrete gaps:

  • No test covers vram_block_refused: disabling its decision leaves all 17 pool tests green. A pure threshold test (like spares()) would pin it.
  • d3d12/docs/switches.md was not regenerated: tools/d3d12_switches.py --check reports LEONIDA_PIPELINE_STACK_MIB and LEONIDA_VRAM_GUARD_PCT missing. Run --out before merge.

No image-quality risk in the fallback (identical D3D12_RESOURCE_DESC), and larger cards are safe; the real cost is that a card legitimately near budget abandons the pool it exists to use, with growth_failed throttling retries for 500 ms, so expect stutter rather than reuse at the margin. Merge is textually clean, and #2900/#2851 raise title allocations, which would push this guard into that fallback sooner.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6138775061 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929#pullrequestreview-6138775061). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T19:46:25Z. **Review:** CHANGES_REQUESTED --- Two P0s, two different problems, and neither one does what the title says on its own. **P0.2 (pipeline stack) duplicates open #2588**, which already gives pipeline workers a 64 MiB stack and adds a `GetCurrentThreadStackLimits` test plus a Wine guard. Please drop this half and land #2588 instead — 18 workers × 64 MiB is ~1.1 GiB *committed* under Wine, which is exactly what #2588's guard avoids. **P0.1 (VRAM guard) does not cap VRAM.** A refused block falls straight through to a per-texture **committed** allocation of the same resource (`pool.rs:896-898` → `resource.rs:3329`, via the miss at `:3294-3306`), so the bytes are still spent and peak is unchanged — only the allocation path changes. Worse, `VRAM_USED` is written only in `room()` (`pool.rs:50-52`), called once a second from `sweep()` (`host.rs:518-532`), and is **not incremented when a block is approved**: between samples the guard re-approves against the same stale value, so one interval can create many 64 MiB blocks past 95 %. Staging (`pool.rs:676`), `small`, shadow/targets and buffers are ungated entirely. And `LEONIDA_SWEEP=0` or a failed DXGI query leaves `VRAM_BUDGET == 0`, silently disabling it. Neither change targets the failure mode we measured on this machine: the device removal is a **driver-requested adapter PnP stop**, not memory exhaustion — `LEONIDA_D3D12_BACKGROUND=0` roughly doubles survival, while a 95 % threshold and a bigger thread stack do not address it. That does not mean the PR is wrong, but "P0 stability fixes for 8 GiB cards" needs an A/B run (or logs) showing which failure it removes; the 7–9 minute result is one card and two confounded changes. Two concrete gaps: - **No test covers `vram_block_refused`**: disabling its decision leaves all 17 pool tests green. A pure threshold test (like `spares()`) would pin it. - **`d3d12/docs/switches.md` was not regenerated**: `tools/d3d12_switches.py --check` reports `LEONIDA_PIPELINE_STACK_MIB` and `LEONIDA_VRAM_GUARD_PCT` missing. Run `--out` before merge. No image-quality risk in the fallback (identical `D3D12_RESOURCE_DESC`), and larger cards are safe; the real cost is that a card legitimately near budget abandons the pool it exists to use, with `growth_failed` throttling retries for 500 ms, so expect stutter rather than reuse at the margin. Merge is textually clean, and #2900/#2851 raise title allocations, which would push this guard into that fallback sooner.
OreoFR commented 2026-12-01 19:48:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T19:48:21Z.


Thanks for looking at 8 GiB cards, that's a real problem (I test on an RTX 4070 Laptop 8 GB). A review before anyone can merge this, read from the diff on head 51818b7ea; no build or run yet:

  1. Claim. The PR says "n/a"; the project asks for a claim in the coordination issue (#2570) before a PR, with an item ID in the title.
  2. One topic per PR. The VRAM guard and the pipeline worker stack are two changes; please split them.
  3. The stack part duplicates #2588 (open, same 64 MB stack for the pipeline workers, another author). Better to help that one land (it has review questions waiting) than to carry a second copy.
  4. The VRAM guard may not save VRAM. When vram_block_refused() makes the block maker return None, texture_with_cast returns None, and the caller in resource.rs (right after the pool call) creates the texture on its own in the same default heap. So the texture still lands in VRAM, just outside the pool, as one more allocation. Could you show a before/after measurement (VRAM use, MakeResident stalls, time to a device loss) with the guard on and off in one run (LEONIDA_AB), or keep the texture out of VRAM when the guard trips?
  5. d3d12/docs/switches.md needs regenerating for the two new switches (python -I tools/d3d12_switches.py --out d3d12/docs/switches.md), or the CI check will fail.
  6. Tests: a unit test for the threshold (used + BLOCK > budget * pct, budget 0 means no refusal, the 80-99 clamp) would make it verifiable without a game.

AI-assisted review (Claude Code agent oreofr-agent, for OreoFR).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7323467063 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929#issuecomment-7323467063). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-01T19:48:21Z. --- Thanks for looking at 8 GiB cards, that's a real problem (I test on an RTX 4070 Laptop 8 GB). A review before anyone can merge this, read from the diff on head `51818b7ea`; no build or run yet: 1. **Claim.** The PR says "n/a"; the project asks for a claim in the coordination issue (#2570) before a PR, with an item ID in the title. 2. **One topic per PR.** The VRAM guard and the pipeline worker stack are two changes; please split them. 3. **The stack part duplicates #2588** (open, same 64 MB stack for the pipeline workers, another author). Better to help that one land (it has review questions waiting) than to carry a second copy. 4. **The VRAM guard may not save VRAM.** When `vram_block_refused()` makes the block maker return `None`, `texture_with_cast` returns `None`, and the caller in `resource.rs` (right after the pool call) creates the texture on its own in the same default heap. So the texture still lands in VRAM, just outside the pool, as one more allocation. Could you show a before/after measurement (VRAM use, `MakeResident` stalls, time to a device loss) with the guard on and off in one run (`LEONIDA_AB`), or keep the texture out of VRAM when the guard trips? 5. **`d3d12/docs/switches.md`** needs regenerating for the two new switches (`python -I tools/d3d12_switches.py --out d3d12/docs/switches.md`), or the CI check will fail. 6. **Tests:** a unit test for the threshold (`used + BLOCK > budget * pct`, budget 0 means no refusal, the 80-99 clamp) would make it verifiable without a game. AI-assisted review (Claude Code agent `oreofr-agent`, for OreoFR).
merzleckeier commented 2026-12-01 20:26:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T20:26:20Z.


Live texture-pool and worker-stack check on 51818b7e merged into 19d5f83c. The control used the same fixture on main.

  • Texture pool. I created a live 64×64 RGBA8 D3D12 texture on an RTX 4070 SUPER and on AMD RADV (Wine 11.22 / VKD3D-Proton 3.1.0), with a fixed synthetic budget snapshot. With LEONIDA_RIPE_BLOCKS=0, both trees opened a 64 MiB pool block at equality and with an unknown budget. One byte above the configured limit, at both 95% and 90%, main opened a block and the PR opened zero. The same call still returned a live texture through the committed-resource fallback. An existing block was reused on both trees above the limit. With default preallocation, equality let the PR open two 64 MiB blocks against the unchanged snapshot, and one byte above allowed neither block. All 32 cases passed. This measures the allocation path, with actual VRAM pressure and device-loss behavior outside the test.
  • Pipeline workers. The production pool started two regular and two screen-only workers per run on Wine. All four reserved 64 MiB by default here and 2 MiB on both main and the Wine-aware #2588. Requests of 8, bad, 1, and 999 produced 8, 64, 2, and 256 MiB here. The reservation probe ran with an empty pipeline queue.
  • Switch inventory. The combined tree with #2934 failed on LEONIDA_PIPELINE_STACK_MIB and LEONIDA_VRAM_GUARD_PCT. Regenerating d3d12/docs/switches.md with python -I tools/d3d12_switches.py --out d3d12/docs/switches.md made the check and all 20 tests pass.

MEASURED with synthetic inputs. AI-assisted with OpenAI Codex and a separate read-only review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7324685488 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929#issuecomment-7324685488). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T20:26:20Z. --- Live texture-pool and worker-stack check on `51818b7e` merged into `19d5f83c`. The control used the same fixture on `main`. - **Texture pool.** I created a live 64×64 RGBA8 D3D12 texture on an RTX 4070 SUPER and on AMD RADV (Wine 11.22 / VKD3D-Proton 3.1.0), with a fixed synthetic budget snapshot. With `LEONIDA_RIPE_BLOCKS=0`, both trees opened a 64 MiB pool block at equality and with an unknown budget. One byte above the configured limit, at both 95% and 90%, `main` opened a block and the PR opened zero. The same call still returned a live texture through the committed-resource fallback. An existing block was reused on both trees above the limit. With default preallocation, equality let the PR open two 64 MiB blocks against the unchanged snapshot, and one byte above allowed neither block. All 32 cases passed. This measures the allocation path, with actual VRAM pressure and device-loss behavior outside the test. - **Pipeline workers.** The production pool started two regular and two screen-only workers per run on Wine. All four reserved 64 MiB by default here and 2 MiB on both `main` and the Wine-aware #2588. Requests of `8`, `bad`, `1`, and `999` produced 8, 64, 2, and 256 MiB here. The reservation probe ran with an empty pipeline queue. - **Switch inventory.** The combined tree with #2934 failed on `LEONIDA_PIPELINE_STACK_MIB` and `LEONIDA_VRAM_GUARD_PCT`. Regenerating `d3d12/docs/switches.md` with `python -I tools/d3d12_switches.py --out d3d12/docs/switches.md` made the check and all 20 tests pass. MEASURED with synthetic inputs. AI-assisted with OpenAI Codex and a separate read-only review.
merzleckeier commented 2026-12-01 21:02:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T21:02:38Z.


Cache regression on the updated head with a working pipeline library 686c1124. I compared #2654 (55ac5d33) against #2654 plus this PR so that both arms could create an empty pipeline library on Wine. On bc332322e and again on 1fff69129, the unmodified mesh and depth-bounds tests each passed 3/3 per GPU with #2654 alone. Adding this PR made both tests fail 3/3 per GPU at the second-request library-load assertion. Both GPUs were physical, RTX 4070 SUPER (620.73.4) and Radeon RADV (26.3.1), Win64 Wine 11.22 / VKD3D-Proton 3.1.0.

Recording the actual API results on bc332322e explains the failure. With #2654 alone, the first LoadPipeline returns E_INVALIDARG for the cold name, StorePipeline returns S_OK, and the second load returns S_OK. With this PR, the first load returns the same code, the store is skipped, and the second load returns E_INVALIDARG again. Both patterns reproduced on both GPUs and in both fixtures. Microsoft’s API docs list an absent name as one reason for this HRESULT.

I then restored only pipeline/library.rs to the #2654 version while retaining this PR’s pool change and generated docs. Both tests were back to 3/3 on each GPU. The broad skip-on-E_INVALIDARG branch blocks ordinary cache population here. This covers same-process reuse with synthetic pipelines under Wine.

MEASURED with OpenAI Codex and a separate read-only review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7325656045 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929#issuecomment-7325656045). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T21:02:38Z. --- Cache regression on the updated head with a working pipeline library `686c1124`. I compared #2654 (`55ac5d33`) against #2654 plus this PR so that both arms could create an empty pipeline library on Wine. On `bc332322e` and again on `1fff69129`, the unmodified mesh and depth-bounds tests each passed 3/3 per GPU with #2654 alone. Adding this PR made both tests fail 3/3 per GPU at the second-request library-load assertion. Both GPUs were physical, RTX 4070 SUPER (620.73.4) and Radeon RADV (26.3.1), Win64 Wine 11.22 / VKD3D-Proton 3.1.0. Recording the actual API results on `bc332322e` explains the failure. With #2654 alone, the first `LoadPipeline` returns `E_INVALIDARG` for the cold name, `StorePipeline` returns `S_OK`, and the second load returns `S_OK`. With this PR, the first load returns the same code, the store is skipped, and the second load returns `E_INVALIDARG` again. Both patterns reproduced on both GPUs and in both fixtures. [Microsoft’s API docs list an absent name as one reason for this HRESULT](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12pipelinelibrary1-loadpipeline). I then restored only `pipeline/library.rs` to the #2654 version while retaining this PR’s pool change and generated docs. Both tests were back to 3/3 on each GPU. The broad skip-on-`E_INVALIDARG` branch blocks ordinary cache population here. This covers same-process reuse with synthetic pipelines under Wine. MEASURED with OpenAI Codex and a separate read-only review.
KelboLive commented 2026-12-01 21:25:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T21:25:32Z.

Review: COMMENTED


Re-checked 686c1124c. Two of the four are resolved:

  • Point 1 fixed. The stack half is gone — make.rs is identical to main, and merge-tree against both origin/main and #2588's 6b4a44e1 is clean, so #2588 is unblocked and nothing is left to reconcile.
  • Point 4 fixed. tools/d3d12_switches.py --check exits 0; LEONIDA_VRAM_GUARD_PCT is listed and the page re-homed LEONIDA_RENDER_SCALE_MIN.

Two are unchanged, and they are the substance:

  • The guard still does not cap peak. pool.rs:590-605 decides from VRAM_USED, written only in room() (pool.rs:52) and refreshed at most once a second by host::sweep, and never incremented when a block is approved — so N blocks approved inside one second all compare the same stale value. A refusal at pool.rs:896 makes take_texture(..)? return None, and resource.rs:3294-3300 falls through to the committed allocation of the same texture at resource.rs:3329, so the bytes are spent anyway, just unpooled (plus a 500 ms growth_failed back-off). Staging, small, shadow and targets remain ungated.
  • vram_block_refused is still untested. Forcing its decision to false leaves all 17 pool:: tests green. VRAM_BUDGET/VRAM_USED are plain statics, so a unit test is easy; the committed fallback also needs the same gate, otherwise the guard only changes which allocation path is used.

Separately, the new pipeline/library.rs change (skip StorePipeline on 0x80070057 and log "not cacheable by library") is an untested behaviour change, and merzleckeier's 21:02 report of a cache regression on this head needs an answer before merge — that is the kind of thing the gate exists to catch.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6140431184 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929#pullrequestreview-6140431184). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T21:25:32Z. **Review:** COMMENTED --- Re-checked `686c1124c`. Two of the four are resolved: - **Point 1 fixed.** The stack half is gone — `make.rs` is identical to `main`, and `merge-tree` against both `origin/main` and #2588's `6b4a44e1` is clean, so #2588 is unblocked and nothing is left to reconcile. - **Point 4 fixed.** `tools/d3d12_switches.py --check` exits 0; `LEONIDA_VRAM_GUARD_PCT` is listed and the page re-homed `LEONIDA_RENDER_SCALE_MIN`. Two are unchanged, and they are the substance: - **The guard still does not cap peak.** `pool.rs:590-605` decides from `VRAM_USED`, written only in `room()` (`pool.rs:52`) and refreshed at most once a second by `host::sweep`, and never incremented when a block is approved — so N blocks approved inside one second all compare the same stale value. A refusal at `pool.rs:896` makes `take_texture(..)?` return `None`, and `resource.rs:3294-3300` falls through to the **committed** allocation of the same texture at `resource.rs:3329`, so the bytes are spent anyway, just unpooled (plus a 500 ms `growth_failed` back-off). Staging, small, shadow and targets remain ungated. - **`vram_block_refused` is still untested.** Forcing its decision to `false` leaves all 17 `pool::` tests green. `VRAM_BUDGET`/`VRAM_USED` are plain statics, so a unit test is easy; the committed fallback also needs the same gate, otherwise the guard only changes which allocation path is used. Separately, the new `pipeline/library.rs` change (skip `StorePipeline` on `0x80070057` and log "not cacheable by library") is an untested behaviour change, and merzleckeier's 21:02 report of a cache regression on this head needs an answer before merge — that is the kind of thing the gate exists to catch.
fiestorra commented 2026-12-01 22:35:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T22:35:33Z.


Independent verification on an RTX 4090, driver 621.24 (Windows 11) - by the AGENTS.md method. Two things to fix before merge, one of them serious.

It applies cleanly (merge-tree no conflicts; merge --squash onto 1fff69129 fine), and what it does run passes:

cargo test -p leonida-gpu --lib -- --test-threads=1 pool::
    ok. 17 passed; 0 failed
python -I tests/test_d3d12_switches.py
    exit 0

1. The second P0 in the body is not in the code.

The body says:

P0.2 - Pipeline stack (pipeline/make.rs): give each pipeline worker 64 MiB stack ... Configurable via LEONIDA_PIPELINE_STACK_MIB (2-256, default 64).

The branch touches no pipeline/make.rs, and LEONIDA_PIPELINE_STACK_MIB does not appear anywhere in it:

git grep LEONIDA_PIPELINE_STACK_MIB refs/remotes/pr/2929 -- d3d12     (nothing)
git diff --name-only <merge-base> refs/remotes/pr/2929
  d3d12/crates/leonida-gpu/src/pipeline/library.rs
  d3d12/crates/leonida-gpu/src/pool.rs
  d3d12/docs/switches.md

That is also the half with the interesting NVIDIA claim (the nvgpucomp64.dll overflow at ~7 min). What is here is P0.1 and a library.rs restructure that changes no behaviour - old and new both ignore StorePipeline's error, and the new match has a first Err arm for 0x80070057 followed by Err(_) that does the same thing, so the specific arm is dead.

2. switches.md was regenerated from a tree older than main, and merging it rewrites 271 of its ~745 lines.

Its own stat says +5/-1 because it is diffed against its base, but against today's main the file differs in 271 lines, and they are real regressions, not formatting:

main:  | `LEONIDA_RENDER_SCALE_MIN` | see the code |  | yes |  | `leonida-loader/hooks.rs` +1 |  |
PR:    | `LEONIDA_RENDER_SCALE_MIN` | see the code |  | yes |  | `leonida-gpu/host/menu.rs` +2 |  |

LEONIDA_RENDER_SCALE_MIN lives in leonida-loader/hooks.rs on main and the PR would move it back to where it was before. This is the shape the repo's own notes call out (a clean merge overwriting what main has in the same file, #2582).

test_d3d12_switches.py does not catch it - it passes here, because it checks that each name is present, not where the row says it lives. So the check that exists is not the check needed for this file.

3. A new clippy warning: pool.rs:76, "this if statement can be collapsed" (the other one, host.rs:7628, is on main already).

Two questions I could not answer without an 8 GiB card, and would like the PR to address:

  • VRAM_BUDGET/VRAM_USED are only refreshed inside room(). If a texture block is taken without room() having run since the last allocation, vram_block_refused() decides on stale numbers - and its doc says it is "called before every CreateHeap", which is not the same as "after every room()". What refreshes them between blocks?
  • The refusal path: the guard returns None inside take_texture, so the texture is not placed. What does the title get instead - a smaller piece, a placed texture elsewhere, or nothing? On 8 GiB that is the difference between a guard and a hole in the frame, and I cannot see it from here.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7328067888 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929#issuecomment-7328067888). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T22:35:33Z. --- **Independent verification on an RTX 4090, driver 621.24 (Windows 11) - by the `AGENTS.md` method. Two things to fix before merge, one of them serious.** **It applies cleanly** (`merge-tree` no conflicts; `merge --squash` onto `1fff69129` fine), **and what it does run passes**: ``` cargo test -p leonida-gpu --lib -- --test-threads=1 pool:: ok. 17 passed; 0 failed python -I tests/test_d3d12_switches.py exit 0 ``` **1. The second P0 in the body is not in the code.** The body says: > **P0.2 - Pipeline stack** (`pipeline/make.rs`): give each pipeline worker 64 MiB stack ... Configurable via `LEONIDA_PIPELINE_STACK_MIB` (2-256, default 64). **The branch touches no `pipeline/make.rs`, and `LEONIDA_PIPELINE_STACK_MIB` does not appear anywhere in it:** ``` git grep LEONIDA_PIPELINE_STACK_MIB refs/remotes/pr/2929 -- d3d12 (nothing) git diff --name-only <merge-base> refs/remotes/pr/2929 d3d12/crates/leonida-gpu/src/pipeline/library.rs d3d12/crates/leonida-gpu/src/pool.rs d3d12/docs/switches.md ``` **That is also the half with the interesting NVIDIA claim** (the `nvgpucomp64.dll` overflow at ~7 min). **What is here is P0.1 and a `library.rs` restructure that changes no behaviour** - old and new both ignore `StorePipeline`'s error, and the new `match` has a first `Err` arm for `0x80070057` followed by `Err(_)` that does the same thing, so the specific arm is dead. **2. `switches.md` was regenerated from a tree older than `main`, and merging it rewrites 271 of its ~745 lines.** Its own stat says `+5/-1` because it is diffed against its base, but **against today's `main` the file differs in 271 lines**, and they are real regressions, not formatting: ``` main: | `LEONIDA_RENDER_SCALE_MIN` | see the code | | yes | | `leonida-loader/hooks.rs` +1 | | PR: | `LEONIDA_RENDER_SCALE_MIN` | see the code | | yes | | `leonida-gpu/host/menu.rs` +2 | | ``` **`LEONIDA_RENDER_SCALE_MIN` lives in `leonida-loader/hooks.rs` on `main` and the PR would move it back to where it was before.** This is the shape the repo's own notes call out (a clean merge overwriting what `main` has in the same file, #2582). **`test_d3d12_switches.py` does not catch it** - it passes here, because it checks that each name is present, not where the row says it lives. **So the check that exists is not the check needed for this file.** **3. A new clippy warning**: `pool.rs:76`, "this `if` statement can be collapsed" (the other one, `host.rs:7628`, is on `main` already). **Two questions I could not answer without an 8 GiB card, and would like the PR to address:** - **`VRAM_BUDGET`/`VRAM_USED` are only refreshed inside `room()`.** If a texture block is taken without `room()` having run since the last allocation, **`vram_block_refused()` decides on stale numbers** - and its doc says it is "called before every `CreateHeap`", which is not the same as "after every `room()`". **What refreshes them between blocks?** - **The refusal path**: the guard returns `None` inside `take_texture`, so the texture is not placed. **What does the title get instead** - a smaller piece, a placed texture elsewhere, or nothing? **On 8 GiB that is the difference between a guard and a hole in the frame**, and I cannot see it from here. **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
fiestorra commented 2026-12-01 23:26:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T23:26:40Z.


Note on the two P0s in this PR: the second one already exists as #2588, and it is not in this branch.

The body describes P0.2 - pipeline stack: 64 MiB per pipeline worker, nvgpucomp64.dll overflowing on Ampere/Wave32, LEONIDA_PIPELINE_STACK_MIB (2-256, default 64). None of that is in this diff - pipeline/make.rs is not touched and the switch name appears nowhere in the branch:

git grep LEONIDA_PIPELINE_STACK_MIB refs/remotes/pr/2929 -- d3d12     (nothing)

The work is done, in #2588 ("GPU: pipeline workers get a 64 MB stack for the driver's compiler", +70/-2, open) - which I verified separately today: applies on main 913b88b90, pipeline::make 14/14, and its pipeline_workers_reserve_a_64_mb_stack reads GetCurrentThreadStackLimits from a worker, so it checks the reservation rather than the constant. It also declines the stack under Wine, where the whole of it is committed.

So the honest shape of this PR is: P0.1 here, P0.2 in #2588 - "Depends on: #2588" instead of a second item claimed and absent. As written, a reviewer reads two fixes and merges one.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7329351910 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929#issuecomment-7329351910). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T23:26:40Z. --- **Note on the two P0s in this PR: the second one already exists as #2588, and it is not in this branch.** The body describes **P0.2 - pipeline stack**: 64 MiB per pipeline worker, `nvgpucomp64.dll` overflowing on Ampere/Wave32, `LEONIDA_PIPELINE_STACK_MIB` (2-256, default 64). **None of that is in this diff** - `pipeline/make.rs` is not touched and the switch name appears nowhere in the branch: ``` git grep LEONIDA_PIPELINE_STACK_MIB refs/remotes/pr/2929 -- d3d12 (nothing) ``` **The work is done, in [#2588](https://github.com/ProjectLeonida/mandy/pull/2588) ("GPU: pipeline workers get a 64 MB stack for the driver's compiler", +70/-2, open)** - which I verified separately today: applies on `main` `913b88b90`, `pipeline::make` 14/14, and its `pipeline_workers_reserve_a_64_mb_stack` reads `GetCurrentThreadStackLimits` from a worker, so it checks the reservation rather than the constant. **It also declines the stack under Wine, where the whole of it is committed.** **So the honest shape of this PR is: P0.1 here, P0.2 in #2588** - **"Depends on: #2588" instead of a second item claimed and absent.** **As written, a reviewer reads two fixes and merges one.** **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
MoonEyes commented 2026-12-02 12:19:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:19:06Z.


Closing: this pull request no longer applies to current main (merge conflict in d3d12/docs/switches.md), and open pull requests that have fallen out of step with main are being closed so the list stays workable. If you still want this change, rebase it on current main and reopen it (or open a new pull request); it will be looked at again.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345160325 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2929#issuecomment-7345160325). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:19:06Z. --- Closing: this pull request no longer applies to current `main` (merge conflict in `d3d12/docs/switches.md`), and open pull requests that have fallen out of step with `main` are being closed so the list stays workable. If you still want this change, rebase it on current `main` and reopen it (or open a new pull request); it will be looked at again. AI-assisted (Claude Code).

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
ProjectLeonida/mandy!2929
No description provided.