Skip to content

D3D12.X: release retired sparse heaps on ordinary submits - #1837

Open
gloger2003 wants to merge 1 commit into
xcl-dev:mainfrom
gloger2003:fix/reap-retired-sparse-pools
Open

gloger2003 wants to merge 1 commit into
xcl-dev:mainfrom
gloger2003:fix/reap-retired-sparse-pools

Conversation

@gloger2003

Copy link
Copy Markdown

Part of #1773. Sparse heaps pending release used to be revisited on submission only when the submission unmaps parked tiles. A steady workload could keep submitting commands after the heap's fence and reuse delay had passed while the heap remained held.

What is in it

  • Checks already-retired sparse heaps on ordinary submissions, with the existing two-second reuse window and sparse fence requirement.
  • Extends the native pool-reuse test to cover a recent pool, an old pool waiting on the fence, and release on a submit with no parked mappings.

Tested

  • AMD Radeon RX 7800 XT (32.0.32029.2010), Ryzen 7 5700X, Windows 11 26300.9974, Rust 1.100.0 MSVC. Debug tests and release title runs.
  • The added assertion failed with the original submission behavior and passed with the fix.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output passed 891 tests, with 0 failures and 42 ignored. The heap-window fallback check passed separately with its opt-in enabled.

Regression run
Minecraft Preview, identical 1x MSAA profile.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 7800 XT
title: Xbox-Series-1.18.3064.0
seconds: 30
exit: 0x0
frames shown: 1629 (PresentX 1629)
presents per 2 s (last 3): 120 120 120
device removals: 0
crashes: 0
peak commit: 3379 MB
xcl-smoke v1
commit: ec610d9771c0e56b7ceacda6648ec27925160f11
gpu: AMD Radeon RX 7800 XT
title: Xbox-Series-1.18.3064.0
seconds: 30
exit: 0x0
frames shown: 1612 (PresentX 1612)
presents per 2 s (last 3): 120 120 120
device removals: 0
crashes: 0
peak commit: 3386 MB

Not tested

  • Memory over a long world-loading session. The title run covers startup and menu rendering. The 64 MiB pool release is exercised by the native test.

AI use

  • OpenAI Codex (GPT-6.2 Sol, high reasoning effort, Fast mode) reproduced and fixed the issue, reviewed the changes, and ran validation.

Keep the sparse fence and reuse delay checks active on submissions that do not unmap any parked tiles. A native D3D12 test verifies retirement, reuse, the age and fence guards, and release without any newly parked mapping.

Part of xcl-dev#1773

Assisted-by: OpenAI Codex (GPT-6.2 Sol)
@gloger2003
gloger2003 marked this pull request as ready for review November 24, 2026 22:09
@frenziedcoder

Copy link
Copy Markdown

NVIDIA test report for ec610d9: full suite green, no own test to run, and a clean smoke pair on the retail title (1657 vs 1653 frames).

