D3D12.X: the shared view heap logs how full it gets #1254

Open
github-bot wants to merge 1 commit from github-bot/gh-1254 into main AGit
Owner

@⁠not-rex on GitHub · 2026-11-24 13:47 UTC · original
not-rex:heap-fill-diag → main · +50 −3 · 1 files · 1 commits · open

Diagnostics only. All console view heaps share one shader-visible PC heap (1 000 000 descriptors on NVIDIA, 512 per page of 256 slots), and today the only line about its fill is the warning when it is completely full. This logs the fill at 25 / 50 / 75 / 90 %, once each, so a log shows how close a title gets.

Why now: the newer retail title makes a view heap of 1 245 184 slots, and another project (VIctory #747, RTX 4070 Ti; an observation only, no code from it) measured about 1.1M of its slots written, with its descriptor tables reaching the top of the heap. Whether that costs XCL any pages depends on whether those slots are written by device calls or as memory copies, which nothing in XCL's log shows. No behaviour change.

What is in it

  • crates/xcl/src/hle/d3d12x/console_heap.rs: the shared heap (Global) counts the descriptors and pages it has given out (reserve_global adds, release_global subtracts). When a page is placed and the count first reaches 25, 50, 75 or 90 % of the heap, one xlog_info! line:
    console descriptor heaps: the shared heap is 25 % full – 250368 of 1000000 view descriptors given out, 489 pages placed, high-water mark 250368
    
    (format example: the numbers are what an NVIDIA heap of whole 512-descriptor pages would print at 25 % with nothing released, not from a run)
    The levels are of the descriptors given out. The high-water mark is there because the "is full" warning comes from it: released ranges go to a first-fit list that is not merged, so the heap can be full before every descriptor is given out. Each level is logged once per run (the highest level logged is a field of the shared heap, under its lock). The check is a multiply and compare when a page is placed; nothing per slot.
  • Same file: the XCL_TRACE_FRAME view-heap census line also gives each heap's placed pages: frame trace: view heap 0x... (1245184 slots, shader visible, P of 4864 pages in the shared heap): ... (not in the shared heap for a heap that has no pages there).
  • Test: shared_heap_fill_levels (unit, no GPU): the levels reached at and just below each boundary, the 489th NVIDIA page as the first 25 % one, and no overflow at u32::MAX.

Rebased on main cbc296ab (head d88c2aa): main now merges released ranges in release_global and reserves 20 descriptors before the first page; the fill counters update after the merge, and the comment and the commit message's example (high-water mark 250,388) follow that.

Tested

  • RTX 3080, cargo test --workspace -- --test-threads=4 at the head d88c2aa: 1155 passed, 0 failed, 46 ignored; the SKIPPED lines are main's lower/lower_dxil GPU agreement tests, the two no-wave64 tests and pso_measurement_compiles_an_exact_synthetic_record.
  • NVIDIA GeForce RTX 3080 10 GB (driver 610.88 / 32.0.16.1088), AMD Ryzen 9 5900X, Windows 11 Pro 26200; Rust 1.100.0 stable-x86_64-pc-windows-msvc; tests in the default (debug) profile, smoke runs in release.
  • cargo test --workspace -- --test-threads=4: 738 passed, 0 failed, 41 ignored (SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask and gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware, both "no wave64"). main 384f7f7 on the same machine: 737 passed, 0 failed, 41 ignored, the same two SKIPPED.
  • Game: the retail title (Xbox Series 1.0.2.1), 300 s. It logs console descriptor heaps: one shader-visible PC heap of 1000000 view descriptors for all of them and its view heap of 1 245 184 slots; it stayed in its first-run screens and menus (no world loading), and the shared heap stayed under 25 %, so no fill line was written.

Regression run
RTX 3080, scripts/smoke.ps1, 300 s each, menus only (fresh data): main 8f5fca5b and then this PR's head d88c2aa (rebased on main cbc296ab):

xcl-smoke v1
commit: 8f5fca5bb9ad6e695093d75294ad2cec023bba60
gpu: NVIDIA GeForce RTX 3080
title: 06a19912
seconds: 300
exit: 0x0
frames shown: 8341 (PresentX 8341)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15512 MB
xcl-smoke v1
commit: d88c2aa0fca8f82e7f5f9a4afcbdb98afe26db18
gpu: NVIDIA GeForce RTX 3080
title: 06a19912
seconds: 300
exit: 0x0
frames shown: 8235 (PresentX 8236)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15342 MB

Not tested

  • A fill line from a real title: the title did not reach world loading on this machine in 300 s, and the heap stayed under 25 % (see Tested).
  • The counting in reserve_global / release_global and the once-per-level logging have no test of their own: they need the process-wide shared heap, which needs a device. Only the level function is unit-tested.
  • AMD (2 097 152-descriptor heap), vkd3d-proton / Wine.

AI use

  • Claude Code (Claude Opus 5.5) wrote the code, the tests and this description; a Claude Opus 5.5 reviewer agent read the diff, and the fixes it asked for are in. The hardware suite and the smoke runs above were run by Claude Code (Claude Opus 5.5) agents on the RTX 3080 named, in a restricted local account; the counts and blocks are copied from those runs.
**@⁠not-rex** on GitHub · 2026-11-24 13:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1254) `not-rex:heap-fill-diag` → `main` · +50 −3 · 1 files · 1 commits · open Diagnostics only. All console view heaps share one shader-visible PC heap (1 000 000 descriptors on NVIDIA, 512 per page of 256 slots), and today the only line about its fill is the warning when it is completely full. This logs the fill at 25 / 50 / 75 / 90 %, once each, so a log shows how close a title gets. Why now: the newer retail title makes a view heap of 1 245 184 slots, and another project (VIctory #747, RTX 4070 Ti; an observation only, no code from it) measured about 1.1M of its slots written, with its descriptor tables reaching the top of the heap. Whether that costs XCL any pages depends on whether those slots are written by device calls or as memory copies, which nothing in XCL's log shows. No behaviour change. **What is in it** - `crates/xcl/src/hle/d3d12x/console_heap.rs`: the shared heap (`Global`) counts the descriptors and pages it has given out (`reserve_global` adds, `release_global` subtracts). When a page is placed and the count first reaches 25, 50, 75 or 90 % of the heap, one `xlog_info!` line: ``` console descriptor heaps: the shared heap is 25 % full – 250368 of 1000000 view descriptors given out, 489 pages placed, high-water mark 250368 ``` (format example: the numbers are what an NVIDIA heap of whole 512-descriptor pages would print at 25 % with nothing released, not from a run) The levels are of the descriptors given out. The high-water mark is there because the "is full" warning comes from it: released ranges go to a first-fit list that is not merged, so the heap can be full before every descriptor is given out. Each level is logged once per run (the highest level logged is a field of the shared heap, under its lock). The check is a multiply and compare when a page is placed; nothing per slot. - Same file: the `XCL_TRACE_FRAME` view-heap census line also gives each heap's placed pages: `frame trace: view heap 0x... (1245184 slots, shader visible, P of 4864 pages in the shared heap): ...` (`not in the shared heap` for a heap that has no pages there). - Test: `shared_heap_fill_levels` (unit, no GPU): the levels reached at and just below each boundary, the 489th NVIDIA page as the first 25 % one, and no overflow at `u32::MAX`. **Rebased** on `main` `cbc296ab` (head `d88c2aa`): main now merges released ranges in `release_global` and reserves 20 descriptors before the first page; the fill counters update after the merge, and the comment and the commit message's example (high-water mark 250,388) follow that. **Tested** - RTX 3080, `cargo test --workspace -- --test-threads=4` at the head `d88c2aa`: 1155 passed, 0 failed, 46 ignored; the SKIPPED lines are main's lower/lower_dxil GPU agreement tests, the two no-wave64 tests and `pso_measurement_compiles_an_exact_synthetic_record`. - NVIDIA GeForce RTX 3080 10 GB (driver 610.88 / 32.0.16.1088), AMD Ryzen 9 5900X, Windows 11 Pro 26200; Rust 1.100.0 `stable-x86_64-pc-windows-msvc`; tests in the default (debug) profile, smoke runs in release. - `cargo test --workspace -- --test-threads=4`: 738 passed, 0 failed, 41 ignored (SKIPPED GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware`, both "no wave64"). `main` 384f7f7 on the same machine: 737 passed, 0 failed, 41 ignored, the same two SKIPPED. - Game: the retail title (Xbox Series 1.0.2.1), 300 s. It logs `console descriptor heaps: one shader-visible PC heap of 1000000 view descriptors for all of them` and its view heap of 1 245 184 slots; it stayed in its first-run screens and menus (no world loading), and the shared heap stayed under 25 %, so no fill line was written. **Regression run** RTX 3080, `scripts/smoke.ps1`, 300 s each, menus only (fresh data): `main` `8f5fca5b` and then this PR's head `d88c2aa` (rebased on `main` `cbc296ab`): ``` xcl-smoke v1 commit: 8f5fca5bb9ad6e695093d75294ad2cec023bba60 gpu: NVIDIA GeForce RTX 3080 title: 06a19912 seconds: 300 exit: 0x0 frames shown: 8341 (PresentX 8341) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 15512 MB ``` ``` xcl-smoke v1 commit: d88c2aa0fca8f82e7f5f9a4afcbdb98afe26db18 gpu: NVIDIA GeForce RTX 3080 title: 06a19912 seconds: 300 exit: 0x0 frames shown: 8235 (PresentX 8236) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15342 MB ``` **Not tested** - A fill line from a real title: the title did not reach world loading on this machine in 300 s, and the heap stayed under 25 % (see Tested). - The counting in `reserve_global` / `release_global` and the once-per-level logging have no test of their own: they need the process-wide shared heap, which needs a device. Only the level function is unit-tested. - AMD (2 097 152-descriptor heap), vkd3d-proton / Wine. **AI use** - Claude Code (Claude Opus 5.5) wrote the code, the tests and this description; a Claude Opus 5.5 reviewer agent read the diff, and the fixes it asked for are in. The hardware suite and the smoke runs above were run by Claude Code (Claude Opus 5.5) agents on the RTX 3080 named, in a restricted local account; the counts and blocks are copied from those runs.
All console view heaps share one shader-visible PC heap, a page of 256
slots (512 descriptors) at a time. On NVIDIA it holds 1 000 000
descriptors, and the only line about its fill was the warning when it is
completely full, so a log could not show how close a title gets.

The newer retail title makes a view heap of 1 245 184 slots. Another
project (VIctory #747, RTX 4070 Ti) measured about 1.1M of its slots
written and its descriptor tables reaching the top of the heap. Whether
that costs XCL pages depends on how the slots are written (device calls
or memory copies), which no log shows today.

The shared heap now counts the descriptors and pages it gives out and
logs once, the first time each of 25 / 50 / 75 / 90 % is reached:

  console descriptor heaps: the shared heap is 25 % full – 250368 of
  1000000 view descriptors given out, 489 pages placed, high-water mark
  250388

The levels are of the descriptors given out to view heaps' pages. The
line also gives the high-water mark, because the full warning comes from
that: it counts the 20 descriptors below the pages (null views and the
memory windows' views), and released ranges, though merged, can leave
gaps too short for a page, so the heap can be full before every
descriptor is given out.

The check runs only when a page is placed, not per slot. The
XCL_TRACE_FRAME view-heap census line also says how many of each heap's
pages are placed in the shared heap. No behaviour change.

Assisted-by: Claude Code (Claude Opus 5.5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:48:35 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-11-24 14:00 UTC · original

Ran the new fill-level test and the console_heap unit set at 7bf6c2a:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --lib shared_heap_fill_levels
1 passed; 0 failed; 0 ignored      (exit 0)

XCL_ADAPTER=nvidia cargo test -p xcl --lib console_heap
4 passed; 0 failed; 0 ignored      (exit 0)

shared_heap_fill_levels passes and the rest of the heap tests are unaffected. This is a debug build on a Blackwell part with driver 32.0.16.2124; the author's run was an RTX 3080 on the same Windows build.

Not tested: retail titles, RDNA2/RDNA4 and Intel GPUs, Wine, release profile.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified.

**@⁠Aniseto** on GitHub · 2026-11-24 14:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/1254#issuecomment-7133684659) Ran the new fill-level test and the `console_heap` unit set at `7bf6c2a`: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` XCL_ADAPTER=nvidia cargo test -p xcl --lib shared_heap_fill_levels 1 passed; 0 failed; 0 ignored (exit 0) XCL_ADAPTER=nvidia cargo test -p xcl --lib console_heap 4 passed; 0 failed; 0 ignored (exit 0) ``` `shared_heap_fill_levels` passes and the rest of the heap tests are unaffected. This is a debug build on a Blackwell part with driver 32.0.16.2124; the author's run was an RTX 3080 on the same Windows build. Not tested: retail titles, RDNA2/RDNA4 and Intel GPUs, Wine, release profile. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash 1017** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 14:02 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib lib console_heap shared_heap_fill_levels: 1 passed, 0 failed.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 14:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1254#issuecomment-7133732727) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib lib console_heap shared_heap_fill_levels: 1 passed, 0 failed. Thanks!
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:32 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • Does not compile after the merge — semantic conflict, not a textual one:
error[E0063]: missing fields `logged`, `pages` and `used` in initializer of `console_heap::Global`
    --> crates\xcl\src\hle\d3d12x\console_heap.rs:1168:44

The PR's Global literal predates fields that main added; needs a rebase that fills them in.

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 04:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/1254#issuecomment-7182682668) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - Does not compile after the merge — semantic conflict, not a textual one: ``` error[E0063]: missing fields `logged`, `pages` and `used` in initializer of `console_heap::Global` --> crates\xcl\src\hle\d3d12x\console_heap.rs:1168:44 ``` The PR's `Global` literal predates fields that `main` added; needs a rebase that fills them in. — Devin
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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 origin '+refs/pull/1254/head:github-bot/gh-1254'
git switch 'github-bot/gh-1254'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1254'
git switch 'github-bot/gh-1254'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1254'
git switch 'github-bot/gh-1254'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1254'
git switch 'main'
git merge --squash 'github-bot/gh-1254'
git switch 'main'
git merge --ff-only 'github-bot/gh-1254'
git switch 'main'
git merge 'github-bot/gh-1254'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.