d3d12: on an 8 GB card the story scene after the first placements never starts in 5 of 9 runs (flat grey picture, texture queue stops), with and without DLSS #3434

Open
leonida/mandy
opened 2026-12-04 06:03:30 +00:00 by Otavmacedo · 6 comments

What happens

On an 8 GB card, at the story transition into the second protagonist's prologue (about 6 minutes into the world from the one save all these runs start from, reached standing still), the scene never starts in about half the runs: the picture stays a flat grey while frames keep coming, the player's position stops changing, and the texture queue stays at about 17,000 "waiting for their memory" to the end of the run. It happens with and without DLSS: 5 of the 9 runs that got past the transition.

Commit

main 4d9e4d05d. Some runs are that commit plus one open PR: #3400 + #3385 (one run, the scene ran), or #3198 with its variable at 0, where it does nothing (READ IN CODE: its residency.rs returns before any call), so those three runs are main's behaviour; they all stuck. On plain main alone it is 2 stuck of 5. No local patches.

System

NVIDIA GeForce RTX 3070 8 GB desktop (video memory budget about 7.2 GB), driver 621.47, Windows 11 Pro 26200, Ryzen 7 5700X, 16 GB RAM, fixed 24 GB page file. Profile M. Runtime: d3d12 (leonida.exe), diagnostics,dlss,mimalloc builds.

Where

runtime

Command and steps

