Skip to content

D3D12.X: add an opt-in two-tier texture budget - #3682

Draft
jeroenhaentjens wants to merge 10 commits into
xcl-dev:mainfrom
jeroenhaentjens:feat/two-tier-texture-budget-l0
Draft

jeroenhaentjens wants to merge 10 commits into
xcl-dev:mainfrom
jeroenhaentjens:feat/two-tier-texture-budget-l0

Conversation

@jeroenhaentjens

@jeroenhaentjens jeroenhaentjens commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What & Why

On a discrete adapter, sampled backing can consume local memory that render targets, depth buffers and UAVs require. Overlapping aliases need GPU-ordered moves and reserved backing must outlive both GPU use and tile updates. L0 growth also uses physical system memory and needs its own admission check.

What is in it

  • Gate the policy behind XCL_TEXTURE_BUDGET=1. Admit eligible sampled texture backing to CUSTOM/L0 and retain local headroom for required resources up to the DXGI budget minus 8 MiB.
  • Expose XCL_TEXTURE_SOFT_CAP_MIB, XCL_BUDGET_L0_PHYS_HEAPS, XCL_BUDGET_L0_TILEPOOLS and XCL_BUDGET_L0_COMMITTED. Report memory by allocation owner.
  • Promote overlapping live L0 tiles after producer completion. Serialize native submissions during backup, remap and restore, and verify native GPU readback.
  • Keep the last reserved-resource reference, tiles and heap backing until the work on active and retiring queues has completed and the separate tile-mapping fence has passed the final NULL update. Preserve ordering even with XCL_LATE_RELEASE=0 when the texture budget is active.
  • Use GlobalMemoryStatusEx before admitting new L0 backing. Allow growth only if the request and in-flight L0 reservations leave at least 3,072 MiB of available physical RAM. Override the floor with XCL_L0_MIN_FREE_PHYS_MIB. Count refusals in l0_phys_ram_guard_denials.
  • Related to D3D12.X: opt-in XCL_L0_VRAM_MARGIN_MB spills sparse and sampled texture pools to L0 #3620 on L0 admission. This branch also handles live alias promotion, local render-target headroom and the lifetime of reserved textures.
  • Keep ordinary deferred releases moving when a stopped queue fails retirement. Track the missing completion mark per failed queue and retry it on the retirement worker. Reserved textures on another device can recycle immediately. Same-device backing stays protected when outstanding bindless work may still reach it, and recycling resumes when the recovered fence completes.
  • Retry eligible committed backing locally after an L0 reservation denial, including a physical RAM guard denial. The fallback stays within the DXGI budget minus 8 MiB.
  • After an L0 heap refusal above the sampled tile-pool spill threshold, reuse compatible local tiles or allocate a local heap up to DXGI budget minus 8 MiB. Count new local fallback heaps in local_tilepool_fallback_heaps.

