Repository navigation
Conversation
…pped The two-pass record buffer and argument scratch are refused once the buffers alive reach the headroom cap (25 % of local budget headroom, clamped), and the draw that asked is skipped. A title whose later queue waits depend on that draw then never wakes: a retail title on a 12 GB RTX 3060 (16 heap windows) skipped its first two-pass ExecuteIndirect at a 340 MiB cap and, a second later, five queues sat in Wait64BitValueX on a value the skipped work would have written, with 0 draws for the remaining 13 minutes. With XCL_TWO_PASS_MB=2048 the same run played on with 794 MiB of two-pass buffers alive and lit its G-buffer. Those two paths now make the buffer up to the budget ceiling the cap is clamped to (min(local budget / 4, 2048 MiB), 1024 MiB with no budget) and skip the draw only past that. An XCL_TWO_PASS_MB cap is kept as it is. Pools, batches and the other callers still stop at the headroom cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
On head I ran a deterministic CPU fixture using this head's cap arithmetic, atomic reservation, bucket rounding and
Could the record-buffer path reuse the existing bucket walk at the automatic ceiling with zero additional fence wait? The explicit AI use: OpenAI Codex prepared and ran the CPU fixture, checked the production callers and wrote this report. |
…ets at the ceiling Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@andrewDoing thanks, you're right. Pushed Tested on an RTX 3060 12 GB: AI use: Claude Code (Claude Opus 5.5) wrote the change, the test and this reply, and ran the tests. |
|
Retested the four admission boundaries at AI use: OpenAI Codex ran the controls and prepared this follow-up. |
|
I verified the ceiling retry through Each row ran in a fresh process, with no reusable record buffer. I requested 64 MiB with a 47,632-byte minimum and batching enabled. A test-only memory query and the alive counter supplied a 12 GiB budget and 10 GiB of non-two-pass usage. Production cap calculation gave 512 MiB headroom and a 2,048 MiB ceiling. The fixture supplied the native device through the existing test-list GetDevice shim.
For each admission I checked the returned capacity and native resource width, then passed that same resource to the existing two-pass GPU test. It wrote and read records for six indirect commands, waited on a real fence and checked all 16 expected output words. All five cases passed. The budget inputs were synthetic and the workload touched a small portion of each allocation. This verifies caller wiring, allocation, GPU usability, and the hard-cap boundary. It does not measure residency under pressure or reproduce the retail queue stall. AI use: OpenAI Codex adapted the native fixture, ran the controls and prepared this report. |
|
A data point for why this is needed, from a 16 GB card that runs over its video memory budget. The binary in these runs is RTX 5070 Ti 16 GB (617.42), Ryzen 7 9800X3D, 32 GB, Windows 11 26300. The newer retail title, after a full shader preparation for this binary, In the world the process holds 17.6 to 18.8 GB of local video memory against a budget of about 15.0 GB, so there is no headroom and the cap sits on its floor (budget / 32, about 470 MiB here) for the rest of the run.
The counts are from the last So with the cap left to itself, half to three quarters of the draws in the world are skipped here, and the title needs 1.1 to 1.3 GiB of two-pass buffers alive. On this card your ceiling works out to 2048 MiB, which would cover that. On screen it changes nothing I can measure. In every run, with the cap unset or raised, the world frames are black (no pixel above 2 of 255 in the frame dumps) except for the title's button-prompt box, which shows in 1 to 3 of the 9 to 25 frames dumped in the world. The 3D scene behind it is black in all of them, so the skipped draws are not what keeps the scene black on this card. (Edited: this paragraph first said the prompts only appear with the cap raised. That was wrong; I had looked at every fifth frame.) No device removal in any of these runs. Lowest free RAM was 1.1 GB with 3072 and 2.2 GB with 1536, against 2.0 to 2.4 GB with the cap unset, so the larger buffers cost RAM here (the video memory over the budget ends up in shared memory). This PR, cap unset (edited in:
So the PR does what it says here: no draw is skipped and nothing is refused. But on this card most draws do not get their preferred record buffer past the cap. The groups-dropped figures of the base and of this PR cannot be compared directly: a skipped draw loses all its groups and none of them are counted there. Not tested: more than one run per setting for 1536, 3072 and this PR. All these runs had the default UMA layout (the log says 0 view windows), so the title's two-pass demand with AI use: Claude Code (Claude Fable 5.2) set up the runs, counted from the logs and frame dumps, and wrote this; Claude Opus 5.5 read
|
|
No open or merged PR does this. It builds on the headroom cap from the merged #2817 ( AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Review (head ac81767, diff read, not a merge-check; draft):
Fine: growth is bounded by the ceiling and counted as before, a failed allocation returns an error and the draw is skipped, and a set AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
When local-VRAM two-pass buffers reach XCL_TWO_PASS_MB (or the DXGI headroom floor), spill overflow UAV buffers to D3D12_MEMORY_POOL_L0 (up to XCL_TWO_PASS_L0_MB, default 512 MiB; 0 disables) with a separate FREE_L0_RES pool instead of spin-waiting and skipping draws. Complementary to xcl-dev#3165 and xcl-dev#3555.
When local-VRAM two-pass UAV buffers reach XCL_TWO_PASS_MB (or the dynamic DXGI headroom floor), spill full-size overflow record and argument-scratch buffers to D3D12_MEMORY_POOL_L0 (up to XCL_TWO_PASS_L0_MB, default 512 MiB; 0 disables) tracked separately in TWO_PASS_L0_ALIVE and FREE_L0_RES (trimmed on idle from put_free_bufs, release_allocator_res, and take_free). When L0 spillover is disabled, full, or unsupported by the adapter, fall back to the original local FENCE_WAIT_LIMIT wait + shrink/refusal path. Complementary to xcl-dev#3165 (draft).
When local-VRAM two-pass UAV buffers reach XCL_TWO_PASS_MB (or the dynamic DXGI headroom floor), spill full-size overflow record and argument-scratch buffers to D3D12_MEMORY_POOL_L0 (up to XCL_TWO_PASS_L0_MB, default 512 MiB; 0 disables) tracked separately in TWO_PASS_L0_ALIVE and FREE_L0_RES (trimmed on idle from put_free_bufs, release_allocator_res, and take_free). When L0 spillover is disabled, full, or unsupported by the adapter, fall back to the original local FENCE_WAIT_LIMIT wait + shrink/refusal path. Complementary to xcl-dev#3165 (draft).
When local-VRAM two-pass UAV buffers reach XCL_TWO_PASS_MB (or the dynamic DXGI headroom floor), spill full-size overflow record and argument-scratch buffers to D3D12_MEMORY_POOL_L0 (up to XCL_TWO_PASS_L0_MB, default 512 MiB; 0 disables) tracked separately in TWO_PASS_L0_ALIVE and FREE_L0_RES (trimmed on idle from put_free_bufs, release_allocator_res, and take_free). When L0 spillover is disabled, full, or unsupported by the adapter, fall back to the original local FENCE_WAIT_LIMIT wait + shrink/refusal path. Complementary to xcl-dev#3165 (draft).
When the two-pass buffers alive reach the headroom cap (25 % of local budget headroom, clamped), the record buffer and the argument scratch are refused and the draw that asked is skipped. A title whose later queue waits depend on that draw never wakes. On a 12 GB RTX 3060 (16 heap windows,
XCL_PREPARE=0), a retail title skipped its first two-pass ExecuteIndirect at a 340 MiB cap. A second later five queues sat inWait64BitValueX >= 0x713(wait-before-signal, producer queue 1) with 0 draws for the remaining 13 minutes and no device removal. WithXCL_TWO_PASS_MB=2048the same run played on, with 794 MiB of two-pass buffers alive, and lit its G-buffer (#1989).Those two paths now make the buffer up to the budget ceiling the cap is already clamped to (
min(local budget / 4, 2048 MiB), 1024 MiB with no budget), and skip the draw only past that. A setXCL_TWO_PASS_MBis kept as a hard cap. Pools, batches and the other callers still stop at the headroom cap: they have their own fallbacks.Builds on #2817's headroom cap (its wait and shrink run first). No open or merged PR changes the refusal: the open
nvidia-devPRs that touch two-pass code (#2999, #3052, #3056, #3105, #3116, #3131, #3012, #2987) leave it as it is, andmain/amd-devhave no such cap.What is in it
crates/xcl/src/hle/d3d12x/bind.rs:env_two_pass_cap(the existingXCL_TWO_PASS_MBread, moved out oftwo_pass_cap),draw_two_pass_ceiling,make_two_pass_past_cap; the record-buffer (ensure_res_buffer_with_cap) and argument-scratch refusals go through it. Two tests: the ceiling arithmetic, and a buffer the headroom cap refuses being made past it (WARP device).ac81767f(review, to be squashed): past the cap, the record buffer runs its existing bucket walk (acquire_res_buf_with_cap) at the ceiling with no fence wait, so a smaller usable buffer is taken before the draw is refused. Test:a_record_buffer_past_the_headroom_cap_shrinks_to_what_fits_under_the_ceiling.Tested
XCL_ADAPTER=3060(the machine also has a GTX 960).cargo test -p xcl --lib two_pass: 38 passed, 0 failed (1 SKIPPED:two_pass_binds_set_the_shared_view_heap, no heap windows);cargo test -p xcl --lib -- headroom_cap past_theatac81767f: 7 passed, 0 failed.cargo test --workspace -- --test-threads=4aborts on this card withCreateCommandQueue ... 0x8007000Eafter 4title_texturesfailures, identically on the base54225f58without this change;cargo test -p xcl --lib title_texturespasses 35/35 on both. So the whole-suite counts are not available from this machine.nvidia-devtree with D3D12.X: XCL_TEXTURE_SYSMEM puts streamed texture levels in system memory #3039 + D3D12.X: empty shader slots keep a two-pass mesh pipeline's cache key #2975 merged (16 heap windows,XCL_PREPARE=0, noXCL_TWO_PASS_MB): at 91 s the record buffer (32 MiB) and argument scratch went past the 351 MiB headroom cap ("goes past the ... headroom cap" lines), 0 draws skipped, in play at 718 s with ~10 000 draws per 2 s; in-play G-buffer targets 0/1/3 at 52 / 59 / 43 % non-black (frame 1762). The 900 s run ended cleanly: exit 0x0, 2 471 frames, 0 device removals, 0 crashes, peak commit 40.1 GB. Without the change the same setup froze at ~102 s (see D3D12.X: add depth+UAV color twins, format-aliased placed texture copies, and dual-twin UAV barriers #1989).Regression run
(
mainand this PR's head,XCL_PREPARE=0, otherwise plain settings; this title does not reach the cap without 16 windows. Themainblock replaces an earlier one whose build had failed, so that run used a stale binary. Peak commit varies between ~17 and ~37 GB from run to run here with the cache state.)Not tested
XCL_UMA_DRIVER=mixeddevice-hangs (0x887a0006) in the menus in about half the runs here, before any two-pass buffers; that is separate from this change.AI use
🤖 Generated with Claude Code