scripts/game-gate.ps1 run from one save each time, Series S, -NoFrameGen, mods/gate_driver idle (LEONIDA_GAME_ACTIONS=1: it passes the menus, takes control and then stands still), memory stops widened. Two recipes: -Dlss quality (the launcher's pick for this PC), and d3d12/docs/windows-memory.md's 8 GB profile (-Resolution 540 -NoSmoothMotion, LEONIDA_FPS_CAP=30). From this save the title moves the player through a few placements in the first 6 minutes and then into the prologue scene, standing or not.

Seen by the tester on the first such run: from that transition to the end the picture was a flat dark grey while frames kept coming at 21-24 fps. The other runs were not watched; they are classed by the signature below, which that watched run has.

Output

No log lines or game content here, per the rules; these are counts from each run's log, per minute after control.

The signature (READ IN the runs' logs, GATE MARK positions and the runtime's per-frame lines):

Scene runs Scene stuck
Player's distance from where control began, after the transition moves on, about 1,400 → 1,420 m within about 2 minutes stays at the same 1,400 m to the end
Draws a frame, minutes 7-10 vary, falling to about 1,650-2,000 near minute 10 flat at about 4,100-4,600
"textures picked by index … waiting for their memory" falls to about 13,100-14,000 near minute 10 flat at about 16,500-17,000
First binds of new pipelines, minutes 6-8 after control 76-81 mesh and 73-81 pixel shaders 4-10 mesh and 5-17 pixel

The runs (MEASURED, n=9; every run that evening that reached 8 minutes after control):

Run Build Upscaler Scene In the world Over budget
crash-2 main DLSS quality stuck (watched: grey) 909 s 704.5 s
p3400-A1 main + #3400 + #3385 DLSS quality ran (device lost at 8.4 min, inside the scene) 507 s 258.9 s
r540-1 main -Resolution 540 ran 606 s 319.5 s
r540-2 main -Resolution 540 ran 606 s 319.6 s
bg0-1 main, LEONIDA_D3D12_BACKGROUND=0 DLSS quality ran 608 s 346.0 s
bg0-2 main, LEONIDA_D3D12_BACKGROUND=0 DLSS quality stuck 602 s 328.7 s
p3198-A1 main + #3198 at 0 -Resolution 540 stuck 604 s 69.4 s
p3198-A2 main + #3198 at 0 -Resolution 540 stuck 606 s 313.0 s
p3198-A3 main + #3198 at 0 -Resolution 540 stuck 609 s 328.7 s

(The run that lost the device at 8.4 min is left out of the minute-10 rows above.)

  • MEASURED: stuck with DLSS 2 of 4, without DLSS 3 of 5; so DLSS is not what decides it.
  • MEASURED: the video memory over-budget time does not separate the two either (stuck runs 69-329 s over it in the 600 s runs, 705 s in the one 900 s run; runs where the scene ran 259-346 s).
  • ASSUMED: that the stuck scene is waiting for textures that never become resident (the queue that stops moving) is the reading of the counters, not shown. d3d12/README.md already lists "black cutscenes under 8 GB VRAM pressure"; this may be the same thing, seen grey and with the rate measured.

The first run was also reported as a PICTURE line on #2464.

AI-assisted: Claude Code (Claude Opus 5.5) ran and read the runs; the counts were recomputed from the logs by a separate read-only agent before posting.

### What happens On an 8 GB card, at the story transition into the second protagonist's prologue (about 6 minutes into the world from the one save all these runs start from, reached standing still), the scene never starts in about half the runs: the picture stays a flat grey while frames keep coming, the player's position stops changing, and the texture queue stays at about 17,000 "waiting for their memory" to the end of the run. **It happens with and without DLSS**: 5 of the 9 runs that got past the transition. ### Commit `main` 4d9e4d05d. Some runs are that commit plus one open PR: #3400 + #3385 (one run, the scene ran), or #3198 with its variable at 0, where it does nothing (READ IN CODE: its `residency.rs` returns before any call), so those three runs are `main`'s behaviour; they all stuck. On plain `main` alone it is 2 stuck of 5. No local patches. ### System NVIDIA GeForce RTX 3070 8 GB desktop (video memory budget about 7.2 GB), driver 621.47, Windows 11 Pro 26200, Ryzen 7 5700X, 16 GB RAM, fixed 24 GB page file. Profile M. Runtime: `d3d12` (`leonida.exe`), `diagnostics,dlss,mimalloc` builds. ### Where runtime ### Command and steps `scripts/game-gate.ps1 run` from one save each time, Series S, `-NoFrameGen`, `mods/gate_driver` idle (`LEONIDA_GAME_ACTIONS=1`: it passes the menus, takes control and then stands still), memory stops widened. Two recipes: `-Dlss quality` (the launcher's pick for this PC), and d3d12/docs/windows-memory.md's 8 GB profile (`-Resolution 540 -NoSmoothMotion`, `LEONIDA_FPS_CAP=30`). From this save the title moves the player through a few placements in the first 6 minutes and then into the prologue scene, standing or not. Seen by the tester on the first such run: from that transition to the end the picture was a flat dark grey while frames kept coming at 21-24 fps. The other runs were not watched; they are classed by the signature below, which that watched run has. ### Output No log lines or game content here, per the rules; these are counts from each run's log, per minute after control. **The signature** (READ IN the runs' logs, `GATE MARK` positions and the runtime's per-frame lines): | | Scene runs | Scene stuck | |---|---|---| | Player's distance from where control began, after the transition | moves on, about 1,400 → 1,420 m within about 2 minutes | stays at the same 1,400 m to the end | | Draws a frame, minutes 7-10 | vary, falling to about 1,650-2,000 near minute 10 | flat at about 4,100-4,600 | | "textures picked by index … waiting for their memory" | falls to about 13,100-14,000 near minute 10 | flat at about 16,500-17,000 | | First binds of new pipelines, minutes 6-8 after control | 76-81 mesh and 73-81 pixel shaders | 4-10 mesh and 5-17 pixel | **The runs** (MEASURED, n=9; every run that evening that reached 8 minutes after control): | Run | Build | Upscaler | Scene | In the world | Over budget | |---|---|---|---|---|---| | crash-2 | `main` | DLSS quality | stuck (watched: grey) | 909 s | 704.5 s | | p3400-A1 | `main` + #3400 + #3385 | DLSS quality | ran (device lost at 8.4 min, inside the scene) | 507 s | 258.9 s | | r540-1 | `main` | `-Resolution 540` | ran | 606 s | 319.5 s | | r540-2 | `main` | `-Resolution 540` | ran | 606 s | 319.6 s | | bg0-1 | `main`, `LEONIDA_D3D12_BACKGROUND=0` | DLSS quality | ran | 608 s | 346.0 s | | bg0-2 | `main`, `LEONIDA_D3D12_BACKGROUND=0` | DLSS quality | stuck | 602 s | 328.7 s | | p3198-A1 | `main` + #3198 at 0 | `-Resolution 540` | stuck | 604 s | 69.4 s | | p3198-A2 | `main` + #3198 at 0 | `-Resolution 540` | stuck | 606 s | 313.0 s | | p3198-A3 | `main` + #3198 at 0 | `-Resolution 540` | stuck | 609 s | 328.7 s | (The run that lost the device at 8.4 min is left out of the minute-10 rows above.) - MEASURED: stuck with DLSS 2 of 4, without DLSS 3 of 5; so DLSS is not what decides it. - MEASURED: the video memory over-budget time does not separate the two either (stuck runs 69-329 s over it in the 600 s runs, 705 s in the one 900 s run; runs where the scene ran 259-346 s). - ASSUMED: that the stuck scene is waiting for textures that never become resident (the queue that stops moving) is the reading of the counters, not shown. d3d12/README.md already lists "black cutscenes under 8 GB VRAM pressure"; this may be the same thing, seen grey and with the rate measured. The first run was also reported as a PICTURE line on #2464. AI-assisted: Claude Code (Claude Opus 5.5) ran and read the runs; the counts were recomputed from the logs by a separate read-only agent before posting.
Member

Thanks, this is a very useful report: the stuck texture queue on 8 GB at that story transition matches what #3400 (VRAM margin on small cards) and #3031 (shared command allocators, about 2 GB less private memory) aim at. Both are queued for an in-game A/B on an 8 GB laptop RTX 4070. If you can, a run of main + #3031 on the same save would tell a lot.

🤖 Generated with Claude Code

Thanks, this is a very useful report: the stuck texture queue on 8 GB at that story transition matches what #3400 (VRAM margin on small cards) and #3031 (shared command allocators, about 2 GB less private memory) aim at. Both are queued for an in-game A/B on an 8 GB laptop RTX 4070. If you can, a run of `main` + #3031 on the same save would tell a lot. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author

Thanks. Taken on #3031 (comment 25476): an A/B of main + #3031 on this save, LEONIDA_ALLOCATOR_RING=0 against the PR's default, three runs a side, each 600 s so it passes the transition. Result there by about 11:00 UTC. AI-assisted: Claude Code (Claude Opus 5.5).

Thanks. Taken on #3031 (comment 25476): an A/B of `main` + #3031 on this save, `LEONIDA_ALLOCATOR_RING=0` against the PR's default, three runs a side, each 600 s so it passes the transition. Result there by about 11:00 UTC. AI-assisted: Claude Code (Claude Opus 5.5).
Author

Result of the run you asked for is on #3031 (comment 25604): with main + #3031 on this save, the pooled allocators lowered the private peak by about 1 GB here, but the scene stayed stuck in all six runs, with and without them (three each). So on this 8 GB / 16 GB PC this issue is not unstuck by that much less private memory. One more thing for whoever tests this on other PCs: here the device loss depends on the folder the executable runs from (#2821, comment 25546); these runs were made from the folder where it holds. AI-assisted: Claude Code (Claude Opus 5.5).

Result of the run you asked for is on #3031 (comment 25604): with `main` + #3031 on this save, the pooled allocators lowered the private peak by about 1 GB here, but the scene stayed stuck in all six runs, with and without them (three each). So on this 8 GB / 16 GB PC this issue is not unstuck by that much less private memory. One more thing for whoever tests this on other PCs: here the device loss depends on the folder the executable runs from (#2821, comment 25546); these runs were made from the folder where it holds. AI-assisted: Claude Code (Claude Opus 5.5).
Author

Addendum to my report above, from the code, on what the stuck counter means | AI-assisted: Claude Code (Claude Opus 5.5)

My ASSUMED line read the flat "textures picked by index … waiting for their memory" (about 17,000) as textures that never become resident on the card. The code says otherwise: that count is not video memory.

  • READ IN CODE: waiting_kind() (d3d12/crates/leonida-gpu/src/descriptor/host.rs, near line 1890) puts a queued slot in "waiting for its memory" when it has been looked at and nothing of it was uploaded; the texture pass (draw.rs, near line 4487) finds that by texture::mapped_bytes() returning 0 for the texture's placed memory, i.e. the title's own pages for that texture are not mapped (streamed out, or not streamed in yet). Such a slot holds no copy on the card.
  • READ IN CODE: the slots blocked by the card's budget are a separate set (held for about 4 s and greyed until there is room, draw.rs near line 4540), and the code's own note says a heap normally keeps some 25,000 slots waiting for their memory (descriptor/host.rs, near line 1609). So 17,000 is not high in itself; what marks the stuck runs is that the count stops changing, together with the player's position.
  • So the flat count is the title not bringing those textures in, not video memory being full. Whether that is why the scene does not start, or only follows from it, the counters cannot say. Either way it fits #3031 (about 1 GB less private memory) not changing it in six runs on this save (#3031, comment 25604).

What it does not say: why the title's streaming stops there in some runs and not others. Next on my side: whether the DirectStorage requests for that scene are issued and completed in the stuck runs (the runtime logs its DirectStorage work), compared with a run where the scene starts.

Addendum to my report above, from the code, on what the stuck counter means | AI-assisted: Claude Code (Claude Opus 5.5) My ASSUMED line read the flat "textures picked by index … waiting for their memory" (about 17,000) as textures that never become resident on the card. **The code says otherwise: that count is not video memory.** - READ IN CODE: `waiting_kind()` (`d3d12/crates/leonida-gpu/src/descriptor/host.rs`, near line 1890) puts a queued slot in "waiting for its memory" when it has been looked at and nothing of it was uploaded; the texture pass (`draw.rs`, near line 4487) finds that by `texture::mapped_bytes()` returning 0 for the texture's placed memory, i.e. **the title's own pages for that texture are not mapped** (streamed out, or not streamed in yet). Such a slot holds no copy on the card. - READ IN CODE: the slots blocked by the card's budget are a separate set (held for about 4 s and greyed until there is room, `draw.rs` near line 4540), and the code's own note says a heap normally keeps some 25,000 slots waiting for their memory (`descriptor/host.rs`, near line 1609). So 17,000 is not high in itself; what marks the stuck runs is that the count stops changing, together with the player's position. - So the flat count is **the title not bringing those textures in**, not video memory being full. Whether that is why the scene does not start, or only follows from it, the counters cannot say. Either way it fits #3031 (about 1 GB less private memory) not changing it in six runs on this save (#3031, comment 25604). What it does not say: why the title's streaming stops there in some runs and not others. Next on my side: whether the DirectStorage requests for that scene are issued and completed in the stuck runs (the runtime logs its DirectStorage work), compared with a run where the scene starts.

A read-only code audit of this issue (no game run) found that the “~17,000 waiting for their memory” is not one population, and that the queue has no retry deadlock. Before a cause is assigned, the counter must be pinned down.

1. Two different numbers share the words.

  • The per-frame textures picked by index … waiting prints HEAP_TEXTURES_WAITING = census[0], the whole queue (draw.rs:4280, host.rs:13905).
  • The five-second {away} waiting for their memory prints census[2] = mapped == 0 && looks > 0 (host.rs:13787, descriptor/host.rs:1889-1897).
    Which of the two is ~17,000 changes everything below.

2. Class 1 is a mixed set. The doc says “looked at, never uploaded”, but recheck sets looks = 1, mapped = 0 after a whole upload (descriptor/host.rs:1839-1848), and hold does not reset looks (1795-1803). So class 1 = never-uploaded + uploaded-waiting-for-a-re-look + held-while-looked. A flat class 1 is therefore not a liveness signal on its own.

3. The queue cannot deadlock on a retry. A looked-at slot is re-armed by later on the frame alone, at most every most frames (clamped 16..1024, ~20 s at 21–24 fps), with no mapping event required (descriptor/host.rs:1774-1783, draw.rs:4294-4308). The “retry needs an event the title never sends” hypothesis is false.

4. room == false does not freeze class 1. The mapped == 0 look happens before the no-room branch (draw.rs:4482-4493 vs 4532-4552); room false stops new host copies, held slots and levels waiting for tiles — not the re-look.

So the flat queue is more likely an effect: the title’s pages stay unmapped (title-side stall), or heap_textures is not running at all and the census is stale. The code has no direct wait edge from the title to a queue slot; the only circular shape is indirect VRAM/commit competition, which is unproven.

Probe to add (diagnostics only, no hot path): a 5 s line with HEAP_TEXTURE_PASSES (once per real pass), HEAP_TEXTURES_ARRIVED (due slot found with mapped > 0 after class 1), a split of class 1 (never uploaded / recheck / held), and the already-defined but never-printed HEAP_TEXTURES_FULL and HEAP_TEXTURES_REUPLOADED_FULL, plus last room, used/budget, KINDS[1], tiles::given_total() and pool::texture_room().

Outcomes it separates: passes growing with away growing and uploads flat → title not mapping; everything flat → pass not running; room false with held/recheck growing → VRAM circular wait; uploads and arrived growing while class 1 is flat → recheck churn.

Three device-free tests are possible in the existing TextureQueue tests: a slot looked at without memory is due again without a mapping event; an uploaded slot waiting for a re-look counts as class 1; a held slot that was looked at before stays class 1. No fix is proposed until the probe says which population it is.

A read-only code audit of this issue (no game run) found that **the “~17,000 waiting for their memory” is not one population**, and that the queue has no retry deadlock. Before a cause is assigned, the counter must be pinned down. **1. Two different numbers share the words.** - The per-frame `textures picked by index … waiting` prints `HEAP_TEXTURES_WAITING` = `census[0]`, the **whole queue** (`draw.rs:4280`, `host.rs:13905`). - The five-second `{away} waiting for their memory` prints `census[2]` = `mapped == 0 && looks > 0` (`host.rs:13787`, `descriptor/host.rs:1889-1897`). Which of the two is ~17,000 changes everything below. **2. Class 1 is a mixed set.** The doc says “looked at, never uploaded”, but `recheck` sets `looks = 1, mapped = 0` **after a whole upload** (`descriptor/host.rs:1839-1848`), and `hold` does not reset `looks` (`1795-1803`). So class 1 = never-uploaded + uploaded-waiting-for-a-re-look + held-while-looked. A flat class 1 is therefore **not** a liveness signal on its own. **3. The queue cannot deadlock on a retry.** A looked-at slot is re-armed by `later` on the frame alone, at most every `most` frames (clamped 16..1024, ~20 s at 21–24 fps), **with no mapping event required** (`descriptor/host.rs:1774-1783`, `draw.rs:4294-4308`). The “retry needs an event the title never sends” hypothesis is false. **4. `room == false` does not freeze class 1.** The `mapped == 0` look happens before the no-room branch (`draw.rs:4482-4493` vs `4532-4552`); room false stops new host copies, held slots and levels waiting for tiles — not the re-look. So the flat queue is more likely an **effect**: the title’s pages stay unmapped (title-side stall), or `heap_textures` is not running at all and the census is stale. The code has no direct wait edge from the title to a queue slot; the only circular shape is indirect VRAM/commit competition, which is unproven. **Probe to add (diagnostics only, no hot path):** a 5 s line with `HEAP_TEXTURE_PASSES` (once per real pass), `HEAP_TEXTURES_ARRIVED` (due slot found with `mapped > 0` after class 1), a **split of class 1** (never uploaded / recheck / held), and the already-defined but never-printed `HEAP_TEXTURES_FULL` and `HEAP_TEXTURES_REUPLOADED_FULL`, plus last `room`, `used/budget`, `KINDS[1]`, `tiles::given_total()` and `pool::texture_room()`. Outcomes it separates: passes growing with `away` growing and uploads flat → title not mapping; everything flat → pass not running; `room` false with held/recheck growing → VRAM circular wait; uploads and arrived growing while class 1 is flat → recheck churn. Three device-free tests are possible in the existing `TextureQueue` tests: a slot looked at without memory is due again without a mapping event; an uploaded slot waiting for a re-look counts as class 1; a held slot that was looked at before stays class 1. No fix is proposed until the probe says which population it is.

Baseline healthy-run reading from #3457 (871a5a9a6d, NVIDIA RTX 5070 12 GB, Windows 11, -SeriesS, 315 s automated run, 0 errors):

In a healthy run the ~16,700 "waiting for their memory" figure splits almost entirely into recheck (99.1%), not unmapped never-uploaded textures:

  • End of run (315 s): 16682 waiting for their memory = never_uploaded=151 + recheck=16531, held_for_room=0, passes=11441, first_arrivals=0, full=0, reuploaded_full=0, room=true (used_mb=8136 / budget_mb=11176).

This confirms @KelboLive's read-only audit on real hardware — on an 8 GB stuck run, the #3457 line will immediately separate whether passes stops advancing, never_uploaded grows, or held_for_room / full climbs under room=false.

AI-assisted: yes

Baseline healthy-run reading from #3457 (`871a5a9a6d`, NVIDIA RTX 5070 12 GB, Windows 11, `-SeriesS`, 315 s automated run, 0 errors): In a healthy run the `~16,700` `"waiting for their memory"` figure splits almost entirely into **`recheck` (`99.1%`)**, not unmapped never-uploaded textures: - End of run (`315 s`): `16682 waiting for their memory` = `never_uploaded=151` + `recheck=16531`, `held_for_room=0`, `passes=11441`, `first_arrivals=0`, `full=0`, `reuploaded_full=0`, `room=true` (`used_mb=8136` / `budget_mb=11176`). This confirms @KelboLive's read-only audit on real hardware — on an 8 GB stuck run, the `#3457` line will immediately separate whether `passes` stops advancing, `never_uploaded` grows, or `held_for_room` / `full` climbs under `room=false`. AI-assisted: yes
Sign in to join this conversation.
No assignees
No project
No milestone
Dependencies

No dependencies set

Notifications
4 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
leonida/mandy#3434
No description provided.