Tested

  • Previous review verification head 0877fa974041d32ba4f8f52250c149698ce1dbc9 rebased on origin/main at 817eb1fc9fb0763008ae5d8de1f7f586f442b51d. The rebase preserves the upstream mapping Signal retry and reserved-spare logic.
  • NVIDIA Quadro RTX 3000 (6 GiB, driver 597.06), Intel Core i7-9750H, Windows 11 Pro 25H2 build 26200.9974, Rust 1.100.0 MSVC and DXC 1.9.2609.5.
  • git diff --check and git diff --check origin/main...HEAD passed.
  • cargo check --locked -p xcl --tests passed on all nine commits. The reserved-spare compatibility changes were folded into fd938727.
  • The six new VRAM GPU fixtures default to auto adapter selection, with XCL_ADAPTER still available to select a specific adapter.
  • cargo test --locked -p xcl --lib -- --test-threads=1 --nocapture --skip hle::d3d12x::vram::tests::reserved_resource_with_private_data_is_excluded_from_recycle hle::d3d12x::vram::tests hle::d3d12x::vram_promotion hle::d3d12x::late_release::tests · 106 passed, 0 failed, 1 existing ignored timing test, 0 SKIPPED notices.
  • cargo test --locked -p xcl --lib -- --test-threads=1 --nocapture --exact hle::d3d12x::vram::tests::reserved_resource_with_private_data_is_excluded_from_recycle · 1 passed, 0 failed, 0 ignored, 0 SKIPPED notices. The fixture passed in its own process on retry after exit code 2173.
  • cargo test --locked -p xcl --lib -- --test-threads=1 --nocapture hle::d3d12x::memory_report gpu::uma · 26 passed, 0 failed, 0 ignored, 0 SKIPPED notices.
  • All targeted GPU test runs used XCL_ADAPTER=nvidia and XCL_D3D12_DEBUG=1. The new regression uploaded a mapped texture on the Quadro, recycled it while a second device's queue stayed failed, and checked that a same-device dependency was held until its recovery fence completed. It reported 0 D3D12 Debug Layer messages, as did the other instrumented probes in their checked categories.
  • A separate run with XCL_ADAPTER unset selected the Quadro automatically and passed all six updated fixtures with zero Debug Layer diagnostics in the checked categories.
  • Verification Run 18 on exact head 0877fa974041d32ba4f8f52250c149698ce1dbc9. cargo build --locked --release completed in 4m 03s with 39 compiler warnings. One retail start on the Quadro RTX 3000 with the existing DXIL cache, XCL_ADAPTER=nvidia, XCL_DEVICE_TYPE=lockhart, XCL_TEXTURE_BUDGET=1, XCL_L0_MIN_FREE_PHYS_MIB=3072, XCL_GFX_PSO_WAIT_MS=8000, and XCL_CS_PSO_WAIT_MS=35000.
  • The player selection and loading illustration rendered. The screen was blank near +135 s from the estimated loading start. Tile-pool admission failed three times for a 64 MiB request, followed by one texture placement out-of-memory result and breakpoint 0x80000003 around +145 s. The launcher exited 303.4 s after start, 264.2 s after the first input attempt and about 153 s after loading began. No 3D world was observed and the log reported no DXGI device removal.
  • Peak sampled DXGI use was 4,859 MiB local (5,187 MiB budget) and 7,892 MiB non-local. Minimum sampled available physical RAM was 2,830.7 MiB. Shutdown counters recorded 65 L0 tile-pool heaps (4,160 MiB), 341 L0 physical-page heaps (1,364 MiB), 954 L0 committed allocations (60.375 MiB), and zero L0 arena, placed override and L0-to-L1 promotion allocations. l0_phys_ram_guard_denials recorded three denials (192 MiB across the retries). Two committed allocations used the required local reserve (2.25 MiB). DirectStorage activity samples recorded 50,966 requests and zero failures.
  • At tile-pool denial, DXGI reported 4,557.6 MiB in use against a 5,187.0 MiB local budget. The tile-pool path selects TileSegments::NonLocal above its 4,000 MiB soft limit, which excludes the local-reserve retry in reserve_texture_backing. OpenAI Codex (GPT-6, specific revision unavailable) ran and reported this verification.
  • b647ecab63afb4616d7908f005e818ecf1ed3701 passed git diff --check and cargo build --locked --release (3m 01s, 39 warnings).
  • VRAM tests on the Quadro RTX 3000 with XCL_ADAPTER=nvidia and XCL_D3D12_DEBUG=1. cargo test --locked -p xcl --lib hle::d3d12x::vram::tests -- --test-threads=1 --nocapture --skip hle::d3d12x::vram::tests::reserved_resource_with_private_data_is_excluded_from_recycle reported 97 passed, including 10 SKIPPED notices, 0 failed and 1 ignored. The same selection with --release reported the same counts. The new fallback regression passed on the hardware in both profiles with 0 Debug Layer messages. The isolated private-data fixture exited with 2173 on both the archived 0877fa97 build and the new build.
  • Verification Run 19 was one retail start on the Quadro RTX 3000 with the existing DXIL cache, Lockhart, XCL_TEXTURE_BUDGET=1, XCL_L0_MIN_FREE_PHYS_MIB=3072, XCL_GFX_PSO_WAIT_MS=8000, and XCL_CS_PSO_WAIT_MS=35000. It entered the loading phase. A texture placement ran out of memory after its retries near +117 s from estimated loading start and was followed by breakpoint 0x80000003. The launcher exited at +125.1 s from estimated loading start and 166.4 s total, before the +145 s capture. No 3D world or DXGI device removal was observed.
  • local_tilepool_fallback_heaps recorded 9 new local heaps (576 MiB). At the final denied 64 MiB request, DXGI reported 5,176.8 MiB in use against a 5,187.0 MiB local budget, leaving about 2.2 MiB under the budget minus 8 MiB ceiling. Peak sampled DXGI was 5,176 MiB local and 7,266 MiB non-local. Minimum sampled available physical RAM was 2,831.4 MiB.
  • Shutdown totals recorded 53 L0 tile-pool heaps (3,392 MiB), 313 L0 physical-page heaps (1,252 MiB), 1,157 L0 committed allocations (73.75 MiB), and zero L0 arena, placed override and L0-to-L1 promotion allocations. l0_phys_ram_guard_denials recorded 312 denied 64 MiB attempts including retries. DirectStorage activity samples recorded 52,867 requests and 0 failures. OpenAI Codex (GPT-6, specific revision unavailable) implemented and ran this verification.
  • Verification Run 20 used the existing b647ecab63afb4616d7908f005e818ecf1ed3701 release binary on the Quadro RTX 3000 with the existing DXIL cache. It used Lockhart, XCL_TEXTURE_BUDGET=1, XCL_TEXTURE_SOFT_CAP_MIB=3400, XCL_L0_MIN_FREE_PHYS_MIB=2304, XCL_GFX_PSO_WAIT_MS=8000, and XCL_CS_PSO_WAIT_MS=35000. Closing 19 Chrome processes and waiting five seconds raised available physical RAM from 16.77 to 20.21 GiB. The Codex host remained running. Minimum sampled available physical RAM was 1,590.9 MiB.
  • The player menu and the loading illustration rendered. The +135 s and +190 s captures both show the loading illustration. A 64 MiB texture placement ran out of memory after its retries near +188 s from estimated loading start and was followed by 0x80000003. The last failed request had 38.8 MiB available under the local DXGI budget minus 8 MiB ceiling. The launcher exited at 240.6 s total and +199.2 s from estimated loading start, ahead of the +250 s capture. No 3D world or DXGI device removal was observed.
  • Peak sampled DXGI was 5,140 MiB local (5,187 MiB budget) and 9,515 MiB non-local. Shutdown totals included 86 L0 tile-pool heaps (5,504 MiB), 434 L0 physical-page heaps (1,736 MiB), 2,708 L0 committed allocations (173.94 MiB) and zero L0 arena, placed override and L0-to-L1 promotion allocations. local_tilepool_fallback_heaps recorded 12 heaps (768 MiB) and l0_phys_ram_guard_denials recorded 3,539 denied attempts including retries. DirectStorage activity samples recorded 77,990 requests and 0 failures. C: had a sampled minimum of 4.89 GiB free and 5.53 GiB free after verified archival. OpenAI Codex (GPT-6, specific revision unavailable) ran and reported this verification.
  • Verification Run 21 used the existing b647ecab63afb4616d7908f005e818ecf1ed3701 release binary on the Quadro RTX 3000 with the existing DXIL cache. It used Lockhart, XCL_TEXTURE_BUDGET=1, XCL_TEXTURE_SOFT_CAP_MIB=3000, XCL_L0_MIN_FREE_PHYS_MIB=1024, XCL_GFX_PSO_WAIT_MS=8000, and XCL_CS_PSO_WAIT_MS=35000. Closing 13 Chrome processes and waiting five seconds raised available physical RAM from 17.98 to 19.60 GiB.
  • The player menu and loading illustration rendered. The +140 s capture shows the loading illustration. The external watchdog requested a stop at about +176.7 s after estimated loading start when available physical RAM crossed below 1 GiB. Minimum sampled available physical RAM was 996.9 MiB. The watchdog enforced termination after its grace period at 222.6 s total and +181.3 s from estimated loading start. The +200 s, +260 s and +330 s captures were beyond the run. The logs show zero texture-placement out-of-memory reports, breakpoint exceptions and DXGI device removals.
  • Peak sampled DXGI was 4,452 MiB local (5,187 MiB budget) and 10,486 MiB non-local. Shutdown totals included 97 L0 tile-pool heaps (6,208 MiB), 497 L0 physical-page heaps (1,988 MiB), 3,241 L0 committed allocations (209.69 MiB) and zero L0 arena, placed override and L0-to-L1 promotion allocations. local_tilepool_fallback_heaps recorded zero new heaps and l0_phys_ram_guard_denials recorded 62 denied attempts including retries. DirectStorage activity samples recorded 75,646 requests and 0 failures. C: had a sampled minimum of 5.52 GiB free and 5.86 GiB after verified archival. OpenAI Codex (GPT-6, specific revision unavailable) ran and reported this verification.

