D3D12.X: skip repeated exhausted descriptor searches #2535

Open
jeroenhaentjens wants to merge 1 commit from upstream-pr/2545 into main
jeroenhaentjens commented 2026-11-25 22:33:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jeroenhaentjens on 2026-11-25T22:33:41Z.


Unmapped descriptor pages repeatedly scan the same fragmented shared pool after allocation fails. Remember the smallest failed request separately for view and sampler pools until a nonzero release; smaller requests still use the existing first-fit allocator.

What is in it

  • One change in console_heap.rs: failure-size caching under the existing pool mutexes, invalidated by both release paths.
  • Four regressions cover repeated failures, smaller requests, coalescing, cursor straddles, independent pools and 8192 operations compared with the uncached allocator. The production-page fixture reduces 256 failed lookups to two searches.
  • Independently implemented around XCL's allocator after investigating Belobug's exhaustion report; no external source imported. Existing capacity and fallback behavior are preserved.

Tested

  • Windows 11 build 26200, Intel i7-9750H, NVIDIA Quadro RTX 3000 (597.06), Rust 1.100.0 MSVC; debug/unoptimized, incremental/debug info disabled, XCL_ADAPTER=nvidia.
  • Clean head 35aaf980394992ca340dc0aa38461ce1daf198cb, based on main e1d84b7: cargo build --workspace --locked passed; cargo test --workspace --locked --no-fail-fast -- --test-threads=4 exited 0: 1427 reported passes, 0 failures, 46 ignored across 37 completed suites.
  • 29 explicit SKIPPED records: 21 native-wave64, 3 unsupported per-lane FP16/conversion, 1 driver-cache control, 3 debug-layer cases, 1 heap-window case. Reported passes include skipped cases; these and absent game-sample inputs are not coverage.
  • cargo test --locked -p xcl --lib hle::d3d12x::console_heap::tests:: -- --test-threads=4 --nocapture: 16 passed, 0 failed/ignored/skipped. Removing only the cache guard makes both repeated-search regressions fail: 14 passed, 2 failed, exit 101.
  • git diff --check passed; independent subagents reviewed allocation invariants, release invalidation and test isolation.

Regression run
Not run: no suitable game package available. Remains draft pending paired main/head scripts/smoke.ps1 runs.

Not tested
Retail descriptor pressure, gameplay/FPS improvement and AMD hardware. The deterministic regressions establish avoided scans and unchanged allocation results, not a measured world-load improvement.

AI use
OpenAI Codex, GPT-6 (exact deployment variant unavailable), with subagents: implementation, tests, independent reviews and the reported local validation.

