d3d12-gpu: measure the texture queue's class 1, passes and arrivals (#3434) #3457

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u  "d3d12/queue-probe:KelboLive-d3d12/queue-probe"
git switch "KelboLive-d3d12/queue-probe"
Open
leonida/mandy
KelboLive wants to merge 3 commits from KelboLive/mandy:d3d12/queue-probe into main

This pull request can be merged automatically.

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'd3d12/queue-probe:KelboLive-d3d12/queue-probe'
git switch 'KelboLive-d3d12/queue-probe'
First-time contributor

What/why

#3434: on an 8 GB card the scene can stay flat grey with the texture queue reported as ~17,000 'waiting for their memory'. A read-only audit found that number is ambiguous in the code and that the queue has no retry deadlock, so the next step is measurement, not a fix:

  • census[2] mixes never-uploaded, recheck-after-upload (recheck sets looks = 1, mapped = 0) and held slots; a flat class 1 is therefore not a liveness signal.
  • The retry does not need a mapping event (later re-arms on the frame alone), so 'waiting for an event the title never sends' is out.
  • HEAP_TEXTURES_FULL / HEAP_TEXTURES_REUPLOADED_FULL were defined but never printed.

Changes (measurement only)

  • descriptor/host.rs: TextureQueue::census_split() - the class-1 partition (never uploaded / recheck) plus the held-map length - and a class-1 accessor for arrivals. The existing census columns are unchanged.
  • draw.rs: HEAP_TEXTURE_PASSES (once per real pass), HEAP_TEXTURES_ARRIVED (a due slot found with mapped > 0 while class 1), the class-1 split snapshot, and the last pass's room.
  • host.rs: one five-second diagnostics line inside the existing five-second block. It prints passes, arrived, full, reuploaded_full, never_uploaded, recheck, held, room, used/budget, KINDS[1], tiles::given_total() and pool::texture_room().
  • No retry, room or upload path is changed. The 25k-slot split walk runs at most once per 5 s, not per pass; the whole probe is diagnostics-gated and compiles out otherwise.

Tests

Three device-free tests in the existing TextureQueue tests, using only the pure APIs:

  • a slot looked at without memory is due again without a mapping event;
  • an uploaded slot waiting for a re-look counts in class 1;
  • a held slot that was looked at before stays in class 1.

cargo test -p leonida-gpu --locked --lib -- --test-threads=1: 758 passed, 0 failed, 60 ignored; --features diagnostics check compiles; clippy, no-game-data and diff clean.

What a run would show

Probe outcome Hypothesis
passes and arrived grow, uploads ~0 title is not mapping pages (title-side stall)
everything flat the pass is not running / counters are stale
room == false, held/recheck growing, full growing VRAM/room circular wait
arrived and uploads grow while class 1 is flat recheck churn; the counter was misleading
due high and oldest due grows due/budget starvation (slow, not stuck)

No fix is proposed until the probe says which. A game run is needed; none was made here.

Item: D3D12-TEXTURE-QUEUE-PROBE, claimed in #3312. Depends on: none.
AI-assisted: DeepSeek V4.1 Flash (OpenCode); a read-only audit produced the mechanism map and this probe.

## What/why #3434: on an 8 GB card the scene can stay flat grey with the texture queue reported as ~17,000 'waiting for their memory'. A read-only audit found that number is ambiguous in the code and that the queue has no retry deadlock, so the next step is measurement, not a fix: - census[2] mixes never-uploaded, recheck-after-upload (recheck sets looks = 1, mapped = 0) and held slots; a flat class 1 is therefore not a liveness signal. - The retry does not need a mapping event (later re-arms on the frame alone), so 'waiting for an event the title never sends' is out. - HEAP_TEXTURES_FULL / HEAP_TEXTURES_REUPLOADED_FULL were defined but never printed. ## Changes (measurement only) - descriptor/host.rs: TextureQueue::census_split() - the class-1 partition (never uploaded / recheck) plus the held-map length - and a class-1 accessor for arrivals. The existing census columns are unchanged. - draw.rs: HEAP_TEXTURE_PASSES (once per real pass), HEAP_TEXTURES_ARRIVED (a due slot found with mapped > 0 while class 1), the class-1 split snapshot, and the last pass's room. - host.rs: one five-second diagnostics line inside the existing five-second block. It prints passes, arrived, full, reuploaded_full, never_uploaded, recheck, held, room, used/budget, KINDS[1], tiles::given_total() and pool::texture_room(). - No retry, room or upload path is changed. The 25k-slot split walk runs at most once per 5 s, not per pass; the whole probe is diagnostics-gated and compiles out otherwise. ## Tests Three device-free tests in the existing TextureQueue tests, using only the pure APIs: - a slot looked at without memory is due again without a mapping event; - an uploaded slot waiting for a re-look counts in class 1; - a held slot that was looked at before stays in class 1. cargo test -p leonida-gpu --locked --lib -- --test-threads=1: 758 passed, 0 failed, 60 ignored; --features diagnostics check compiles; clippy, no-game-data and diff clean. ## What a run would show | Probe outcome | Hypothesis | |---|---| | passes and arrived grow, uploads ~0 | title is not mapping pages (title-side stall) | | everything flat | the pass is not running / counters are stale | | room == false, held/recheck growing, full growing | VRAM/room circular wait | | arrived and uploads grow while class 1 is flat | recheck churn; the counter was misleading | | due high and oldest due grows | due/budget starvation (slow, not stuck) | No fix is proposed until the probe says which. A game run is needed; none was made here. Item: D3D12-TEXTURE-QUEUE-PROBE, claimed in #3312. Depends on: none. AI-assisted: DeepSeek V4.1 Flash (OpenCode); a read-only audit produced the mechanism map and this probe.
KelboLive force-pushed d3d12/queue-probe from 8c39e19d20 to 871a5a9a6d 2026-12-04 15:10:34 +00:00 Compare
Author
First-time contributor