Regression run

The paired main and exact-head smoke runs remain pending.

Not tested

Full workspace suite, AMD, Linux, paired smoke runs, transition into the 3D world and sustained workload behavior remain unverified on b647ecab. On the earlier combined integration head 9f9bc9b8f, Run 16 faulted in dxgmms2.sys during VidMm eviction (0x7E). Run 17 faulted in the Windows compressed-memory store (0x154, 0xC0000005 in StDmpSinglePageLookup) with around 474 MiB of available physical RAM. The dump showed 9.51 GiB of system commit headroom and 15.95 GiB free in the disk pagefile. The synthetic regression verifies the corrected release sequence. The effect on the earlier kernel crashes remains unverified.

AI use

OpenAI Codex (GPT-6, specific revision unavailable) assisted with the review fixes, rebase, regression tests, test execution and this update. Author review of this revision is pending.

@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:docs-ci Documentation, scripts, workflows, repo governance area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH area:memory Virtual/physical memory, arenas, VRAM budget, UMA gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Dec 2, 2026
@Foniass

Foniass commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Review (head 5a89516, diff read, not a merge-check; draft, checks red):

  • Too large to review as one PR; please split it. Leaving out the #[cfg(test)] modules, about 2,150 lines change (mostly vram.rs), over five times the ~400 target, with no reason given. These parts stand alone along CONTRIBUTING.md: (1) the late_release.rs / present.rs sealing change (queue snapshot, retiring marks, open_revision prefix), which changes the default path; (2) TextureBudget admission and the CUSTOM / L0 routes for committed, placed and tile-pool texture backing behind XCL_TEXTURE_BUDGET; (3) L0 routing for sparse physical-page heaps (physical_page_heap, sparse.rs); (4) keeping reserved backing until the NULL mapping completes (RecycleInfo::backing, res_release); (5) live alias promotion (vram_promotion.rs, the admission gate in q_execute_command_lists / native_queue_execute); (6) the physical RAM guard; (7) diagnostics. D3D12.X: opt-in XCL_L0_VRAM_MARGIN_MB spills sparse and sampled texture pools to L0 #3620 and D3D12.X: allow title texture pages in system memory #1702 (on main) and D3D12.X: XCL_VRAM_BUDGET keeps XCL's pools under the adapter's budget #3587 (on amd-dev) also move texture pages or sparse heaps to CUSTOM / L0; which approach goes in should be settled before splitting. Regression run has no xcl-smoke blocks (the reason PR description is red).
  • A default-path late_release change can stop all deferred releases. drain_known (late_release.rs ~317-320) now seals nothing new while snapshot.blocked is set, and blocked is also set by Retiring::Failed (present.rs ~506), which never clears (failed_retirement_is_permanently_pinned). After one queue retirement fails to create or signal its fence, every later resource, pipeline and heap release stays held for the rest of the run, with XCL_TEXTURE_BUDGET unset.
  • A refused L0 reservation reaches the title as E_OUTOFMEMORY. Once a sampled committed texture goes past the local soft cap, reserve_texture_backing (vram.rs ~2169-2176) tries only NonLocal; if the RAM guard (~2055, 3,072 MiB free by default) or the non-local budget refuses, committed_backing_with_budget returns E_OUTOFMEMORY (~2238) while local memory up to the DXGI budget is still unused, where without the budget the creation went to the driver.