Tested

  • NVIDIA GeForce RTX 5080 16 GB (driver 617.14, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head ec610d9771c0e56b7ceacda6648ec27925160f11, no local changes.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 (debug): 891 passed, 0 failed, 42 ignored; the PR adds no test of its own. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • test_title_draws_with_a_root_signature_under_the_debug_layer reports ok, but this machine has no D3D12 debug layer (debug layer requested but unavailable … (0x887A002D)), so it ran without the layer and is no evidence either way.

Regression run (scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen; XCL_PSO_PRELOAD=0 for both builds, because this machine's preload list holds the program of #1307)

base (4178e88, this PR's merge base with main):

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 5080
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1653 (PresentX 1653)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14603 MB

this PR:

xcl-smoke v1
commit: ec610d9771c0e56b7ceacda6648ec27925160f11
gpu: NVIDIA GeForce RTX 5080
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1657 (PresentX 1657)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14599 MB

Not tested: the world load (the smoke runs stop at the start screen, so code that only runs later is not exercised there); AMD.

AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.

@lewisnic94-max lewisnic94-max left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed ec610d9771c0e56b7ceacda6648ec27925160f11. The ordinary-submit path retained a recently retired sparse pool for reuse. After the fixture aged the pool past the two-second window, a submit with no parked mappings still retained it while its fence was pending. Signalling the recorded fence value let the next ordinary submit release it. I found no actionable defect in these retirement and fence transitions.

cargo test --offline --locked -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=1 reported 14 passed, 0 failed, 1 ignored (early_commit_timing), and 0 skip notices. Windows 11 build 26200.9974, Ryzen 7 5800X, RTX 3080 driver 616.92, debug MSVC Rust 1.100.0. This synthetic test did not measure long-running title residency or sustained VRAM pressure.

Codex (GPT-6) traced the release and reuse paths, ran the sparse suite and checked the fence assertions.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

PR #1837 — D3D12.X retired sparse heaps on ordinary submits

Tested detached head ec610d9771c0e56b7ceacda6648ec27925160f11 on STOR-WINLAB. The sparse-heap regression test passed in both runs. The workspace suite exited 101.

Environment

Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver 32.0.101.9175, wave range 8–32, DoublePrecisionFloatShaderOps=0). The D3D12 SDK debug layer was unavailable. Rust 1.100.0 (0ef1bc386), DXC/DXIL 1.9.2609.5, unoptimized builds with debug info and incremental compilation disabled. XCL_ADAPTER=A770.

Tested

  • cargo build --workspace and cargo test --workspace --no-run both succeeded outside the GPU lock.
  • cargo test -p xcl --lib hle::d3d12x::sparse::tests:: -- --test-threads=1 under the Arc lock produced 14 passed, 0 failed, 1 ignored, 0 SKIPPED lines. a_pool_retired_a_moment_ago_is_taken_back checked that submit preparation with no parked mappings retains a recent pool and an expired pool with an incomplete fence, then releases the expired pool when the fence completes. This test uses the default D3D12 device with a WARP fallback and does not log its adapter.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once under the Arc lock. The 20 summaries in pr1837-suite.log total 873 passed, 18 failed, 42 ignored. The log contains 4 SKIPPED lines, which are excluded from coverage claims.

Failures and skips

  • 17 library failures. 13 rejected compute PSO creation (0x80070057), including FP64 tests. Four shader assertions covered FMA overflow, implicit mip LOD, FP16 high-half preservation, and pixel wave reductions.
  • One test-title failure. The dynamic depth-bias check (RSSetDepthBiasX, Split wave64: masks read only lane by lane stay in their half #94) read blue where it expected green.
  • Four skip markers. Two lacked wave64, one lacked heap windows, and one could not disable the driver cache (0x887A002D).

Not tested

No main comparison to attribute the suite failures, retail title smoke run or memory measurement, sample-backed coverage (XCL_SAMPLE_* unset), or other adapters.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1837-suite.log and published this report.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@pickles976

pickles976 commented Nov 25, 2026 •

Copy link
Copy Markdown

Wine / RTX 4060 Laptop verification of ec610d9771c0e56b7ceacda6648ec27925160f11, combined with #1838 at 2e56d37f1dbd27e1a004b556f4e2192f41f065e8.

Tree and host: ports onto the mixed integration described in my #751 report, including that Wine guard-page correction; not either clean PR head. I retained the integration's existing lock_state() wrapper. Linux 6.17.0-40-generic, Wine 11.0, stock/assert-enabled vkd3d-proton 3.2.0 (2576c0b4adfae4a), NVIDIA 590.48.01, RTX 4060 Laptop 8 GB, i7-13620H, 16 GB RAM, Rust 1.98.1 MSVC cross-build.

Focused regression: cargo test -p xcl --lib --target x86_64-pc-windows-msvc a_pool_retired_a_moment_ago_is_taken_back -- --test-threads=1 --nocapture passed 1/1, no failures/ignores/skips. The log identifies the NVIDIA RTX 4060 Laptop and vkd3d 3.2. The unchanged upstream additions cover retaining a recent heap, retaining an expired heap while its fence is incomplete, releasing it on an ordinary submit after fence completion, and #1838's active/occupied/retired accounting across reuse and release. Release build passed. No full-suite claim.

Bounded title loading: saved setup profile, warm caches, Lockhart profile, XCL_COHERENT_MB=3408 XCL_DEFER_PRIVATE_HOME_TILES=1 XCL_PSO_PRELOAD=1 XCL_ACTIVITY=1, scripted A at 40/55 seconds. The external RAM guard stopped this run at the last sample of 68.60 s, with 1,760.6 MiB available RAM (2,048 MiB guard), 6,145 MiB GPU usage, and 13.302 GiB disk free. Peak sampled GPU usage was 6,209 MiB. Launcher exit 143 was our guard stop, not an observed crash. No unhandled-exception/device-loss/OOM marker in the log; other display/pipeline diagnostics remain.

The new accounting produced 33 samples. Retired capacity changed through 0 → 192 → 384 → 128 → 0 → 64 → 0 → 64 → 0 MiB; parked-mapping coverage peaked at 164 MiB. This shows the counters changing and returning to zero, not that this title exercised the specific no-parked-mappings regression path; the fixture covers that path.

Limits: host workload changed during the run, and this stopped earlier than the preceding VRAM-limited run. This is not a comparable memory/performance A/B result, a measured memory saving, gameplay, or a 15-minute stability result. I did not weaken either resource guard.

AI assistance: omp / openai-codex/gpt-6-astra ported and tested the existing PRs, inspected the measurements, and drafted/submitted this report at the repository owner's request.

Follow-up: restored system-RAM headroom

Repeated the same local integration after the user closed Firefox: available RAM at launch 12,410.7 MiB, board VRAM 186 MiB. This time the guard stopped at 110.45 s / 7,542 MiB VRAM, with 2,932.2 MiB RAM available and 13.399 GiB disk free (launcher 143). It was the VRAM threshold, not the previous RAM stop. No unhandled-exception/device-loss/OOM markers were found in the console log; untranslated mesh-pipeline errors still occur.

Adjacent memory diagnostics show retired heaps 384 → 0 MiB, with DXGI local usage 6,961 → 6,581 MiB. Later, render-target pages reached 2,409 MiB in 2,624 MiB pools; active sparse pools were 3,648 MiB, with 2,411 MiB occupied, zero parked mappings and zero retired. Thus completed-heap reclamation is observable, but this integration still does not fit the loading phase inside the 7,500 MiB board-VRAM safety threshold. The unused capacity inside active sparse pools is distinct from retired heaps.

No 15-minute gameplay or 30-fps claim. The two runs are not a controlled performance comparison; closing the browser changed host load.

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants