DirectStorage: XCL_DSTORAGE_IO_CONCURRENCY caps concurrent disk reads for HDDs #908

Open
github-bot wants to merge 2 commits from github-bot/gh-908 into main AGit
Owner

@⁠auswhalen999-debug on GitHub · 2026-11-24 08:02 UTC · original
auswhalen999-debug:dstorage-hdd-io-concurrency → main · +141 −4 · 2 files · 2 commits · open

Console titles can drive 16+ concurrent DirectStorage file queues at once. On mechanical HDDs, issuing that many simultaneous seek_read calls thrashes the read heads and stalls asset streaming.

This adds an opt-in XCL_DSTORAGE_IO_CONCURRENCY=N setting (e.g. 2 for mechanical HDDs, clamped to 1..=64). When unset or 0 (the default), disk reads remain uncapped so SSD/NVMe users see no behavior change. The semaphore gates only read_exact_at disk reads while keeping CPU zlib decompression and destination copies parallel across all queues.

What is in it

  • crates/xcl/src/hle/dstorage.rs: add parse_io_concurrency, IoLimiter / RAII IoPermit (Mutex<usize> + Condvar initialized once via OnceLock), and gate read_exact_at disk reads (with an early return for empty reads and checked_add offset check).
  • crates/xcl/src/hle/dstorage.rs (mod tests): add unit tests covering env-var parsing/clamping, bounded concurrency (limits 1 and 2) with unwind-safe permit release, and the uncapped default when unset.
  • README.md: document XCL_DSTORAGE_IO_CONCURRENCY.

Tested

  • Windows, AMD Ryzen 5 3500X, NVIDIA GeForce GTX 1070 (driver 32.0.15.8180), Rust 1.100.0 (0ef1bc386 2026-11-09), debug build:
  • cargo test -p xcl --lib dstorage: 16 passed, 0 failed, 0 ignored (0 warnings in crates/xcl/src/hle/dstorage.rs).
  • Earlier local boot test on a 5400 RPM Toshiba HDD showed ~20 s faster boot streaming with XCL_DSTORAGE_IO_CONCURRENCY=2 compared to uncapped concurrent queue reads.

Regression run
Pending: paired scripts/smoke.ps1 runs on clean builds of main and commit dc2143cc2614 are not yet attached.

Not tested

  • Full cargo test --workspace run and paired scripts/smoke.ps1 runs on this commit (dc2143cc2614).
  • Non-Windows / Wine environments.

AI use

  • Antigravity (Gemini 3.1 Pro): extracted the change onto a clean branch from origin/main, added the unit tests and README note, ran cargo test -p xcl --lib dstorage, and drafted the PR description.
**@⁠auswhalen999-debug** on GitHub · 2026-11-24 08:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/908) `auswhalen999-debug:dstorage-hdd-io-concurrency` → `main` · +141 −4 · 2 files · 2 commits · open Console titles can drive 16+ concurrent DirectStorage file queues at once. On mechanical HDDs, issuing that many simultaneous `seek_read` calls thrashes the read heads and stalls asset streaming. This adds an opt-in `XCL_DSTORAGE_IO_CONCURRENCY=N` setting (e.g. `2` for mechanical HDDs, clamped to `1..=64`). When unset or `0` (the default), disk reads remain uncapped so SSD/NVMe users see no behavior change. The semaphore gates only `read_exact_at` disk reads while keeping CPU zlib decompression and destination copies parallel across all queues. **What is in it** - `crates/xcl/src/hle/dstorage.rs`: add `parse_io_concurrency`, `IoLimiter` / RAII `IoPermit` (`Mutex<usize>` + `Condvar` initialized once via `OnceLock`), and gate `read_exact_at` disk reads (with an early return for empty reads and `checked_add` offset check). - `crates/xcl/src/hle/dstorage.rs` (`mod tests`): add unit tests covering env-var parsing/clamping, bounded concurrency (limits 1 and 2) with unwind-safe permit release, and the uncapped default when unset. - `README.md`: document `XCL_DSTORAGE_IO_CONCURRENCY`. **Tested** - Windows, AMD Ryzen 5 3500X, NVIDIA GeForce GTX 1070 (driver 32.0.15.8180), Rust 1.100.0 (0ef1bc386 2026-11-09), debug build: - `cargo test -p xcl --lib dstorage`: 16 passed, 0 failed, 0 ignored (0 warnings in `crates/xcl/src/hle/dstorage.rs`). - Earlier local boot test on a 5400 RPM Toshiba HDD showed ~20 s faster boot streaming with `XCL_DSTORAGE_IO_CONCURRENCY=2` compared to uncapped concurrent queue reads. **Regression run** Pending: paired `scripts/smoke.ps1` runs on clean builds of `main` and commit `dc2143cc2614` are not yet attached. **Not tested** - Full `cargo test --workspace` run and paired `scripts/smoke.ps1` runs on this commit (`dc2143cc2614`). - Non-Windows / Wine environments. **AI use** - Antigravity (Gemini 3.1 Pro): extracted the change onto a clean branch from `origin/main`, added the unit tests and README note, ran `cargo test -p xcl --lib dstorage`, and drafted the PR description.
Console titles can drive 16+ concurrent DirectStorage file queues at once. On mechanical HDDs, issuing that many simultaneous seek_read calls causes heavy head thrashing.

Add an opt-in XCL_DSTORAGE_IO_CONCURRENCY=N setting (clamped to 1..=64; unset or 0 leaves reads uncapped so SSD/NVMe behavior is unchanged). The semaphore gates only read_exact_at disk reads while keeping CPU zlib decompression and destination copies parallel across all queues.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:36:35 +00:00
Author
Owner

@⁠eizispark on GitHub · 2026-11-24 08:16 UTC · original

Hardware check of dc2143cc2614ce6f6e84dc6f14b6220b8956c5b3 (verified clean merge with main 09940bb): pass.

Tested

  • Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace -- --test-threads=4: 715 passed, 3 failed, 41 ignored (GPU tests skipped on this adapter: none); placed_title_textures_share_vram_and_preserve_pixels flaked under 4-thread shared-singleton contention (poisoning transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory), and cargo test -p xcl --lib hle::d3d12x -- --test-threads=1 passed (114 passed, 0 failed, 1 ignored)
  • hle::dstorage::tests (16 passed, 0 failed), including io_concurrency_parsing_defaults_to_uncapped_and_clamps_positive_values, io_limiter_caps_concurrent_holders_and_releases_on_drop, and io_limiter_is_uncapped_when_env_unset

Regression run
main (beaa245):

xcl-smoke v1
commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1660 (PresentX 1660)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14862 MB

PR (dc2143c):

xcl-smoke v1
commit: dc2143cc2614ce6f6e84dc6f14b6220b8956c5b3
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1660 (PresentX 1661)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14863 MB

Not tested

  • wave32-only GPUs (NVIDIA / Intel); mechanical HDD streaming with XCL_DSTORAGE_IO_CONCURRENCY=2 (smoke ran on SSD with default unset concurrency); gameplay past the menus

AI use

  • Antigravity (Gemini 4 Carbon) ran the build, test suite, and scripts/smoke.ps1 harness on this machine and formatted this report.
**@⁠eizispark** on GitHub · 2026-11-24 08:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/908#issuecomment-7125944673) Hardware check of `dc2143cc2614ce6f6e84dc6f14b6220b8956c5b3` (verified clean merge with `main` `09940bb`): **pass**. **Tested** - Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, release + test profile - `cargo test --workspace -- --test-threads=4`: `715 passed, 3 failed, 41 ignored` (GPU tests skipped on this adapter: `none`); `placed_title_textures_share_vram_and_preserve_pixels` flaked under 4-thread shared-singleton contention (poisoning `transitions_apply_when_their_list_is_submitted` and `d32s8_targets_take_their_own_size_of_video_memory`), and `cargo test -p xcl --lib hle::d3d12x -- --test-threads=1` passed (`114 passed, 0 failed, 1 ignored`) - `hle::dstorage::tests` (`16 passed, 0 failed`), including `io_concurrency_parsing_defaults_to_uncapped_and_clamps_positive_values`, `io_limiter_caps_concurrent_holders_and_releases_on_drop`, and `io_limiter_is_uncapped_when_env_unset` **Regression run** `main` (`beaa245`): ``` xcl-smoke v1 commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1660 (PresentX 1660) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14862 MB ``` PR (`dc2143c`): ``` xcl-smoke v1 commit: dc2143cc2614ce6f6e84dc6f14b6220b8956c5b3 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1660 (PresentX 1661) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14863 MB ``` **Not tested** - wave32-only GPUs (NVIDIA / Intel); mechanical HDD streaming with `XCL_DSTORAGE_IO_CONCURRENCY=2` (smoke ran on SSD with default unset concurrency); gameplay past the menus **AI use** - Antigravity (Gemini 4 Carbon) ran the build, test suite, and `scripts/smoke.ps1` harness on this machine and formatted this report.
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 08:27 UTC · original

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
716 passed; 0 failed; 41 ignored   (exit 0)

Three more passing tests than main: the DirectStorage IO-concurrency cap is covered and green here; nothing else changes verdict.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

**@⁠dcastell1** on GitHub · 2026-11-24 08:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/908#issuecomment-7126160737) Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean `main@beaa245` (713 passed, 0 failed, 41 ignored on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 716 passed; 0 failed; 41 ignored (exit 0) ``` Three more passing tests than main: the DirectStorage IO-concurrency cap is covered and green here; nothing else changes verdict. Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 09:34 UTC · original

Linux / AMD RDNA3 datapoint.

Merged state: head dc2143c onto main 09940bb, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 712 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. DirectStorage IO-concurrency cap green.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

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

**@⁠SlopTart** on GitHub · 2026-11-24 09:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/908#issuecomment-7127604624) Linux / AMD RDNA3 datapoint. **Merged state:** head `dc2143c` onto main `09940bb`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **712 passed, 7 failed, 41 ignored**; failures are the known Wine-lane set from my #42 rows. DirectStorage IO-concurrency cap green. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 03:09 UTC · original

Regression run of 85c92109 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 85c92109e467431029954641ebc20f269237e921
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1633)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14686 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 99 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

**@⁠Toons29** on GitHub · 2026-11-25 03:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/908#issuecomment-7151639720) Regression run of `85c92109` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 85c92109e467431029954641ebc20f269237e921 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1633 (PresentX 1633) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14686 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 99 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 09:31 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main (README.md, crates/xcl/src/hle/dstorage.rs) — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-25 09:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/908#issuecomment-7158439953) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** (`README.md`, `crates/xcl/src/hle/dstorage.rs`) — needs a rebase before it can be tested.
This pull request has changes conflicting with the target branch.
  • README.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/908/head:github-bot/gh-908'
git switch 'github-bot/gh-908'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-908'
git switch 'github-bot/gh-908'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-908'
git switch 'github-bot/gh-908'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-908'
git switch 'main'
git merge --squash 'github-bot/gh-908'
git switch 'main'
git merge --ff-only 'github-bot/gh-908'
git switch 'main'
git merge 'github-bot/gh-908'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.