Not reviewed line by line because of the size. Fine: the allocation routing and promotion gate are behind XCL_TEXTURE_BUDGET=1; fence reads treat u64::MAX as not complete; a submit gets admission before it takes the queue lease.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@jeroenhaentjens

Copy link
Copy Markdown
Contributor Author

@Foniass Both review fixes are in d58531c2. Deferred releases on healthy queues now progress after a failed retirement, and eligible committed backing retries locally up to the DXGI budget minus 8 MiB if L0 admission is denied. Both new regressions passed on the Quadro with zero Debug Layer messages. The draft will be split into smaller PRs once Windows CI and stability validation are green.

@Foniass

Foniass commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up review (head d58531c, since 5a89516, diff read, not a merge-check; draft, conflicts):

Earlier points:

  • Too large; please split. No xcl-smoke blocks. Open. The PR is now +3,389 / −265 with no reason given for not splitting, and Regression run still has no smoke blocks. It also conflicts with main now.
  • A late_release change can stop all deferred releases. Fixed in 74e574d0. A Failed retirement now sets failed instead of blocked in the release snapshot (present.rs ~509). Ordinary batches seal against the remaining queues as on main. take_gone(true) lets ready batches pass an older batch that waits on the failed queue.
  • A refused L0 reservation reaches the title as E_OUTOFMEMORY. Fixed in 6c9b1a9a. reserve_texture_backing (vram.rs ~2187-2190) retries an Either backing as RequiredLocal up to the DXGI ceiling before it fails.

