D3D12.X: keep 128 MiB of compute and 64 MiB of graphics driver blobs, not 768 #3328

Open
Prime1997 wants to merge 1 commit from upstream-pr/3328 into main
Prime1997 commented 2026-11-29 08:30:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-29T08:30:33Z.


Requested by Prime

The driver blobs XCL keeps in memory, so that a pipeline made again skips the driver's compile, fill up to 512 MiB (compute and two-pass) and 256 MiB (graphics) of process memory and are never given back. In a retail world on an RTX 3060 Ti with 8 GB, the machine ran out of physical memory at about 225 s and Windows trimmed the process from then on. The stores now keep 128 MiB and 64 MiB.

Since keep_driver_blob_at decides the disk save apart from room in memory, a full store does not stop a slow build's blob from reaching the disk cache (the per-kind time thresholds still apply): a pipeline made again after the store fills reads its file, or goes back to the driver and the driver's own cache. On AMD the disk cache is off by default, so there it is always the driver.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: COMPUTE_BLOBS_MAX 512 -> 128 MiB, GRAPHICS_BLOBS_MAX 256 -> 64 MiB

Tested

  • RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, 32 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0; the suite in debug, the smoke on a release build of the head commit
  • cargo test --workspace --no-fail-fast -- --test-threads=4 with the three uma_driver tests below skipped, on 750ffb255c: 2605 passed, 0 failed, 49 ignored (SKIPPED GPU tests: 28 lines: 21 no wave64 (this card runs wave32), 3 a wave32 per-lane form refused by the translator (#1426), 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1), 1 no dxc.exe, 1 cannot disable the driver cache (needs Windows Developer Mode))
  • the three skipped tests on their own (cargo test -p xcl --lib -- --test-threads=1 uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment uma_driver::tests::failed_restore_stops_before_importing_an_unbacked_window): 3 passed, 0 failed. They are left out of the whole run because on this PC's driver they can end the library test process (exit 0x7c10003, "coherent window could not be restored"), on main too
  • the library harness twice more (cargo test -p xcl --lib -- --test-threads=4, same skips): 2466 passed, 0 failed; 2466 passed, 0 failed
  • the same whole run on main fa204595a4: 2605 passed, 0 failed, 49 ignored, 28 SKIPPED lines (own-prs-20261129 run, same command)
  • retail title (60 s scripts/smoke.ps1, no input, copied profile and shader cache): blocks below

Regression run

xcl-smoke v1
commit: fa204595a488c60c6c5f905244f0172072c9c2a9
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1334 (PresentX 1334)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15272 MB
xcl-smoke v1
commit: 750ffb255c5dd67fdac56c1b114daffa7f1ebb90
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1533 (PresentX 1534)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15379 MB

Not tested

  • AMD GPUs (this is an NVIDIA wave32 card)
  • the retail title's world: the 60 s runs end on the title's start-up screens
  • No unit test: two constants. The memory saved in a retail world was not measured for this change alone; the 225 s figure above is from earlier runs of a local branch with more changes.

AI use

  • Claude Code wrote the change, wrote this description, and ran the tests and the smoke runs on this PC. The model is not named here: this session cannot tell which model served each turn.

Optional temporary Discord for coordinating contributor work, testing and comparing results.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5549026710 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3328). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-29T08:30:33Z. --- <!-- claude-projects-attribution: {"github_login":"Prime1997"} --> _Requested by **Prime**_ The driver blobs XCL keeps in memory, so that a pipeline made again skips the driver's compile, fill up to 512 MiB (compute and two-pass) and 256 MiB (graphics) of process memory and are never given back. In a retail world on an RTX 3060 Ti with 8 GB, the machine ran out of physical memory at about 225 s and Windows trimmed the process from then on. The stores now keep 128 MiB and 64 MiB. Since `keep_driver_blob_at` decides the disk save apart from room in memory, a full store does not stop a slow build's blob from reaching the disk cache (the per-kind time thresholds still apply): a pipeline made again after the store fills reads its file, or goes back to the driver and the driver's own cache. On AMD the disk cache is off by default, so there it is always the driver. **What is in it** - `crates/xcl/src/hle/d3d12x/real.rs`: `COMPUTE_BLOBS_MAX` 512 -> 128 MiB, `GRAPHICS_BLOBS_MAX` 256 -> 64 MiB **Tested** - RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, 32 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0; the suite in debug, the smoke on a release build of the head commit - `cargo test --workspace --no-fail-fast -- --test-threads=4` with the three `uma_driver` tests below skipped, on 750ffb255c5d: 2605 passed, 0 failed, 49 ignored (SKIPPED GPU tests: 28 lines: 21 `no wave64` (this card runs wave32), 3 a wave32 per-lane form refused by the translator (#1426), 2 `no heap windows` (opt-in `XCL_HEAP_WINDOWS=1`), 1 `no dxc.exe`, 1 `cannot disable the driver cache` (needs Windows Developer Mode)) - the three skipped tests on their own (`cargo test -p xcl --lib -- --test-threads=1 uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment uma_driver::tests::failed_restore_stops_before_importing_an_unbacked_window`): 3 passed, 0 failed. They are left out of the whole run because on this PC's driver they can end the library test process (exit 0x7c10003, "coherent window could not be restored"), on `main` too - the library harness twice more (`cargo test -p xcl --lib -- --test-threads=4`, same skips): 2466 passed, 0 failed; 2466 passed, 0 failed - the same whole run on `main` fa204595a488: 2605 passed, 0 failed, 49 ignored, 28 `SKIPPED` lines (own-prs-20261129 run, same command) - retail title (60 s `scripts/smoke.ps1`, no input, copied profile and shader cache): blocks below **Regression run** ``` xcl-smoke v1 commit: fa204595a488c60c6c5f905244f0172072c9c2a9 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 1334 (PresentX 1334) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 15272 MB ``` ``` xcl-smoke v1 commit: 750ffb255c5dd67fdac56c1b114daffa7f1ebb90 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 1533 (PresentX 1534) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15379 MB ``` **Not tested** - AMD GPUs (this is an NVIDIA wave32 card) - the retail title's world: the 60 s runs end on the title's start-up screens - No unit test: two constants. The memory saved in a retail world was not measured for this change alone; the 225 s figure above is from earlier runs of a local branch with more changes. **AI use** - Claude Code wrote the change, wrote this description, and ran the tests and the smoke runs on this PC. The model is not named here: this session cannot tell which model served each turn. Optional temporary [Discord](https://discord.gg/6B4TykyC4W) for coordinating contributor work, testing and comparing results. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
saintwolf commented 2026-11-29 13:47:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-29T13:47:52Z.


Reviewed and tested at 750ffb25.

Clean, minimal change (COMPUTE_BLOBS_MAX: 512 -> 128 MiB, GRAPHICS_BLOBS_MAX: 256 -> 64 MiB) that trims up to 576 MiB of in-memory blob commit. Only minor question is whether any long-run measurement confirmed 128 / 64 MiB doesn't increase disk re-reads for titles with large shader working sets (especially alongside #3332).

Tested locally

  • Windows 11 (build 26300), NVIDIA GeForce RTX 4070 SUPER (driver 32.0.16.2140), AMD Ryzen 7 7800X3D, rustc 1.100.0.
  • cargo test -p xcl --lib hle::d3d12x::real::driver_cache:: -- --test-threads=1: 19 passed, 0 failed.

AI use

  • Antigravity (Gemini 4 Neon) assisted with code review and drafting; all builds and tests were executed locally on the hardware above.
<!-- greyfinch-sync:ivall/xcl:comment:7256808362 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3328#issuecomment-7256808362). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-29T13:47:52Z. --- Reviewed and tested at `750ffb25`. Clean, minimal change (`COMPUTE_BLOBS_MAX`: `512 -> 128 MiB`, `GRAPHICS_BLOBS_MAX`: `256 -> 64 MiB`) that trims up to 576 MiB of in-memory blob commit. Only minor question is whether any long-run measurement confirmed `128 / 64 MiB` doesn't increase disk re-reads for titles with large shader working sets (especially alongside #3332). ### Tested locally - Windows 11 (build 26300), NVIDIA GeForce RTX 4070 SUPER (driver `32.0.16.2140`), AMD Ryzen 7 7800X3D, `rustc 1.100.0`. - `cargo test -p xcl --lib hle::d3d12x::real::driver_cache:: -- --test-threads=1`: **19 passed, 0 failed**. ### AI use - Antigravity (Gemini 4 Neon) assisted with code review and drafting; all builds and tests were executed locally on the hardware above.
KOLESNiii commented 2026-11-29 22:39:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T22:39:32Z.

Review: COMMENTED


Static review of 750ffb25 for the stack in the #3041 comparison.

I found no actionable issue in the tested in-memory blob-limit changes. The disk and compile fallbacks remain reachable.

Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.

<!-- greyfinch-sync:ivall/xcl:review:6105175717 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3328#pullrequestreview-6105175717). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T22:39:32Z. **Review:** COMMENTED --- Static review of `750ffb25` for the stack in the [#3041 comparison](https://github.com/xcl-dev/xcl/issues/3041#issuecomment-7263214809). I found no actionable issue in the tested in-memory blob-limit changes. The disk and compile fallbacks remain reachable. Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.
bmjask commented 2026-11-29 22:43:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:43:28Z.

Review: COMMENTED


Critical review of current head 750ffb25. I found no correctness blocker in the two constant changes: the memory store admits fewer blobs while disk persistence and driver recompilation remain available. The real tradeoff is repeated build latency, especially where disk persistence is disabled (including AMD's default). Before enabling this broadly, please compare repeated world entries on NVIDIA and AMD with blob hit/miss counts, driver-build milliseconds, and peak commit; a reduction of the cap alone cannot establish a net performance win. No local Windows run; this is a nonblocking measurement request.

<!-- greyfinch-sync:ivall/xcl:review:6105190920 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3328#pullrequestreview-6105190920). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T22:43:28Z. **Review:** COMMENTED --- Critical review of current head `750ffb25`. I found no correctness blocker in the two constant changes: the memory store admits fewer blobs while disk persistence and driver recompilation remain available. The real tradeoff is repeated build latency, especially where disk persistence is disabled (including AMD's default). Before enabling this broadly, please compare repeated world entries on NVIDIA and AMD with blob hit/miss counts, driver-build milliseconds, and peak commit; a reduction of the cap alone cannot establish a net performance win. No local Windows run; this is a nonblocking measurement request.
KOLESNiii commented 2026-11-29 22:54:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T22:54:47Z.


Test run data for the static review

  • On this PC, the prior cargo build --release -p xcl build 4465c886 included this PR in the Prime1997 stack. One warm-cache retail run (XCL_PREPARE_ALL=1, XCL_RUN_SECONDS=180) reached the first present in 12,326 s and showed 5,104 frames in the subsequent 180 s, with zero failed or fallback pipelines and no crash. This is combined-build coverage. It cannot isolate this PR's effect. Run report and comparison
  • For exact head 750ffb25, saintwolf reports 19 passed, 0 failed for cargo test -p xcl --lib hle::d3d12x::real::driver_cache:: -- --test-threads=1. Independent focused run
  • Fresh local cargo build --workspace passed on trial merge 6044873e, applying the reviewed head to main at 5b0d5fa3. These runs do not measure the effect of the smaller limits on disk rereads. The test binaries built with cargo test --workspace --no-fail-fast --no-run and the GPU suite is queued.

Local system used for these runs was an RTX 2070 SUPER 8 GB (621.40, wave32), Ryzen 5 3600XT, 32 GB RAM, Windows 11 build 26300, and rustc 1.100.1. Claude Code (Claude Opus 5.5) ran the earlier tests. Codex (GPT-6, exact variant unavailable) checked the artifacts and ran the new build.

<!-- greyfinch-sync:ivall/xcl:comment:7264046905 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3328#issuecomment-7264046905). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T22:54:47Z. --- **Test run data for the [static review](https://github.com/xcl-dev/xcl/pull/3328#pullrequestreview-6105175717)** - On this PC, the prior `cargo build --release -p xcl` build `4465c886` included this PR in the Prime1997 stack. One warm-cache retail run (`XCL_PREPARE_ALL=1`, `XCL_RUN_SECONDS=180`) reached the first present in 12,326 s and showed 5,104 frames in the subsequent 180 s, with zero failed or fallback pipelines and no crash. This is combined-build coverage. It cannot isolate this PR's effect. [Run report and comparison](https://github.com/xcl-dev/xcl/issues/3041#issuecomment-7263214809) - For exact head `750ffb25`, saintwolf reports **19 passed, 0 failed** for `cargo test -p xcl --lib hle::d3d12x::real::driver_cache:: -- --test-threads=1`. [Independent focused run](https://github.com/xcl-dev/xcl/pull/3328#issuecomment-7256808362) - Fresh local `cargo build --workspace` passed on trial merge `6044873e`, applying the reviewed head to `main` at `5b0d5fa3`. These runs do not measure the effect of the smaller limits on disk rereads. The test binaries built with `cargo test --workspace --no-fail-fast --no-run` and the GPU suite is queued. Local system used for these runs was an RTX 2070 SUPER 8 GB (621.40, wave32), Ryzen 5 3600XT, 32 GB RAM, Windows 11 build 26300, and rustc 1.100.1. Claude Code (Claude Opus 5.5) ran the earlier tests. Codex (GPT-6, exact variant unavailable) checked the artifacts and ran the new build.
Foniass commented 2026-12-01 03:58:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:58:37Z.


Review (head 750ffb25, diff read, not a merge-check; draft, so not built or run):

  • The saving isn't measured for this change. The 225 s out-of-memory figure is from another branch, and the PR's smoke peak commit (15379 vs 15272 MB) never fills the store.
  • What it costs isn't measured either. The store admits first-come with no eviction, and warm runs fill it from disk loads too. Once it's full, a re-created pipeline comes from disk only if its build was slow enough to have been saved (20 ms compute / 50 ms graphics); otherwise it goes back to the driver, and on AMD, where the disk cache is off by default, it always does. Hit and recompile counts in a world, before and after, would show whether 128 / 64 MiB is right.
  • It interacts with #3330 (same author): this moves reuse onto the disk files, which #3330 removes when a cap is set. AI use should name the model.

Fine: the description of keep_driver_blob_at is accurate (the disk save doesn't depend on room in memory), and the change is just the two constants.

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

<!-- greyfinch-sync:ivall/xcl:comment:7300251735 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3328#issuecomment-7300251735). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:58:37Z. --- Review (head 750ffb25, diff read, not a merge-check; draft, so not built or run): - **The saving isn't measured for this change.** The 225 s out-of-memory figure is from another branch, and the PR's smoke peak commit (15379 vs 15272 MB) never fills the store. - **What it costs isn't measured either.** The store admits first-come with no eviction, and warm runs fill it from disk loads too. Once it's full, a re-created pipeline comes from disk only if its build was slow enough to have been saved (20 ms compute / 50 ms graphics); otherwise it goes back to the driver, and on AMD, where the disk cache is off by default, it always does. Hit and recompile counts in a world, before and after, would show whether 128 / 64 MiB is right. - It interacts with #3330 (same author): this moves reuse onto the disk files, which #3330 removes when a cap is set. AI use should name the model. Fine: the description of `keep_driver_blob_at` is accurate (the disk save doesn't depend on room in memory), and the change is just the two constants. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 16:16:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T16:16:56Z.


Test report (not a merge-check: draft)
base: b2b1f109d2
head: 750ffb255c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2902 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3328#issuecomment-7300251735, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main.
performance: no smoke run.
assessment: merges, builds and passes the whole suite on current main (0 failed); the findings in my review stand
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7317342026 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3328#issuecomment-7317342026). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T16:16:56Z. --- Test report (not a merge-check: draft) base: b2b1f109d27e746a62ec95b04dd1f9924452e682 head: 750ffb255c5dd67fdac56c1b114daffa7f1ebb90 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2902 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3328#issuecomment-7300251735, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main. performance: no smoke run. assessment: merges, builds and passes the whole suite on current main (0 failed); the findings in my review stand hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
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/3328:upstream-pr/3328'
git switch 'upstream-pr/3328'

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/3328'
git switch 'upstream-pr/3328'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3328'
git switch 'upstream-pr/3328'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3328'
git switch 'main'
git merge --squash 'upstream-pr/3328'
git switch 'main'
git merge --ff-only 'upstream-pr/3328'
git switch 'main'
git merge 'upstream-pr/3328'
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!3328
No description provided.