DirectStorage: decompress file-backed zlib requests in parallel by default #3325

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

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


Requested by Prime

The bounded decode pool (1495e6df) has been opt-in since it landed, so by default each queue thread still reads and inflates its requests one at a time while the other cores sit idle as a title streams its world. The pool keeps retirement in queue order, a 32 MiB staging budget and four workers, and takes only file-backed zlib requests with virtual destinations, so the change is the default: XCL_DSTORAGE_PARALLEL_DECOMPRESS=0 (or false) goes back to the queue thread.

BCPack and physical-page destinations stay on the queue thread: moving them into the pool is part of open PR #2004.

What is in it

  • crates/xcl/src/hle/dstorage/parallel.rs: the pool is on unless XCL_DSTORAGE_PARALLEL_DECOMPRESS is 0 or false
  • crates/xcl/src/hle/dstorage/parallel_tests.rs: parallel_decompression_is_on_unless_turned_off
  • README.md: the switch is described as on by default

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 e78fe5d2cc: 2606 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): 2467 passed, 0 failed; 2467 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: e78fe5d2ccde02bc287eb3407a8798d2714cab91
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1470 (PresentX 1470)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15427 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
  • Streaming speed in a retail world was not measured for this change alone (the 60 s smoke covers the title's start-up reads only).

AI use

  • Claude Code wrote the change and its test, 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:5548973822 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3325). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-29T08:22:21Z. --- <!-- claude-projects-attribution: {"github_login":"Prime1997"} --> _Requested by **Prime**_ The bounded decode pool (1495e6df) has been opt-in since it landed, so by default each queue thread still reads and inflates its requests one at a time while the other cores sit idle as a title streams its world. The pool keeps retirement in queue order, a 32 MiB staging budget and four workers, and takes only file-backed zlib requests with virtual destinations, so the change is the default: `XCL_DSTORAGE_PARALLEL_DECOMPRESS=0` (or `false`) goes back to the queue thread. BCPack and physical-page destinations stay on the queue thread: moving them into the pool is part of open PR #2004. **What is in it** - `crates/xcl/src/hle/dstorage/parallel.rs`: the pool is on unless `XCL_DSTORAGE_PARALLEL_DECOMPRESS` is `0` or `false` - `crates/xcl/src/hle/dstorage/parallel_tests.rs`: `parallel_decompression_is_on_unless_turned_off` - `README.md`: the switch is described as on by default **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 e78fe5d2ccde: 2606 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): 2467 passed, 0 failed; 2467 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: e78fe5d2ccde02bc287eb3407a8798d2714cab91 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 1470 (PresentX 1470) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 15427 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 - Streaming speed in a retail world was not measured for this change alone (the 60 s smoke covers the title's start-up reads only). **AI use** - Claude Code wrote the change and its test, 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:53 +00:00 (Migrated from github.com)

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


Reviewed and tested at e78fe5d2.

Looks clean and minimal. One small nit: parallel_enabled does not .trim() XCL_DSTORAGE_PARALLEL_DECOMPRESS (value == "0"), unlike the other env-var parsers (#3377, #3336, #3330), so " 0 " wouldn't disable it.

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::dstorage:: -- --test-threads=1: 39 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:7256808623 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3325#issuecomment-7256808623). Originally posted by [saintwolf](https://github.com/saintwolf) on 2026-11-29T13:47:53Z. --- Reviewed and tested at `e78fe5d2`. Looks clean and minimal. One small nit: `parallel_enabled` does not `.trim()` `XCL_DSTORAGE_PARALLEL_DECOMPRESS` (`value == "0"`), unlike the other env-var parsers (`#3377`, `#3336`, `#3330`), so `" 0 "` wouldn't disable it. ### 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::dstorage:: -- --test-threads=1`: **39 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:30 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Static review of e78fe5d2 for the stack in the #3041 comparison.

The default pool path bypasses scratch reuse for fallback file requests in the measured build. Ineligible requests, including small raw reads, pass None for the input scratch buffer. The former default queue path used a reusable buffer. Carrying that scratch through the pool's sequential fallback would preserve reuse. Measured fallback ?? Sequential queue

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

<!-- greyfinch-sync:ivall/xcl:review:6105175646 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3325#pullrequestreview-6105175646). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T22:39:30Z. **Review:** COMMENTED --- Static review of `e78fe5d2` for the stack in the [#3041 comparison](https://github.com/xcl-dev/xcl/issues/3041#issuecomment-7263214809). **The default pool path bypasses scratch reuse for fallback file requests in the measured build.** Ineligible requests, including small raw reads, pass `None` for the input scratch buffer. The former default queue path used a reusable buffer. Carrying that scratch through the pool's sequential fallback would preserve reuse. [Measured fallback](https://github.com/xcl-dev/xcl/blob/06f5d40a/crates/xcl/src/hle/dstorage/parallel.rs#L525-L534) ?? [Sequential queue](https://github.com/xcl-dev/xcl/blob/06f5d40a/crates/xcl/src/hle/dstorage.rs#L1247-L1257) 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:29 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Critical review of current head e78fe5d2. The default flip itself is narrow, but it makes the pool's serial fallback part of every ordinary run. As noted in the prior review, ineligible file requests can lose the queue's reusable scratch buffer and allocate per request when the pool exists. Please carry scratch reuse into the fallback and compare allocation rate and streaming stalls with 0 versus default. parallel_enabled also does not trim the environment string, so " 0 " silently enables the pool; that is minor but easy to fix. No local Windows run.

<!-- greyfinch-sync:ivall/xcl:review:6105190994 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3325#pullrequestreview-6105190994). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T22:43:29Z. **Review:** COMMENTED --- Critical review of current head `e78fe5d2`. The default flip itself is narrow, but it makes the pool's serial fallback part of every ordinary run. As noted in the [prior review](https://github.com/xcl-dev/xcl/pull/3325), ineligible file requests can lose the queue's reusable scratch buffer and allocate per request when the pool exists. Please carry scratch reuse into the fallback and compare allocation rate and streaming stalls with `0` versus default. `parallel_enabled` also does not trim the environment string, so `" 0 "` silently enables the pool; that is minor but easy to fix. No local Windows run.
Foniass commented 2026-12-01 03:58:41 +00:00 (Migrated from github.com)

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


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

  • #3364's problems would ship on by default. On main the queue thread reads with the title's handle (parallel.rs ~440) and the workers only inflate, so this PR alone doesn't expose them. But if #3364 (workers reopen the file by path and keep handles, see the review there) merges after this, they land in the default path; better fixed first.
  • The 32 MiB budget is now shared by every queue. A queue with nothing in flight blocks in wait_for_capacity (~402) behind another queue's staged work, so a high-priority queue can wait on a bulk one.
  • Not measured: no streaming numbers, nothing shows the smoke reached the pool, and each request now pays for two zeroed allocations plus an NtWriteVirtualMemory copy.
  • Requests are read ahead and cancellation isn't checked again after start (~427), so a cancel catches fewer requests than the sequential path. Nit: parallel_enabled doesn't trim spaces like the other switches. AI use should name the model.

Fine: requests retire in queue order with a drain before status, signal and event entries, zlib length and checksum errors match the sequential path, a worker panic becomes E_ABORT, and a failed pool start or oversized request falls back to the sequential path.

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

<!-- greyfinch-sync:ivall/xcl:comment:7300252872 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3325#issuecomment-7300252872). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:58:41Z. --- Review (head e78fe5d2, diff read, not a merge-check; draft, so not built or run): - **#3364's problems would ship on by default.** On main the queue thread reads with the title's handle (`parallel.rs` ~440) and the workers only inflate, so this PR alone doesn't expose them. But if #3364 (workers reopen the file by path and keep handles, see the review there) merges after this, they land in the default path; better fixed first. - **The 32 MiB budget is now shared by every queue.** A queue with nothing in flight blocks in `wait_for_capacity` (~402) behind another queue's staged work, so a high-priority queue can wait on a bulk one. - Not measured: no streaming numbers, nothing shows the smoke reached the pool, and each request now pays for two zeroed allocations plus an `NtWriteVirtualMemory` copy. - Requests are read ahead and cancellation isn't checked again after start (~427), so a cancel catches fewer requests than the sequential path. Nit: `parallel_enabled` doesn't trim spaces like the other switches. AI use should name the model. Fine: requests retire in queue order with a drain before status, signal and event entries, zlib length and checksum errors match the sequential path, a worker panic becomes E_ABORT, and a failed pool start or oversized request falls back to the sequential path. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 16:20:18 +00:00 (Migrated from github.com)

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


Test report (not a merge-check: draft)
base: b2b1f109d2
head: e78fe5d2cc
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 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/3325#issuecomment-7300252872, 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:7317435939 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3325#issuecomment-7317435939). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T16:20:18Z. --- Test report (not a merge-check: draft) base: b2b1f109d27e746a62ec95b04dd1f9924452e682 head: e78fe5d2ccde02bc287eb3407a8798d2714cab91 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 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/3325#issuecomment-7300252872, 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/3325:upstream-pr/3325'
git switch 'upstream-pr/3325'

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