D3D12.X: cap two-pass buffers by DXGI headroom with wait and shrink #2817
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2817
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2817"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@coolpersonnn on GitHub · 2026-11-26 14:22 UTC · original
coolpersonnn:ws2/two-pass-budget-fallback→nvidia-dev· +1342 −108 · 2 files · 3 commits · openStacked 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
two_pass_capfrombudget_two_pass_cap: 1/4 of remaining DXGI local VRAM headroom, clamped to[256 MiB, 2048 MiB]and capped atlocal_budget / 4on smaller cards (1024 MiBfallback if budget is unavailable, cached for 250 ms;XCL_TWO_PASS_MBstill overrides), and scaleFREE_RESretention accordingly.FENCE_WAIT_LIMIT(50 ms) polling across pendingFencedBatchentries before refusing allocation, and shrink or reuse an already-sufficient (>= min_fit) command-list buffer (TP_WAITED,TP_SHRUNK) under tight cap pressure.Tested
26200/26300), Ryzen 9 9950X3D, 95,800 MB RAM, NVIDIA GeForce RTX 5090 (32 GB, driver621.01, DXC1.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 explicitSKIPPEDGPU tests (hle::d3d12x::bind: 46 passed incl. 1SKIPPED 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 unmodifiednvidia-dev(af2cecc4).cargo build --release -p xcl --bin xcl: exited 0.#2688matched 120 s evidence (title: a93b40d7,XCL_PREPARE=0,XCL_NETWORK=0,XCL_LOOK_STATS=2, warm DXIL+driver caches):af2cecc4(1024 MiBcap) vs stacked headc1bf0e82(XCL_TWO_PASS_MB=1024): two-pass alive memory at world-entry burst dropped from998 MiB(68buffers,598 MiBwaiting for allocator resets,73 not made past 1024 MiB,4,096draws skipped) to129 MiB(64buffers,11 taken again,0 MiBwaiting for GPU fences/allocator resets,0 not made past 1024 MiB,0draws skipped) —-869 MiB(-87.1%) two-pass VRAM; total peak commit37,596 MB -> 36,945 MB(-651 MB), end commit36,881 MB -> 34,989 MB(-1,892 MB), peak local VRAM15,929 MB -> 15,297 MB(50.7% -> 48.7%of31,419 MBDXGI budget), frames1,426 -> 1,443, submitafterunchanged (0.010 ms->0.010 ms),0tiles refused,0views left waiting.c1bf0e82(default headroom cap2048 MiB):4/4completed cleanly with0device removals and0crashes (1,425 / 1,426 / 1,413 / 1,413frames; peak local VRAM14,931–15,425 MB/31,419 MB;0skips, refusals, or views left waiting).Regression run
Not tested
TP_WAITED/TP_SHRUNKfallback on a small-VRAM GPU in live gameplay).nvidia-devaf2cecc4by pre-existing multi-minute compute-PSO driver compiles at world entry when the full world shader cache is absent).XCL_HEAP_WINDOWS=1heap-window test (two_pass_binds_set_the_shared_view_heapskipped by default).AI use
@ettehn on GitHub · 2026-11-26 14:27 UTC · original
Independent Windows check on the clean stacked head
c1bf0e82183fd477e9f4dbed24773e8097782cee(nvidia-devbaseaf2cecc40886a8682ecf3267f5328c6dc4b66ad7). 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_MBunset.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 --nocapturereported 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.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 --nocapturereported 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.
@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.
nvidia-devaf2cecc4+ #2794 + #2697/#2750/#2776/#2762 (memory report), and #2815–#2817 cherry-picked cleanly on top (c1bf0e82).XCL_TWO_PASS_MBunset, i.e. the 1,024 MiB default.05-37-51,05-49-01)06-39-11)One run with the stack. (Claude Code, Claude Opus 5.5)
@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
c1bf0e8applied on its basenvidia-devaf2cecc, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked withXCL_ADAPTER.cargo test -p xcl --lib -- hle::d3d12x::bind hle::d3d12x::alloc_pool --test-threads=4, repeated:--skip gpu_scale_args_reports_uncapped_group_count_feedback, 4 of 6 still failed, so it is not that test.--test-threads=1on the RX 9070 XT: 10 of 10 runs 54 passed, 0 failed.nvidia-devwithout the PR: 42 passed, 0 failed.The failures:
indirect_feedback_waits_for_submit_before_copybackpanics atbind.rs:5127:assertion failed: !fb.dirty && !fb.copy_in_flight.indirect_feedback_copyback_grows_on_clamp_and_decays_over_windowsthen panics atbind.rs:1442:37, theFEEDBACK.lock().unwrap()inpoll_two_pass_feedback. In one rungpu_scale_args_reports_uncapped_group_count_feedbackpanicked at the same line withPoisonError, so after the first panic theFEEDBACKmutex 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_feedbackmatchesXCL_ADAPTERagainst the adapter name with a case-sensitivecontains, soXCL_ADAPTER=radeonskips it withno D3D12 hardware adapteron this AMD Radeon card. WithXCL_ADAPTER=Radeonit runs and passes, on both cards. The existinggpu_two_pass_pooled_scratch_respects_remaining_budgetonnvidia-devskips the same way withradeon.Not tested: a title run,
TP_WAITED/TP_SHRUNKin play, release,XCL_HEAP_WINDOWS=1(two_pass_binds_set_the_shared_view_heapSKIPPED), Intel.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@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
git apply, as it is) onnvidia-devaf2cecc4+ #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).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
PresentXin the world, see #2729's report), so they may be specific to an over-budget card.0xc0000005in the title's own code, no device removal; run 18 by my guard. Neither run lost the device (4 of 6 earlier runs did).Not tested
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.
@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
xvfbBoth:
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/wineon B,WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b",VKD3D_CONFIG=ignore_shared_fence,XCL_DXC_DIRset).Suite verdicts (clean stack
c1bf0e82on baseaf2cecc4)af2cecc4c1bf0e82bind::wait_oldest_fenced_reclaims_in_flight_buffer_before_refusing(in-suite only)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, thenlist_x::a_reset_while_the_last_submit_runs_records_on_another_pc_listhitPoisonErrorunwrapping 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--nocapturecompleted 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_recordsis 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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.