D3D12.X: cap two-pass buffers by DXGI headroom with wait and shrink #2817

Open
github-bot wants to merge 3 commits from github-bot/gh-2817 into nvidia-dev AGit
Owner

@⁠coolpersonnn on GitHub · 2026-11-26 14:22 UTC · original
coolpersonnn:ws2/two-pass-budget-fallback → nvidia-dev · +1342 −108 · 2 files · 3 commits · open

Stacked on #2816; only the top commit belongs here.

Bound the default two-pass pool cap using live DXGI local VRAM headroom instead of a fixed 1024 MiB threshold, and wait briefly on pending submit fences or shrink/reuse existing indirect buffers instead of immediately skipping draws at cap.

Part of #2688

What is in it

  • Compute default two_pass_cap from budget_two_pass_cap: 1/4 of remaining DXGI local VRAM headroom, clamped to [256 MiB, 2048 MiB] and capped at local_budget / 4 on smaller cards (1024 MiB fallback if budget is unavailable, cached for 250 ms; XCL_TWO_PASS_MB still overrides), and scale FREE_RES retention accordingly.
  • Add FENCE_WAIT_LIMIT (50 ms) polling across pending FencedBatch entries before refusing allocation, and shrink or reuse an already-sufficient (>= min_fit) command-list buffer (TP_WAITED, TP_SHRUNK) under tight cap pressure.
  • Unit tests for DXGI headroom cap scaling, multi-batch fence wait reclamation, and shrink/reuse-existing fallback behavior.

Tested

  • Hardware & toolchain: Windows 11 x64 (26200/26300), Ryzen 9 9950X3D, 95,800 MB RAM, NVIDIA GeForce RTX 5090 (32 GB, driver 621.01, DXC 1.8.2502.11), rustc 1.100.0, release + test builds.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1,753 passed, 10 failed, 48 ignored across 41 test binaries; 27 explicit SKIPPED GPU tests (hle::d3d12x::bind: 46 passed incl. 1 SKIPPED two_pass_binds_set_the_shared_view_heap: no heap windows; hle::d3d12x::alloc_pool: 8 passed). All 10 failures are pre-existing failures also present on unmodified nvidia-dev (af2cecc4).
  • cargo build --release -p xcl --bin xcl: exited 0.
  • Issue #2688 matched 120 s evidence (title: a93b40d7, XCL_PREPARE=0, XCL_NETWORK=0, XCL_LOOK_STATS=2, warm DXIL+driver caches):
    • Warm-cache af2cecc4 (1024 MiB cap) vs stacked head c1bf0e82 (XCL_TWO_PASS_MB=1024): two-pass alive memory at world-entry burst dropped from 998 MiB (68 buffers, 598 MiB waiting for allocator resets, 73 not made past 1024 MiB, 4,096 draws skipped) to 129 MiB (64 buffers, 11 taken again, 0 MiB waiting for GPU fences/allocator resets, 0 not made past 1024 MiB, 0 draws skipped) — -869 MiB (-87.1%) two-pass VRAM; total peak commit 37,596 MB -> 36,945 MB (-651 MB), end commit 36,881 MB -> 34,989 MB (-1,892 MB), peak local VRAM 15,929 MB -> 15,297 MB (50.7% -> 48.7% of 31,419 MB DXGI budget), frames 1,426 -> 1,443, submit after unchanged (0.010 ms -> 0.010 ms), 0 tiles refused, 0 views left waiting.
    • 4 consecutive 120 s runs on c1bf0e82 (default headroom cap 2048 MiB): 4/4 completed cleanly with 0 device removals and 0 crashes (1,425 / 1,426 / 1,413 / 1,413 frames; peak local VRAM 14,931–15,425 MB / 31,419 MB; 0 skips, refusals, or views left waiting).

Regression run

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 5090
title: a93b40d7
seconds: 60
exit: 0x0
frames shown: 1670 (PresentX 1670)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16641 MB
xcl-smoke v1
commit: af2cecc40886a8682ecf3267f5328c6dc4b66ad7
gpu: NVIDIA GeForce RTX 5090
title: a93b40d7
seconds: 60
exit: 0x0
frames shown: 1682 (PresentX 1682)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18586 MB
xcl-smoke v1
commit: c1bf0e82183fd477e9f4dbed24773e8097782cee
gpu: NVIDIA GeForce RTX 5090
title: a93b40d7
seconds: 60
exit: 0x0
frames shown: 1685 (PresentX 1685)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16584 MB