Rebased onto main 44c480a5f (head 871a5a9a6). No conflicts. Re-ran: 764 passed, 0 failed, 60 ignored.

Rebased onto `main` `44c480a5f` (head `871a5a9a6`). No conflicts. Re-ran: 764 passed, 0 failed, 60 ignored.
First-time contributor

RUN — In-game Probe & Test Gate (NVIDIA RTX 5070 12 GB, Windows 11)

Tested PR head 871a5a9a6d fast-forwarded cleanly onto main (30c683055), diagnostic release build (-SeriesS, no frame generation, 315 s automated run from the same save), compared against main (30c683055):

Metric main (30c683055) PR #3457 (871a5a9a6d)
World samples (>=1000 draws) 36 (max_draws=5187) 37 (max_draws=5418)
Median FPS / frame time 23.0 fps (43.5 ms) 23.6 fps (42.3 ms)
Slowest 10% / fastest 10% 13.7 / 25.0 fps 16.2 / 25.0 fps
3000-4999 draws/frame median 23.2 fps (28 samples) 24.2 fps (26 samples)
Errors / warnings / device lost 0 / 0 / 0 0 / 0 / 0

Probe Output Observed (healthy 12 GB baseline for #3434)

The new five-second textures picked by index, the pass: line logged cleanly (62 snapshots) and immediately confirmed the class-1 split hypothesis:

  • At end of run (315 s): waiting for their memory = 16682 splits cleanly into never_uploaded=151 (0.9%) and recheck=16531 (99.1%) (151 + 16531 = 16682), with passes=11441, first_arrivals=0, full=0, reuploaded_full=0, held_for_room=0, room=true, used_mb=8136, budget_mb=11176, title_textures_mb=4503, tiles_mb=0, pool_texture_room_mb=808.
  • Mid-run (~210 s, after world entry): passes=8974, never_uploaded=155, recheck=16535, held_for_room=0, room=true.

Unit & Repo Checks

  • cargo test -p leonida-gpu --lib --locked descriptor::host:: — 64/64 PASS (5 ignored)
  • cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings — 0 warnings
  • python -I scripts/check_no_game_data.py — PASS
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md — FAIL (exit 1): missing from the page: LEONIDA_WAIT_TEST_CHILD

Verdict

Probe output, unit tests, clippy, and live stability look clean with no FPS regression. Only CI blocker before merge is LEONIDA_WAIT_TEST_CHILD failing d3d12_switches.py --check (either rename the test-only env var off the LEONIDA_ prefix or regenerate d3d12/docs/switches.md).

AI-assisted: yes

### RUN — In-game Probe & Test Gate (NVIDIA RTX 5070 12 GB, Windows 11) Tested PR head `871a5a9a6d` fast-forwarded cleanly onto `main` (`30c683055`), diagnostic release build (`-SeriesS`, no frame generation, 315 s automated run from the same save), compared against `main` (`30c683055`): | Metric | `main` (`30c683055`) | PR `#3457` (`871a5a9a6d`) | | --- | --- | --- | | World samples (`>=1000` draws) | `36` (`max_draws=5187`) | `37` (`max_draws=5418`) | | Median FPS / frame time | `23.0 fps` (`43.5 ms`) | `23.6 fps` (`42.3 ms`) | | Slowest 10% / fastest 10% | `13.7` / `25.0 fps` | `16.2` / `25.0 fps` | | `3000-4999` draws/frame median | `23.2 fps` (`28` samples) | `24.2 fps` (`26` samples) | | Errors / warnings / device lost | `0` / `0` / `0` | `0` / `0` / `0` | ### Probe Output Observed (healthy 12 GB baseline for #3434) The new five-second `textures picked by index, the pass:` line logged cleanly (`62` snapshots) and immediately confirmed the class-1 split hypothesis: - At end of run (`315 s`): `waiting for their memory = 16682` splits cleanly into **`never_uploaded=151` (`0.9%`)** and **`recheck=16531` (`99.1%`)** (`151 + 16531 = 16682`), with `passes=11441`, `first_arrivals=0`, `full=0`, `reuploaded_full=0`, `held_for_room=0`, `room=true`, `used_mb=8136`, `budget_mb=11176`, `title_textures_mb=4503`, `tiles_mb=0`, `pool_texture_room_mb=808`. - Mid-run (`~210 s`, after world entry): `passes=8974`, `never_uploaded=155`, `recheck=16535`, `held_for_room=0`, `room=true`. ### Unit & Repo Checks - `cargo test -p leonida-gpu --lib --locked descriptor::host::` — `64/64` PASS (`5` ignored) - `cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings` — `0` warnings - `python -I scripts/check_no_game_data.py` — PASS - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` — **FAIL** (exit `1`): `missing from the page: LEONIDA_WAIT_TEST_CHILD` ### Verdict Probe output, unit tests, clippy, and live stability look clean with no FPS regression. Only CI blocker before merge is `LEONIDA_WAIT_TEST_CHILD` failing `d3d12_switches.py --check` (either rename the test-only env var off the `LEONIDA_` prefix or regenerate `d3d12/docs/switches.md`). AI-assisted: yes
KelboLive force-pushed d3d12/queue-probe from 871a5a9a6d to c9f514d592 2026-12-04 15:57:06 +00:00 Compare
Author
First-time contributor

Replayed onto main bba262b94 (head c9f514d59), including #3478's queue.rs/draw.rs rework. Merged cleanly; re-ran: 783 passed, 0 failed, 60 ignored. Semantic read of the merged probe against the new command-list tables is still in flight.

Replayed onto `main` `bba262b94` (head `c9f514d59`), including #3478's `queue.rs`/`draw.rs` rework. Merged cleanly; re-ran: 783 passed, 0 failed, 60 ignored. Semantic read of the merged probe against the new command-list tables is still in flight.
Author
First-time contributor

Deferred check, now done: the merged draw.rs/list.rs read against #3478 is disjoint.

  • All probe edits are in State::heap_textures (diagnostics statics, pass counter, HEAP_TEXTURES_ROOM, the 5 s census_split beat, first-arrival counter), descriptor/host.rs and the host.rs line. #3478's draw.rs change is the DispatchX flag split (counted_in_threads, WAVES_OF_32) - different path, no shared state or counters.
  • #3478's copy/DMA-list type-16 table does not feed TextureQueue (its slots come from descriptor writes, not DMA list commands), so the class-1 split and arrivals cannot be shifted by it; the 38-slot/slot-37 change is vtable layout the probe never indexes.
  • The probe's five TextureQueue tests and #3478's queue tests pass in the same 783-test run.
Deferred check, now done: **the merged `draw.rs`/`list.rs` read against #3478 is disjoint.** - All probe edits are in `State::heap_textures` (diagnostics statics, pass counter, `HEAP_TEXTURES_ROOM`, the 5 s `census_split` beat, first-arrival counter), `descriptor/host.rs` and the `host.rs` line. #3478's `draw.rs` change is the `DispatchX` flag split (`counted_in_threads`, `WAVES_OF_32`) - different path, no shared state or counters. - #3478's copy/DMA-list type-16 table does not feed `TextureQueue` (its slots come from descriptor writes, not DMA list commands), so the class-1 split and arrivals cannot be shifted by it; the 38-slot/slot-37 change is vtable layout the probe never indexes. - The probe's five `TextureQueue` tests and #3478's queue tests pass in the same 783-test run.
KelboLive force-pushed d3d12/queue-probe from c9f514d592 to 0a1f6c2812 2026-12-04 16:15:56 +00:00 Compare
Author
First-time contributor

Replayed onto main e1be896b2 (head 0a1f6c281). No conflicts. 783 passed, 0 failed, 60 ignored.

One extra docs commit: the probe changed the LEONIDA_HEAP_TEXTURES doc line, so the generated page was stale and --check failed on this branch. Regenerated (one row).

Replayed onto `main` `e1be896b2` (head `0a1f6c281`). No conflicts. 783 passed, 0 failed, 60 ignored. One extra docs commit: the probe changed the `LEONIDA_HEAP_TEXTURES` doc line, so the generated page was stale and `--check` failed on this branch. Regenerated (one row).
KelboLive force-pushed d3d12/queue-probe from 0a1f6c2812 to 7b655d28cc 2026-12-04 16:32:33 +00:00 Compare
Author
First-time contributor

Replayed onto main 00e245be5 (head 7b655d28c), including #3291's draw.rs rework (+319). No conflicts, and the probe's heap_textures block still lands cleanly; switch page --check ok. 793 passed, 0 failed, 60 ignored.

Replayed onto `main` `00e245be5` (head `7b655d28c`), including #3291's `draw.rs` rework (+319). No conflicts, and the probe's `heap_textures` block still lands cleanly; switch page `--check` ok. 793 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from 7b655d28cc to 4b0b3e931c 2026-12-04 17:15:13 +00:00 Compare
Author
First-time contributor

Replayed onto main f22b9fa64 (head 4b0b3e931), crossing another draw.rs rework (#3482, +223). No conflicts; switch page ok. 796 passed, 0 failed, 60 ignored.

Replayed onto `main` `f22b9fa64` (head `4b0b3e931`), crossing another `draw.rs` rework (#3482, +223). No conflicts; switch page ok. 796 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from 4b0b3e931c to 14cbc1efb5 2026-12-04 18:30:22 +00:00 Compare
Author
First-time contributor

Replayed onto main 6491bc1a1 (head 14cbc1efb), crossing #3486's descriptor/host.rs change. No conflicts; switch page ok. 796 passed, 0 failed, 60 ignored.

Replayed onto `main` `6491bc1a1` (head `14cbc1efb`), crossing #3486's `descriptor/host.rs` change. No conflicts; switch page ok. 796 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from 14cbc1efb5 to b36fe26e48 2026-12-04 18:44:14 +00:00 Compare
Author
First-time contributor

Replayed onto main 6b0498d37 (head b36fe26e4). No conflicts. 796 passed, 0 failed, 60 ignored.

Replayed onto `main` `6b0498d37` (head `b36fe26e4`). No conflicts. 796 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from b36fe26e48 to 21f3d4f662 2026-12-04 20:52:57 +00:00 Compare
Author
First-time contributor

Replayed onto main 0036195a7 (head 21f3d4f66). No conflicts. 796 passed, 0 failed, 60 ignored.

Replayed onto `main` `0036195a7` (head `21f3d4f66`). No conflicts. 796 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from 21f3d4f662 to cc96cac076 2026-12-04 23:20:22 +00:00 Compare
Author
First-time contributor

Replayed onto main f4b0404e9 (head cc96cac07). No conflicts. 796 passed, 0 failed, 60 ignored.

Replayed onto `main` `f4b0404e9` (head `cc96cac07`). No conflicts. 796 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from cc96cac076 to a17ed79ab7 2026-12-05 05:34:46 +00:00 Compare
Author
First-time contributor

Replayed onto main 93b9d90a2 (head a17ed79ab). No conflicts. 796 passed, 0 failed, 60 ignored.

Replayed onto `main` `93b9d90a2` (head `a17ed79ab`). No conflicts. 796 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from a17ed79ab7 to dbd220ef58 2026-12-05 08:44:25 +00:00 Compare
Author
First-time contributor

Replayed onto main c5355dd25 (head dbd220ef5), which adds #2975's raw-view test in the same descriptor/host.rs. No conflict; 797 passed, 0 failed, 60 ignored.

Replayed onto `main` `c5355dd25` (head `dbd220ef5`), which adds #2975's raw-view test in the same `descriptor/host.rs`. No conflict; 797 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from dbd220ef58 to c94ef7ae1b 2026-12-05 08:53:16 +00:00 Compare
Author
First-time contributor

Replayed onto main e1b0248c1 (head c94ef7ae1). No conflicts. 797 passed, 0 failed, 60 ignored.

Replayed onto `main` `e1b0248c1` (head `c94ef7ae1`). No conflicts. 797 passed, 0 failed, 60 ignored.
KelboLive force-pushed d3d12/queue-probe from c94ef7ae1b to b8e0f4bcc4 2026-12-05 09:59:40 +00:00 Compare
Author
First-time contributor

Replayed onto main d99bb4d7a (head b8e0f4bcc). No conflicts. 800 passed, 0 failed, 60 ignored.

Replayed onto `main` `d99bb4d7a` (head `b8e0f4bcc`). No conflicts. 800 passed, 0 failed, 60 ignored.
Sign in to join this conversation.
No description provided.