<!-- greyfinch-sync:ivall/xcl:issue:5500331379 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2545). Originally posted by [jeroenhaentjens](https://github.com/jeroenhaentjens) on 2026-11-25T22:33:41Z. --- Unmapped descriptor pages repeatedly scan the same fragmented shared pool after allocation fails. Remember the smallest failed request separately for view and sampler pools until a nonzero release; smaller requests still use the existing first-fit allocator. **What is in it** - One change in `console_heap.rs`: failure-size caching under the existing pool mutexes, invalidated by both release paths. - Four regressions cover repeated failures, smaller requests, coalescing, cursor straddles, independent pools and 8192 operations compared with the uncached allocator. The production-page fixture reduces 256 failed lookups to two searches. - Independently implemented around XCL's allocator after investigating [Belobug's exhaustion report](https://github.com/Belobug/VIctory-Belobug-AMD/commit/788ea4676ec7ddf11ff35ac213afa83d828cfa4c); no external source imported. Existing capacity and fallback behavior are preserved. **Tested** - Windows 11 build 26200, Intel i7-9750H, NVIDIA Quadro RTX 3000 (597.06), Rust 1.100.0 MSVC; debug/unoptimized, incremental/debug info disabled, `XCL_ADAPTER=nvidia`. - Clean head `35aaf980394992ca340dc0aa38461ce1daf198cb`, based on main `e1d84b7`: `cargo build --workspace --locked` passed; `cargo test --workspace --locked --no-fail-fast -- --test-threads=4` exited 0: 1427 reported passes, 0 failures, 46 ignored across 37 completed suites. - 29 explicit `SKIPPED` records: 21 native-wave64, 3 unsupported per-lane FP16/conversion, 1 driver-cache control, 3 debug-layer cases, 1 heap-window case. Reported passes include skipped cases; these and absent game-sample inputs are not coverage. - `cargo test --locked -p xcl --lib hle::d3d12x::console_heap::tests:: -- --test-threads=4 --nocapture`: 16 passed, 0 failed/ignored/skipped. Removing only the cache guard makes both repeated-search regressions fail: 14 passed, 2 failed, exit 101. - `git diff --check` passed; independent subagents reviewed allocation invariants, release invalidation and test isolation. **Regression run** Not run: no suitable game package available. Remains draft pending paired main/head `scripts/smoke.ps1` runs. **Not tested** Retail descriptor pressure, gameplay/FPS improvement and AMD hardware. The deterministic regressions establish avoided scans and unchanged allocation results, not a measured world-load improvement. **AI use** OpenAI Codex, GPT-6 (exact deployment variant unavailable), with subagents: implementation, tests, independent reviews and the reported local validation.
DavidM1911 commented 2026-11-25 23:09:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T22:46:52Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7176778915 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2545#issuecomment-7176778915). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T22:46:52Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
SlopTart commented 2026-11-26 00:05:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T23:33:29Z.


Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted runs of the four new range-search tests (cached_range_search_matches_uncached_allocation_and_release_sequences, the two failed_range_search* retry/reuse tests, failed_page_searches_retry_when_their_own_pool_releases_space): 4 passed.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7177728373 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2545#issuecomment-7177728373). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T23:33:29Z. --- **Tested**: current PR head merged onto current `origin/main` (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target `x86_64-pc-windows-gnu` run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). `gpu_` suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. Targeted runs of the four new range-search tests (`cached_range_search_matches_uncached_allocation_and_release_sequences`, the two `failed_range_search*` retry/reuse tests, `failed_page_searches_retry_when_their_own_pool_releases_space`): 4 passed. **Not tested**: retail titles (no title data on this lane, counts only). **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
github-actions[bot] commented 2026-11-29 20:44:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:44:50Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7262325284 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2545#issuecomment-7262325284). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T20:44:50Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 08:20:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:20:27Z.


Triage (#1607) – head 35aaf98

No open or merged PR makes the same change (#2405 handles an exhausted hosted view heap differently, and #2782 added fence-quarantined ranges).
The cache is only correct while every path that adds ranges to free clears failed_at. Since #2782, main also adds them outside release_global/release_global_sampler: pop_ready_ranges -> leases.release_range in reserve_global_sampler, leases.finish*, and the retired-range drain. After the rebase, those paths must reset failed_at too. The sampler path must also drain the ready ranges before the early None, or the pool can report full after space has come back.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305189131 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2545#issuecomment-7305189131). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:20:27Z. --- **Triage (#1607)** – head 35aaf98 No open or merged PR makes the same change (#2405 handles an exhausted hosted view heap differently, and #2782 added fence-quarantined ranges). The cache is only correct while every path that adds ranges to `free` clears `failed_at`. Since #2782, main also adds them outside `release_global`/`release_global_sampler`: `pop_ready_ranges` -> `leases.release_range` in `reserve_global_sampler`, `leases.finish*`, and the retired-range drain. After the rebase, those paths must reset `failed_at` too. The sampler path must also drain the ready ranges before the early `None`, or the pool can report full after space has come back. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2545:upstream-pr/2545'
git switch 'upstream-pr/2545'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2545'
git switch 'upstream-pr/2545'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2545'
git switch 'upstream-pr/2545'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2545'
git switch 'main'
git merge --squash 'upstream-pr/2545'
git switch 'main'
git merge --ff-only 'upstream-pr/2545'
git switch 'main'
git merge 'upstream-pr/2545'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2535
No description provided.