New:

  • After one failed retirement, mapped reserved-pool textures are never released, even with the budget off. Once a queue is Failed, which never clears, every later batch is sealed with unmarked_retirement = true. For those batches, drain_known (late_release.rs ~361) continues past any resource for which has_parked_backing is true. That includes was_mapped entries of the reserved pool (vram.rs ~967), and the pool is on by default (XCL_RESERVED_POOL, ~756/3829), not only budget backing. Those resources stay in PARKING: never unmapped, never recycled, never Released, and nothing retries them. On a title that streams reserved textures, memory grows for the rest of the run, where on main they were recycled. If keeping them is needed for safety, limit it to the failed queue's own work, or at least log it and count the held bytes.

Fine: begin_known_seal still refuses to seal while a retirement is Preparing. The new GPU tests cover the failed-queue recovery and the local fallback after an L0 denial. The test-adapter change in d58531c2 is scoped to its fixture.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

Route eligible sampled backing through non-local memory under DXGI pressure. Keep render targets, depth and UAV backing local, promote overlapping tile aliases after the GPU completes, and report individual allocation routes.

Assisted-by: Codex (GPT-6, specific model version not exposed)
@jeroenhaentjens
jeroenhaentjens force-pushed the feat/two-tier-texture-budget-l0 branch from d58531c to d7ddf34 Compare December 2, 2026 18:03
@jeroenhaentjens

Copy link
Copy Markdown
Contributor Author

@Foniass I rebased the draft on main 817eb1fc. At d7ddf34d the parked-backing guard follows the individual failed queue's completion dependency. A reserved texture on a healthy device still recycles while the other device's queue stays failed. Same-device backing that outstanding bindless work may still reference remains protected until the recovered mark completes. The Quadro regression and the targeted runs are recorded in the description.

@Foniass

Foniass commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up review (head d7ddf34, since d58531c, diff read, not a merge-check; draft):

Earlier points:

  • Too large; please split. No xcl-smoke blocks. Open. The PR is now +3,642 / −307, and Regression run has no smoke blocks. The conflict is gone after the rebase.
  • After one failed retirement, mapped reserved-pool textures are never released. Mostly fixed in d7ddf34d.
    • A parked texture is now held only for a failure on its own device (parked_retirement_pending, late_release.rs ~346).
    • It is held until that queue's marker completes. The retirement worker retries the marker every 250 ms (retry_failed_retirements, present.rs ~665).
    • Held items are rechecked on each drain through waiting_for_retirement.
  • The late_release and L0-fallback fixes from 74e574d0 / 6c9b1a9a are unchanged by the rebase (git range-diff).