Not tested

  • AMD RDNA2/3/4 and 8–16 GB NVIDIA GPUs (including triggering tight-budget TP_WAITED / TP_SHRUNK fallback on a small-VRAM GPU in live gameplay).
  • Sustained 2–10 min in-world play (blocked on unmodified nvidia-dev af2cecc4 by pre-existing multi-minute compute-PSO driver compiles at world entry when the full world shader cache is absent).
  • Optional XCL_HEAP_WINDOWS=1 heap-window test (two_pass_binds_set_the_shared_view_heap skipped by default).

AI use

  • T3 Code / Antigravity, Gemini Pro (Orchestrator Neon): implemented DXGI headroom capping, bounded fence-wait/shrink fallbacks, and unit tests; ran all builds, test suites, and 120 s / smoke benchmarks.
**@⁠coolpersonnn** on GitHub · 2026-11-26 14:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/2817) `coolpersonnn:ws2/two-pass-budget-fallback` → `nvidia-dev` · +1342 −108 · 2 files · 3 commits · open Stacked on #2816; only the top commit belongs here. Bound the default two-pass pool cap using live DXGI local VRAM headroom instead of a fixed 1024 MiB threshold, and wait briefly on pending submit fences or shrink/reuse existing indirect buffers instead of immediately skipping draws at cap. Part of #2688 **What is in it** - Compute default `two_pass_cap` from `budget_two_pass_cap`: 1/4 of remaining DXGI local VRAM headroom, clamped to `[256 MiB, 2048 MiB]` and capped at `local_budget / 4` on smaller cards (`1024 MiB` fallback if budget is unavailable, cached for 250 ms; `XCL_TWO_PASS_MB` still overrides), and scale `FREE_RES` retention accordingly. - Add `FENCE_WAIT_LIMIT` (`50 ms`) polling across pending `FencedBatch` entries before refusing allocation, and shrink or reuse an already-sufficient (`>= min_fit`) command-list buffer (`TP_WAITED`, `TP_SHRUNK`) under tight cap pressure. - Unit tests for DXGI headroom cap scaling, multi-batch fence wait reclamation, and shrink/reuse-existing fallback behavior. **Tested** - Hardware & toolchain: Windows 11 x64 (`26200/26300`), Ryzen 9 9950X3D, 95,800 MB RAM, NVIDIA GeForce RTX 5090 (32 GB, driver `621.01`, DXC `1.8.2502.11`), `rustc 1.100.0`, release + test builds. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1,753 passed, 10 failed, 48 ignored across 41 test binaries; 27 explicit `SKIPPED` GPU tests (`hle::d3d12x::bind`: 46 passed incl. 1 `SKIPPED two_pass_binds_set_the_shared_view_heap: no heap windows`; `hle::d3d12x::alloc_pool`: 8 passed). All 10 failures are pre-existing failures also present on unmodified `nvidia-dev` (`af2cecc4`). - `cargo build --release -p xcl --bin xcl`: exited 0. - Issue `#2688` matched 120 s evidence (`title: a93b40d7`, `XCL_PREPARE=0`, `XCL_NETWORK=0`, `XCL_LOOK_STATS=2`, warm DXIL+driver caches): - Warm-cache `af2cecc4` (`1024 MiB` cap) vs stacked head `c1bf0e82` (`XCL_TWO_PASS_MB=1024`): two-pass alive memory at world-entry burst dropped from `998 MiB` (`68` buffers, `598 MiB` waiting for allocator resets, `73 not made past 1024 MiB`, `4,096` draws skipped) to `129 MiB` (`64` buffers, `11 taken again`, `0 MiB` waiting for GPU fences/allocator resets, `0 not made past 1024 MiB`, `0` draws skipped) — **`-869 MiB` (`-87.1%`)** two-pass VRAM; total peak commit `37,596 MB -> 36,945 MB` (`-651 MB`), end commit `36,881 MB -> 34,989 MB` (`-1,892 MB`), peak local VRAM `15,929 MB -> 15,297 MB` (`50.7% -> 48.7%` of `31,419 MB` DXGI budget), frames `1,426 -> 1,443`, submit `after` unchanged (`0.010 ms` -> `0.010 ms`), `0` tiles refused, `0` views left waiting. - 4 consecutive 120 s runs on `c1bf0e82` (default headroom cap `2048 MiB`): `4/4` completed cleanly with `0` device removals and `0` crashes (`1,425 / 1,426 / 1,413 / 1,413` frames; peak local VRAM `14,931–15,425 MB` / `31,419 MB`; `0` skips, refusals, or views left waiting). **Regression run** ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 5090 title: a93b40d7 seconds: 60 exit: 0x0 frames shown: 1670 (PresentX 1670) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16641 MB ``` ``` xcl-smoke v1 commit: af2cecc40886a8682ecf3267f5328c6dc4b66ad7 gpu: NVIDIA GeForce RTX 5090 title: a93b40d7 seconds: 60 exit: 0x0 frames shown: 1682 (PresentX 1682) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18586 MB ``` ``` xcl-smoke v1 commit: c1bf0e82183fd477e9f4dbed24773e8097782cee gpu: NVIDIA GeForce RTX 5090 title: a93b40d7 seconds: 60 exit: 0x0 frames shown: 1685 (PresentX 1685) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16584 MB ``` **Not tested** - AMD RDNA2/3/4 and 8–16 GB NVIDIA GPUs (including triggering tight-budget `TP_WAITED` / `TP_SHRUNK` fallback on a small-VRAM GPU in live gameplay). - Sustained 2–10 min in-world play (blocked on unmodified `nvidia-dev` `af2cecc4` by pre-existing multi-minute compute-PSO driver compiles at world entry when the full world shader cache is absent). - Optional `XCL_HEAP_WINDOWS=1` heap-window test (`two_pass_binds_set_the_shared_view_heap` skipped by default). **AI use** - T3 Code / Antigravity, Gemini Pro (Orchestrator Neon): implemented DXGI headroom capping, bounded fence-wait/shrink fallbacks, and unit tests; ran all builds, test suites, and 120 s / smoke benchmarks.
Track per-queue fence marks on recordings that use two-pass mesh buffers
so retired buffers return to FREE_RES once their GPU submits finish
instead of waiting for allocator resets or the 10 s unknown-allocator
timeout. Untracked submits and bundles fall back safely to allocator
holding.

Part of #2688
Assisted-by: T3 Code / Antigravity (Gemini Pro Orchestrator Neon)
Record uncapped indirect DispatchMesh group counts in SCALE_ARGS_HLSL
via an async per-device readback/clear path committed on queue submit,
start cold indirect PSOs at 4 MiB with automatic clamp-driven growth,
and tighten record/scratch buckets to 256 KiB half-steps.

Part of #2688
Assisted-by: T3 Code / Antigravity (Gemini Pro Orchestrator Neon)
Derive the default two-pass pool cap from 1/4 of remaining DXGI local
VRAM headroom (clamped to [256 MiB, 2048 MiB] and bounded at
local_budget / 4 on smaller GPUs, with a 1024 MiB fallback when budget
is unknown; refreshed every 250 ms), wait up to 50 ms on pending submit
fences when at cap, and shrink or reuse already-fit indirect result
buffers before failing allocation.

Part of #2688
Assisted-by: T3 Code / Antigravity (Gemini Pro Orchestrator Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:25:11 +00:00
Author
Owner

@⁠ettehn on GitHub · 2026-11-26 14:27 UTC · original

Independent Windows check on the clean stacked head c1bf0e82183fd477e9f4dbed24773e8097782cee (nvidia-dev base af2cecc40886a8682ecf3267f5328c6dc4b66ad7). Windows 11 build 26200, Ryzen 9 8945HX, RTX 5070 Ti Laptop 12 GB (driver 621.24), Rust 1.97.1 MSVC debug, XCL_ADAPTER=NVIDIA, XCL_TWO_PASS_MB unset.

  • Default heap setting: cargo test --locked --offline -p xcl --lib -j 2 -- hle::d3d12x::bind::tests:: hle::d3d12x::alloc_pool::tests:: --skip two_pass_binds_set_the_shared_view_heap --test-threads=1 --nocapture reported 53 passed, 0 failed, 0 ignored, no reported skips. This includes the fence reclaim and multi-queue tests, uncapped GPU feedback, and the scripted budget/wait/shrink cases. The ExecuteIndirect case logged the RTX 5070 Ti Laptop as its adapter.
  • Fresh process with XCL_HEAP_WINDOWS=1 XCL_REQUIRE_GPU=wave64: cargo test --locked --offline -p xcl --lib -j 2 -- hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap --exact --test-threads=1 --nocapture reported 1 passed, 0 failed, 0 ignored, no reported skips. Both passes set the shared shader-visible heap in the binding fixture.

This covers the targeted synthetic tests on the 12 GB host. In-game tight-budget waits/shrinks, end-to-end rendering with heap windows, and the full workspace suite were outside this run.

OpenAI Codex assisted with verification.

**@⁠ettehn** on GitHub · 2026-11-26 14:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/2817#issuecomment-7194858927) Independent Windows check on the clean stacked head `c1bf0e82183fd477e9f4dbed24773e8097782cee` (`nvidia-dev` base `af2cecc40886a8682ecf3267f5328c6dc4b66ad7`). Windows 11 build 26200, Ryzen 9 8945HX, RTX 5070 Ti Laptop 12 GB (driver 621.24), Rust 1.97.1 MSVC debug, `XCL_ADAPTER=NVIDIA`, `XCL_TWO_PASS_MB` unset. - Default heap setting: `cargo test --locked --offline -p xcl --lib -j 2 -- hle::d3d12x::bind::tests:: hle::d3d12x::alloc_pool::tests:: --skip two_pass_binds_set_the_shared_view_heap --test-threads=1 --nocapture` reported **53 passed, 0 failed, 0 ignored, no reported skips**. This includes the fence reclaim and multi-queue tests, uncapped GPU feedback, and the scripted budget/wait/shrink cases. The ExecuteIndirect case logged the RTX 5070 Ti Laptop as its adapter. - Fresh process with `XCL_HEAP_WINDOWS=1 XCL_REQUIRE_GPU=wave64`: `cargo test --locked --offline -p xcl --lib -j 2 -- hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap --exact --test-threads=1 --nocapture` reported **1 passed, 0 failed, 0 ignored, no reported skips**. Both passes set the shared shader-visible heap in the binding fixture. This covers the targeted synthetic tests on the 12 GB host. In-game tight-budget waits/shrinks, end-to-end rendering with heap windows, and the full workspace suite were outside this run. OpenAI Codex assisted with verification.
Author
Owner

@⁠joeypercia on GitHub · 2026-11-26 14:48 UTC · original

In the world on a 12 GB card, over its budget: this stack frees about 1 GB and makes about 98 % of the two-pass draws that were skipped. One run with the stack, against two without.

Setup: RTX 4070 Ti 12 GB (621.40), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 26200, release.

  • Tree: nvidia-dev af2cecc4 + #2794 + #2697/#2750/#2776/#2762 (memory report), and #2815–#2817 cherry-picked cleanly on top (c1bf0e82).
  • Shader heap at 2 GiB (#2590). Series X profile. Warm caches. Scripted presses into the story. 420 s runs, which reach the world load.
  • XCL_TWO_PASS_MB unset, i.e. the 1,024 MiB default.
without (05-37-51, 05-49-01) with #2815–#2817 (06-39-11)
two-pass draws not made 66,728 / 65,539 (past 1024 MiB) 1,395 (past 256 MiB, the headroom cap)
two-pass buffers alive at the end 81 (1,011 MiB) 93 (78 MiB)
waiting for allocator resets 568 / 641 MiB 0 MiB
buffers made / taken again / let go 370–377 / 1,937–2,013 / 289–296 3,735 / 1,566 / 3,642
peak video memory / budget (#2776's table) 15,928–16,006 / ~10,530 MB 14,971 / 10,547 MB
presents in the last ~240 s 58–59 57
device removed no no
  • On a card past its budget the headroom cap matters most. It shrank to 256 MiB (85 wait/shrink lines) instead of skipping 65k draws at a fixed 1 GiB.
  • Buffers are made ten times as often (3,735 against ~370), since fewer are kept. I didn't measure what that costs per frame.
  • The frame rate doesn't move: the title is still 4.4 GB past the budget, mostly target pages and sparse tiles (#2688), and that's what limits it here.

One run with the stack. (Claude Code, Claude Opus 5.5)

**@⁠joeypercia** on GitHub · 2026-11-26 14:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/2817#issuecomment-7195353971) **In the world on a 12 GB card, over its budget: this stack frees about 1 GB and makes about 98 % of the two-pass draws that were skipped.** One run with the stack, against two without. **Setup:** RTX 4070 Ti 12 GB (621.40), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 26200, release. - Tree: `nvidia-dev` `af2cecc4` + #2794 + #2697/#2750/#2776/#2762 (memory report), and #2815–#2817 cherry-picked cleanly on top (`c1bf0e82`). - Shader heap at 2 GiB (#2590). Series X profile. Warm caches. Scripted presses into the story. 420 s runs, which reach the world load. - `XCL_TWO_PASS_MB` unset, i.e. the 1,024 MiB default. | | without (`05-37-51`, `05-49-01`) | with #2815–#2817 (`06-39-11`) | |---|---:|---:| | two-pass draws not made | **66,728 / 65,539** (past 1024 MiB) | **1,395** (past 256 MiB, the headroom cap) | | two-pass buffers alive at the end | 81 (1,011 MiB) | 93 (78 MiB) | | waiting for allocator resets | 568 / 641 MiB | 0 MiB | | buffers made / taken again / let go | 370–377 / 1,937–2,013 / 289–296 | 3,735 / 1,566 / 3,642 | | peak video memory / budget (#2776's table) | 15,928–16,006 / ~10,530 MB | 14,971 / 10,547 MB | | presents in the last ~240 s | 58–59 | 57 | | device removed | no | no | - On a card past its budget the headroom cap matters most. It shrank to 256 MiB (85 wait/shrink lines) instead of skipping 65k draws at a fixed 1 GiB. - Buffers are made ten times as often (3,735 against ~370), since fewer are kept. I didn't measure what that costs per frame. - The frame rate doesn't move: the title is still 4.4 GB past the budget, mostly target pages and sparse tiles (#2688), and that's what limits it here. One run with the stack. (Claude Code, Claude Opus 5.5)
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-26 14:56 UTC · original

AMD run (listed as untested), with an RTX 3060 in the same PC. Two of the new tests fail now and then on both cards when the tests run in parallel. They pass every time on one thread.

Tested: head c1bf0e8 applied on its base nvidia-dev af2cecc, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked with XCL_ADAPTER.
cargo test -p xcl --lib -- hle::d3d12x::bind hle::d3d12x::alloc_pool --test-threads=4, repeated:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010: 4 of 6 runs failed (52 passed, 2 failed); the others 54 passed, 0 failed. With --skip gpu_scale_args_reports_uncapped_group_count_feedback, 4 of 6 still failed, so it is not that test.
  • NVIDIA RTX 3060, driver 32.0.16.1088: 1 of 4 runs failed, same two tests.
  • --test-threads=1 on the RX 9070 XT: 10 of 10 runs 54 passed, 0 failed.
  • Each of the two passes on its own by name. nvidia-dev without the PR: 42 passed, 0 failed.

The failures:

  • indirect_feedback_waits_for_submit_before_copyback panics at bind.rs:5127: assertion failed: !fb.dirty && !fb.copy_in_flight.
  • indirect_feedback_copyback_grows_on_clamp_and_decays_over_windows then panics at bind.rs:1442:37, the FEEDBACK.lock().unwrap() in poll_two_pass_feedback. In one run gpu_scale_args_reports_uncapped_group_count_feedback panicked at the same line with PoisonError, so after the first panic the FEEDBACK mutex is poisoned and the later feedback tests fail with it.

#2816 has the same two tests and the same failures: 1 of 6 runs on the RX 9070 XT, 1 of 4 on the RTX 3060. #2815 alone passed (46 passed, 0 failed).

One more thing I saw: the new gpu_scale_args_reports_uncapped_group_count_feedback matches XCL_ADAPTER against the adapter name with a case-sensitive contains, so XCL_ADAPTER=radeon skips it with no D3D12 hardware adapter on this AMD Radeon card. With XCL_ADAPTER=Radeon it runs and passes, on both cards. The existing gpu_two_pass_pooled_scratch_respects_remaining_budget on nvidia-dev skips the same way with radeon.

Not tested: a title run, TP_WAITED / TP_SHRUNK in play, release, XCL_HEAP_WINDOWS=1 (two_pass_binds_set_the_shared_view_heap SKIPPED), Intel.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-26 14:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/2817#issuecomment-7195554112) AMD run (listed as untested), with an RTX 3060 in the same PC. Two of the new tests fail now and then on both cards when the tests run in parallel. They pass every time on one thread. **Tested:** head `c1bf0e8` applied on its base `nvidia-dev` `af2cecc`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked with `XCL_ADAPTER`. `cargo test -p xcl --lib -- hle::d3d12x::bind hle::d3d12x::alloc_pool --test-threads=4`, repeated: - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010: 4 of 6 runs failed (52 passed, 2 failed); the others 54 passed, 0 failed. With `--skip gpu_scale_args_reports_uncapped_group_count_feedback`, 4 of 6 still failed, so it is not that test. - NVIDIA RTX 3060, driver 32.0.16.1088: 1 of 4 runs failed, same two tests. - `--test-threads=1` on the RX 9070 XT: 10 of 10 runs 54 passed, 0 failed. - Each of the two passes on its own by name. `nvidia-dev` without the PR: 42 passed, 0 failed. The failures: - `indirect_feedback_waits_for_submit_before_copyback` panics at `bind.rs:5127`: `assertion failed: !fb.dirty && !fb.copy_in_flight`. - `indirect_feedback_copyback_grows_on_clamp_and_decays_over_windows` then panics at `bind.rs:1442:37`, the `FEEDBACK.lock().unwrap()` in `poll_two_pass_feedback`. In one run `gpu_scale_args_reports_uncapped_group_count_feedback` panicked at the same line with `PoisonError`, so after the first panic the `FEEDBACK` mutex is poisoned and the later feedback tests fail with it. #2816 has the same two tests and the same failures: 1 of 6 runs on the RX 9070 XT, 1 of 4 on the RTX 3060. #2815 alone passed (46 passed, 0 failed). One more thing I saw: the new `gpu_scale_args_reports_uncapped_group_count_feedback` matches `XCL_ADAPTER` against the adapter name with a case-sensitive `contains`, so `XCL_ADAPTER=radeon` skips it with `no D3D12 hardware adapter` on this AMD Radeon card. With `XCL_ADAPTER=Radeon` it runs and passes, on both cards. The existing `gpu_two_pass_pooled_scratch_respects_remaining_budget` on `nvidia-dev` skips the same way with `radeon`. **Not tested:** a title run, `TP_WAITED` / `TP_SHRUNK` in play, release, `XCL_HEAP_WINDOWS=1` (`two_pass_binds_set_the_shared_view_heap` SKIPPED), Intel. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠throny on GitHub · 2026-11-26 14:59 UTC · original

Test report for the stack (#2815 + #2816 + this PR) in the world on an RTX 4080 16 GB: the buffers no longer wait for allocator resets and far fewer draws are skipped, but on a card that is over its budget the derived cap is 256 MiB and refusals come back as the run goes on.

Tested

  • RTX 4080 16 GB (driver 621.40, 1 GiB shader-heap profile of #2590), i9-12900K, 64 GB RAM, Windows 11 26300, release.
  • This PR's diff at its head (all three commits; git apply, as it is) on nvidia-dev af2cecc4 + #684 + #2697 + #2749 + #2729 + #2794. The retail title of #505, Series X profile, world from about 170 s. Two world runs with the stack (18, 19), against two runs of the same day without it (14, 16; the same base less #2794 / #2729).
without (run 14, 98 s of world) without (run 16, 435 s) with (run 18, 165 s) with (run 19, 297 s)
draws with translated pipelines 77,424 203,918 131,072 189,554
of them skipped 18,805 (24 %) 131,072 (64 %) 2,991 (2.3 %) 37,301 (19.7 %)
two-pass buffers alive 85 / 987 MiB 86 / 992 MiB 152 / 255 MiB 108 / 255 MiB
waiting for allocator resets 442 MiB 378 MiB 0 0
waiting for GPU fences – – 0 0
"not made past" the cap 18,805 past 1,024 MiB 136,784 past 1,024 MiB 3,354 past 256 MiB 58,193 past 256 MiB
waited / shrunk / indirect clamped – – 5 / 377 / 53 51 / 9,052 / 189
video memory at the end (budget 15.2 GB) 18.8 GB 19.5 GB 17.9 GB 18.7 GB
  • #2815 does what it says here: nothing is left waiting for an allocator reset (378–442 MiB before), and the pool turns over (968 made, 896 taken again, 816 let go in run 18).
  • The cap: this card is 3 GB over its DXGI budget in the world, so the headroom is negative and the derived cap sits at its floor of 256 MiB, a quarter of the old default. The first 30 s of the world are almost free of refusals (2,991 skipped of 65,536 by 205 s in run 18, then none for two minutes), then they grow again: in run 19 from 2,145 at 272 s to 37,301 at 405 s. So on a card in this state the stack trades "1 GiB that is half idle" for "256 MiB that is all in use", which is better (20 % against 24–64 % skipped), but not yet "no draw skipped for lack of memory". A floor that depends on the card rather than on the headroom, or counting the freed 400 MiB against it, may be worth a look.
  • Two things that appeared in the runs with the stack and in none of the six earlier world runs of this card on the same branch; I can't say from two runs that the stack causes them:
    • GPU wait timeouts (GPU queue.Wait … did not complete within 5000 ms): 9 within 30 s around 303–333 s in run 18 (my run guard ended that run there), 14 around 360–390 s in run 19.
    • recorded last (a call into the driver stands still) twice in run 19 (265 s, 282 s).
      Both could be the "wait briefly on pending submit fences" path meeting a GPU that is seconds behind (this card spends 93 % of the submitting thread's time inside PresentX in the world, see #2729's report), so they may be specific to an over-budget card.
  • Run 19 ended at 467 s with 0xc0000005 in the title's own code, no device removal; run 18 by my guard. Neither run lost the device (4 of 6 earlier runs did).
  • Frame rate unchanged: 0.21 presents/s in both.

Not tested

  • The three PRs one by one (only the whole stack), their unit tests and the suite, AMD, a card that is under its budget in the world (where the cap would be larger), and the picture: frame dumps time out in the world here (frame dump copy: not finished after 2000 ms), so I can't say whether the draws that are no longer skipped fill in the ground.

AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.

**@⁠throny** on GitHub · 2026-11-26 14:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/2817#issuecomment-7195617378) **Test report for the stack (#2815 + #2816 + this PR) in the world on an RTX 4080 16 GB: the buffers no longer wait for allocator resets and far fewer draws are skipped, but on a card that is over its budget the derived cap is 256 MiB and refusals come back as the run goes on.** **Tested** - RTX 4080 16 GB (driver 621.40, 1 GiB shader-heap profile of #2590), i9-12900K, 64 GB RAM, Windows 11 26300, release. - This PR's diff at its head (all three commits; `git apply`, as it is) on `nvidia-dev` `af2cecc4` + #684 + #2697 + #2749 + #2729 + #2794. The retail title of #505, Series X profile, world from about 170 s. Two world runs with the stack (18, 19), against two runs of the same day without it (14, 16; the same base less #2794 / #2729). | | without (run 14, 98 s of world) | without (run 16, 435 s) | with (run 18, 165 s) | with (run 19, 297 s) | |---|---|---|---|---| | draws with translated pipelines | 77,424 | 203,918 | 131,072 | 189,554 | | of them skipped | 18,805 (24 %) | 131,072 (64 %) | **2,991 (2.3 %)** | **37,301 (19.7 %)** | | two-pass buffers alive | 85 / 987 MiB | 86 / 992 MiB | 152 / 255 MiB | 108 / 255 MiB | | waiting for allocator resets | 442 MiB | 378 MiB | **0** | **0** | | waiting for GPU fences | – | – | 0 | 0 | | "not made past" the cap | 18,805 past 1,024 MiB | 136,784 past 1,024 MiB | 3,354 past **256 MiB** | 58,193 past **256 MiB** | | waited / shrunk / indirect clamped | – | – | 5 / 377 / 53 | 51 / 9,052 / 189 | | video memory at the end (budget 15.2 GB) | 18.8 GB | 19.5 GB | 17.9 GB | 18.7 GB | - **#2815 does what it says here:** nothing is left waiting for an allocator reset (378–442 MiB before), and the pool turns over (968 made, 896 taken again, 816 let go in run 18). - **The cap:** this card is 3 GB over its DXGI budget in the world, so the headroom is negative and the derived cap sits at its floor of 256 MiB, a quarter of the old default. The first 30 s of the world are almost free of refusals (2,991 skipped of 65,536 by 205 s in run 18, then none for two minutes), then they grow again: in run 19 from 2,145 at 272 s to 37,301 at 405 s. So on a card in this state the stack trades "1 GiB that is half idle" for "256 MiB that is all in use", which is better (20 % against 24–64 % skipped), but not yet "no draw skipped for lack of memory". A floor that depends on the card rather than on the headroom, or counting the freed 400 MiB against it, may be worth a look. - **Two things that appeared in the runs with the stack and in none of the six earlier world runs of this card on the same branch; I can't say from two runs that the stack causes them:** - GPU wait timeouts (`GPU queue.Wait … did not complete within 5000 ms`): 9 within 30 s around 303–333 s in run 18 (my run guard ended that run there), 14 around 360–390 s in run 19. - `recorded last (a call into the driver stands still)` twice in run 19 (265 s, 282 s). Both could be the "wait briefly on pending submit fences" path meeting a GPU that is seconds behind (this card spends 93 % of the submitting thread's time inside `PresentX` in the world, see #2729's report), so they may be specific to an over-budget card. - Run 19 ended at 467 s with `0xc0000005` in the title's own code, no device removal; run 18 by my guard. Neither run lost the device (4 of 6 earlier runs did). - Frame rate unchanged: 0.21 presents/s in both. **Not tested** - The three PRs one by one (only the whole stack), their unit tests and the suite, AMD, a card that is under its budget in the world (where the cap would be larger), and the picture: frame dumps time out in the world here (`frame dump copy: not finished after 2000 ms`), so I can't say whether the draws that are no longer skipped fill in the ground. AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-26 15:05 UTC · original

Two Linux/Wine lanes on the full stack, both vendors, release profile. Nobody here has posted Linux numbers for this stack yet.

Lanes

  • A (AMD): Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT 20 GB (Navi 31), Arch, kernel 7.2.15, Mesa 26.2.5 RADV, wine-11.0 (Proton), rustc 1.94.0
  • B (NVIDIA): i5-10600K, 16 GB DDR4, GTX 1070 8 GB, driver 550.163.01, Debian 13, stock wine-10.0, xvfb
    Both: cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::, full env per lane (runner: Proton wine on A, /usr/bin/wine on B, WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b", VKD3D_CONFIG=ignore_shared_fence, XCL_DXC_DIR set).

Suite verdicts (clean stack c1bf0e82 on base af2cecc4)

Lane Base af2cecc4 Stack c1bf0e82 Stack-introduced reds
A RDNA3/wine-11 869 pass / 6 fail 880 pass / 7 fail (4 ignored, 769 filtered) bind::wait_oldest_fenced_reclaims_in_flight_buffer_before_refusing (in-suite only)
B Pascal/wine-10 865 pass / 10 fail 877 pass / 10 fail none, identical red set

Flake, matches @⁠DarkPanda69's parallel-only observation. On lane A, wait_oldest_fenced... (bind.rs:5192) is the only stack-added red: red in-suite 2 of 2 runs, green alone 3 of 3 (--exact). On lane B it is green in-suite and 2 of 2 alone. First run on A additionally aborted the test host: the bind.rs panic poisoned a mutex, then list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list hit PoisonError unwrapping at bind.rs:1442 inside a non-unwinding scope, thread caused non-unwinding panic. aborting., exit status: 9 (test binary, not the assertion). The rerun with --nocapture completed 880/7 instead. So on this stack the parallel flake can escalate to a host abort on the wine-11/Proton lane; the wine-10 lane never showed it.

Vendor-split, predates the stack. bind::gpu_two_pass_indirect_commands_keep_their_own_records is consistently red on the Pascal lane (red alone 3/3, at base and at stack), green everywhere on RDNA3. It is in the base's 10-red set on that box, so it is not caused by #2815-#2817, but it does mean two-pass-adjacent coverage is already dead on Pascal/wine-10 before this stack lands. Its sibling in-suite reds on that box (write_buffer_immediate_on_open_existing_heap_visible_to_cpu, descriptor_heap zero_sampler, texture_upload gpu_parts...) likewise vanish when the stack lands on the AMD lane.

Not tested: Windows, native Linux, the in-game evidence items.
AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-26 15:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/2817#issuecomment-7195778033) Two Linux/Wine lanes on the full stack, both vendors, release profile. Nobody here has posted Linux numbers for this stack yet. **Lanes** - A (AMD): Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT 20 GB (Navi 31), Arch, kernel 7.2.15, Mesa 26.2.5 RADV, wine-11.0 (Proton), rustc 1.94.0 - B (NVIDIA): i5-10600K, 16 GB DDR4, GTX 1070 8 GB, driver 550.163.01, Debian 13, stock wine-10.0, `xvfb` Both: `cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::`, full env per lane (runner: Proton wine on A, `/usr/bin/wine` on B, `WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b"`, `VKD3D_CONFIG=ignore_shared_fence`, `XCL_DXC_DIR` set). **Suite verdicts** (clean stack `c1bf0e82` on base `af2cecc4`) | Lane | Base `af2cecc4` | Stack `c1bf0e82` | Stack-introduced reds | |---|---:|---:|---| | A RDNA3/wine-11 | 869 pass / 6 fail | 880 pass / 7 fail (4 ignored, 769 filtered) | `bind::wait_oldest_fenced_reclaims_in_flight_buffer_before_refusing` (in-suite only) | | B Pascal/wine-10 | 865 pass / 10 fail | 877 pass / 10 fail | none, identical red set | **Flake, matches @⁠DarkPanda69's parallel-only observation.** On lane A, `wait_oldest_fenced...` (bind.rs:5192) is the only stack-added red: red in-suite 2 of 2 runs, green alone 3 of 3 (`--exact`). On lane B it is green in-suite and 2 of 2 alone. First run on A additionally **aborted the test host**: the bind.rs panic poisoned a mutex, then `list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list` hit `PoisonError` unwrapping at bind.rs:1442 inside a non-unwinding scope, `thread caused non-unwinding panic. aborting.`, `exit status: 9` (test binary, not the assertion). The rerun with `--nocapture` completed 880/7 instead. So on this stack the parallel flake can escalate to a host abort on the wine-11/Proton lane; the wine-10 lane never showed it. **Vendor-split, predates the stack.** `bind::gpu_two_pass_indirect_commands_keep_their_own_records` is **consistently red on the Pascal lane** (red alone 3/3, at base and at stack), green everywhere on RDNA3. It is in the base's 10-red set on that box, so it is not caused by #2815-#2817, but it does mean two-pass-adjacent coverage is already dead on Pascal/wine-10 before this stack lands. Its sibling in-suite reds on that box (`write_buffer_immediate_on_open_existing_heap_visible_to_cpu`, `descriptor_heap zero_sampler`, `texture_upload gpu_parts...`) likewise vanish when the stack lands on the AMD lane. **Not tested:** Windows, native Linux, the in-game evidence items. **AI use:** Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
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 origin '+refs/pull/2817/head:github-bot/gh-2817'
git switch 'github-bot/gh-2817'

Merge

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