New:

  • Commits 2bbb971e through 7c592be1 do not build. 2bbb971e makes PendingRecycle::key an Option and adds backing, and it removes promote_pending. make_spares (vram.rs ~1031) and its tests, which came from main (D3D12.X: hand the title reserved textures with live page tables #3553), still use the old form until 10c0afee adapts them. Every commit lands on main, so squash 10c0afee into 2bbb971e to keep git bisect working.
  • The new test, like five other GPU tests this PR adds, skips on AMD and Intel.
    • gpu_failed_retirement_leaves_healthy_reserved_pool_recyclable (vram.rs ~9154), and the tests at ~5105, ~5224, ~5479, ~5803 and ~9282, use Selector::from_env_or("nvidia"). Without XCL_ADAPTER set, no adapter matches on those machines, so the tests are SKIPPED there, including on the maintainer's RDNA4 batch run. The rest of the crate uses "auto".
    • The new test also places the failed queue on a WARP device, so it covers the cross-device release. The same-device path is covered only by direct parked_retirement_pending calls with a hand-set mark; nothing runs the worker retry in retry_failed_retirements.

Fine: the snapshot still blocks sealing while a retirement is Preparing. A Recovering entry is swept like a Mark once its fence completes. Held::is_empty counts held items, so the drain keeps running for them.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

Keep the last resource reference and tile users until the submit queues and the NULL mapping are complete. Include stopping queues, reject the device-removed fence sentinel, and signal outside the release lock. Exercise a blocked L0 upload and mapping on the selected GPU.

Assisted-by: OpenAI Codex (GPT-6, exact variant unavailable)
(cherry picked from commit 00dfacb)
Check available physical memory in the common non-local reservation before calling the driver. Charge concurrent L0 requests, retain a configurable floor, and report denials.

Assisted-by: OpenAI Codex (GPT-6, exact variant unavailable)
(cherry picked from commit 9ce27a1)
Query DXGI on the selected adapter with the Debug Layer and assert a clean diagnostic queue. Keep the fixture out of the process-owned title backend and isolate the Debug Layer from other tests.

Assisted-by: OpenAI Codex (GPT-6, exact variant unavailable)
(cherry picked from commit 93d613f)
Distinguish a temporary retirement from a failed, pinned queue. Let later batches finish on the remaining queues while older fences and unproven reserved backing stay protected. Test the failure and recovery with a native fence on a healthy queue.

Assisted-by: OpenAI Codex (GPT-6, specific revision unavailable)
For backing eligible on both segments, reuse the hard local admission limit after a non-local reservation is denied. Charge the allocation to the same DXGI sample and verify that the next request cannot exceed the remaining headroom.

Assisted-by: OpenAI Codex (GPT-6, specific revision unavailable)
Use the configured adapter and verify its debug info queue. This allows the fixture to run with D3D12 validation enabled on a multi-adapter host.

Assisted-by: OpenAI Codex (GPT-6, specific revision unavailable)
Keep a separate completion dependency for each failed queue. A deferred texture on another device can recycle immediately. Same-device work can keep referencing bindless descriptors until the stopped queue has a proven completion marker. Retry that marker on the retirement worker and recheck held backing when it completes.

Assisted-by: OpenAI Codex (GPT-6, specific revision unavailable)
Use automatic adapter selection in the six new GPU tests while retaining the XCL_ADAPTER override and the existing feature checks.

Assisted-by: OpenAI Codex (GPT-6, specific revision unavailable)
@jeroenhaentjens
jeroenhaentjens force-pushed the feat/two-tier-texture-budget-l0 branch from d7ddf34 to 0877fa9 Compare December 2, 2026 18:28
@jeroenhaentjens

Copy link
Copy Markdown
Contributor Author

@Foniass I folded 10c0afe into 2bbb971, which is now fd938727. All nine commits passed cargo check --locked -p xcl --tests. All six new VRAM GPU tests now default to auto, and the targeted runs on the Quadro passed at 0877fa97.

@Foniass

Foniass commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up review (head 0877fa9, since d7ddf34, diff read, not a merge-check; draft, checks red):

Earlier points:

  • Commits 2bbb971e through 7c592be1 do not build. Fixed. The make_spares adaptation is now part of fd938727, the rewritten 2bbb971e (git range-diff), and 10c0afee is gone. The final tree is unchanged apart from the adapter selection below.
  • GPU tests the PR adds skip on AMD and Intel. Fixed in 0877fa97: all six use Selector::from_env_or("auto"). That commit only changes tests added earlier in this PR, so it could be folded into them.
  • Same-device retry path untested. Still open: no test runs retry_failed_retirements (present.rs ~665).
  • Too large; please split. No xcl-smoke blocks. Open, at +3,642 / −307.

New: none.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@github-actions github-actions Bot added needs-pr-check Failing the PR description check (CONTRIBUTING.md) and removed needs-pr-check Failing the PR description check (CONTRIBUTING.md) labels Dec 2, 2026
Above the pool spill threshold, keep the L0 preference and retry the
remaining sampled tiles locally if the pool cannot grow in L0. Reuse
compatible tiles and admit any new heap under DXGI budget minus 8 MiB.
Count the fallback heaps so retail runs can verify the route.

Test the fallback on a discrete GPU with a full synthetic non-local
budget, verify reuse, and reject a second heap beyond the local ceiling.

Assisted-by: OpenAI Codex (GPT-6, specific revision unavailable)
@github-actions github-actions Bot added needs-pr-check Failing the PR description check (CONTRIBUTING.md) and removed needs-pr-check Failing the PR description check (CONTRIBUTING.md) labels Dec 2, 2026
@github-actions github-actions Bot added needs-pr-check Failing the PR description check (CONTRIBUTING.md) and removed needs-pr-check Failing the PR description check (CONTRIBUTING.md) labels Dec 2, 2026
@Foniass

Foniass commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up review of b647ecab, since 0877fa97 (code reading only, not a merge-check; draft, Build and test (Windows, no GPU) red, PR description red) · 1 high, 3 medium

In short: The only change since 0877fa97 is one new commit on top, b647ecab; the earlier commits are identical (git range-diff). Above the sampled tile-pool spill threshold it still tries L0 first, then finishes the batch from local memory when the L0 heap is refused. It works as described and has a GPU test. The PR is still blocked by its size and the missing smoke blocks. The new fallback can also use up the local reserve kept for render targets.

High

  1. Too large; please split. No xcl-smoke blocks (still open). The PR is now +3,718 / −313 in 14 files, with no reason given for not splitting, and Regression run has no smoke blocks. The parts listed in the first review still stand alone. The new tile-pool fallback would go with the TextureBudget admission part.

Medium

  1. The same-device retry path is untested (still open). No test runs retry_failed_retirements (present.rs ~665).

  2. The sampled tile-pool fallback can use up the reserve kept for RT/DS/UAV.

    • alloc_pool_heap (vram.rs ~2694-2695) turns every LocalReserve request into TextureAdmission::RequiredLocal. Its limit is DXGI budget minus 8 MiB (~2194), the same ceiling render targets, depth buffers and UAVs use. The fallback heaps are full 64 MiB pools.
    • Once L0 is refused, sampled streaming can fill local memory up to the ceiling the PR's own policy keeps for required resources. In the description's Run 19, nine fallback heaps took local use to 5,176.8 of 5,187 MiB before the next placement ran out.

    Fix: stop the sampled fallback some margin below the required ceiling, or say in the description and README that sampled tiles share that ceiling on purpose.

  3. An L0 refusal that the fallback absorbs is still logged as a failed allocation, on every bind.

    • With no free L0 tiles, each bind first calls make_heap with NonLocal, even when a local fallback heap has free tiles.
    • The refusal reaches site.log(.., "heap admission denied", true) (~2704). Denied entries are not rate-limited (~2557), so each one writes the request, the full allocation totals and the breakdown, plus a GlobalMemoryStatusEx call.
    • Run 20 records 3,539 guard denials for binds that succeeded.

    Fix: log the denial only when the local retry also fails, or rate-limit it like the routed entries.

Checked and fine
  • The earlier fixes (every commit builds, the GPU fixtures use the default adapter) are unchanged by b647ecab.
  • The fallback is reachable only with XCL_TEXTURE_BUDGET=1: TileSegments::NonLocal is chosen only with a budget sample and over_local_limit (~3423-3426).
  • take_compatible_batch (~2068-2083) keeps the L0 tiles it took and continues from local heaps. If the local heap also fails, it returns every taken tile through return_tiles.
  • LocalReserve allows only local heaps, so free local tiles of the same class are reused before a new heap is made.
  • The l0_unsupported and physical RAM guard refusals now fall back too, instead of reaching the title as E_OUTOFMEMORY (~4113).
  • local_tilepool_fallback_heaps is a subset of local_tilepool_heaps, and the counter arrays grew together.
  • sampled_tile_pool_uses_local_headroom_after_non_local_denial fails without the change. It covers reuse of the fallback heap, refusal past the ceiling, and free_total coming back.
  • A tile-pool opt-out at 5,179 MiB still returns BindFailure::Budget (~6240). README describes the new route.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:docs-ci Documentation, scripts, workflows, repo governance area:hle kernelx, XGameRuntime, XAudio2, VFS, PE loader, TLS, EH area:memory Virtual/physical memory, arenas, VRAM budget, UMA gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) needs-pr-check Failing the PR description check (CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants