DirectStorage: use SIMD for zlib checksums #661

Manually merged
github merged 1 commit from gh-pr/661/head into gh-pr/661/base 2026-11-26 04:28:45 +00:00
Owner

@⁠CallMeBrado on GitHub · 2026-11-24 03:02 UTC · original
CallMeBrado:perf/directstorage-zlib-checksum → main · +8 −1 · 2 files · 1 commits · merged 2026-11-25 01:08 UTC

The retail title issues thousands of 64 KiB zlib reads during startup. DirectStorage already verifies the Adler-32 checksum on each inflated block. This enables the SIMD checksum implementation in the same version of miniz_oxide.

What is in it

  • One Cargo feature and its lockfile entry. simd-adler32 0.3.10 is MIT licensed. The decompressor, output limits and checksum validation stay the same.

Tested

  • Ryzen 9 9950X3D, RTX 5090 (621.24), Windows 11 Pro build 26200, Rust 1.96.0. Release for timing and the game, debug for the workspace suite.
  • Timed the same decompress_to_vec_zlib_with_limit call that DirectStorage uses. Median of 10 runs per build, alternating order, with input in memory and 48 passes per run. On 236 distinct 64 KiB blocks from eight retail title archives, the default took 1,036.5 ms and SIMD took 976.9 ms (5.7% less time). On 128 synthetic blocks, it was 191.3 ms and 147.2 ms.
  • For both corpora, both builds produced byte-for-byte identical output to Python zlib, and both rejected a stream with a corrupted checksum.
  • cargo build --locked --workspace passed. cargo test --locked --workspace -- --test-threads=4 reported 690 passed, 0 failed, 41 ignored. Two GPU tests skipped internally for lack of wave64 (gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware).
Synthetic workload for reproducing the timing

Generate the inputs once with Python 3. Use miniz_oxide 0.9.1 in a release build. Time 48 passes over the 128 streams with the default features, then with features = ["simd"]. Warm each build first and keep file I/O outside the timed loop.

import random, zlib
rng = random.Random(642)
streams = []
for i in range(128):
    n = (2048, 8192, 16384, 32768)[i % 4]
    streams.append(zlib.compress(rng.randbytes(n) * (65536 // n), 6))
for _ in 0..48 {
    for stream in &streams {
        let bytes = decompress_to_vec_zlib_with_limit(std::hint::black_box(stream), 65536).unwrap();
        assert_eq!(bytes.len(), 65536);
        std::hint::black_box(bytes);
    }
}

Regression run

Main

xcl-smoke v1
commit: dd2ae9a70af5eb5aad60f02d86e386b72abe1e95
gpu: NVIDIA GeForce RTX 5090
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 821 (PresentX 821)
presents per 2 s (last 3): 49 44 47
device removals: 0
crashes: 0
peak commit: 15624 MB

PR

xcl-smoke v1
commit: 1347bea78e232e5d1ffce11b77e0c3e875ac242d
gpu: NVIDIA GeForce RTX 5090
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 918 (PresentX 918)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15587 MB

Not tested

  • Other CPUs or GPUs. The game runs cover 60 seconds of startup. We did not measure time to gameplay or sustained FPS.

AI use

  • Codex (GPT-6.2 Astra) traced the DirectStorage calls, changed the Cargo feature, ran the benchmarks and game tests, and drafted this description.
**@⁠CallMeBrado** on GitHub · 2026-11-24 03:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/661) `CallMeBrado:perf/directstorage-zlib-checksum` → `main` · +8 −1 · 2 files · 1 commits · merged 2026-11-25 01:08 UTC The retail title issues thousands of 64 KiB zlib reads during startup. DirectStorage already verifies the Adler-32 checksum on each inflated block. This enables the SIMD checksum implementation in the same version of `miniz_oxide`. **What is in it** - One Cargo feature and its lockfile entry. `simd-adler32` 0.3.10 is MIT licensed. The decompressor, output limits and checksum validation stay the same. **Tested** - Ryzen 9 9950X3D, RTX 5090 (621.24), Windows 11 Pro build 26200, Rust 1.96.0. Release for timing and the game, debug for the workspace suite. - Timed the same `decompress_to_vec_zlib_with_limit` call that DirectStorage uses. Median of 10 runs per build, alternating order, with input in memory and 48 passes per run. On 236 distinct 64 KiB blocks from eight retail title archives, the default took 1,036.5 ms and SIMD took 976.9 ms (5.7% less time). On 128 synthetic blocks, it was 191.3 ms and 147.2 ms. - For both corpora, both builds produced byte-for-byte identical output to Python zlib, and both rejected a stream with a corrupted checksum. - `cargo build --locked --workspace` passed. `cargo test --locked --workspace -- --test-threads=4` reported 690 passed, 0 failed, 41 ignored. Two GPU tests skipped internally for lack of wave64 (`gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware`). <details><summary>Synthetic workload for reproducing the timing</summary> Generate the inputs once with Python 3. Use `miniz_oxide` 0.9.1 in a release build. Time 48 passes over the 128 streams with the default features, then with `features = ["simd"]`. Warm each build first and keep file I/O outside the timed loop. ```python import random, zlib rng = random.Random(642) streams = [] for i in range(128): n = (2048, 8192, 16384, 32768)[i % 4] streams.append(zlib.compress(rng.randbytes(n) * (65536 // n), 6)) ``` ```rust for _ in 0..48 { for stream in &streams { let bytes = decompress_to_vec_zlib_with_limit(std::hint::black_box(stream), 65536).unwrap(); assert_eq!(bytes.len(), 65536); std::hint::black_box(bytes); } } ``` </details> **Regression run** Main ``` xcl-smoke v1 commit: dd2ae9a70af5eb5aad60f02d86e386b72abe1e95 gpu: NVIDIA GeForce RTX 5090 title: 419239bf seconds: 60 exit: 0x0 frames shown: 821 (PresentX 821) presents per 2 s (last 3): 49 44 47 device removals: 0 crashes: 0 peak commit: 15624 MB ``` PR ``` xcl-smoke v1 commit: 1347bea78e232e5d1ffce11b77e0c3e875ac242d gpu: NVIDIA GeForce RTX 5090 title: 419239bf seconds: 60 exit: 0x0 frames shown: 918 (PresentX 918) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15587 MB ``` **Not tested** - Other CPUs or GPUs. The game runs cover 60 seconds of startup. We did not measure time to gameplay or sustained FPS. **AI use** - Codex (GPT-6.2 Astra) traced the DirectStorage calls, changed the Cargo feature, ran the benchmarks and game tests, and drafted this description.
A retail title streams thousands of 64 KiB zlib blocks during startup. Enable the existing checksum backend to validate them using SIMD on supported CPUs.

Assisted-by: Codex (GPT-6.2 Astra)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:28:44 +00:00
github manually merged commit 1347bea78e into gh-pr/661/base 2026-11-26 04:28:45 +00:00
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-24 03:54 UTC · original

License check + NVIDIA RTX 5080 test run on 1347bea78e232e5d1ffce11b77e0c3e875ac242d:

Review

Looks clean:

  • Enabling miniz_oxide's simd feature pulls in simd-adler32 0.3.10, which is MIT-licensed (compatible with XCL's GPL-2.0-only licence per CONTRIBUTING.md).
  • Diff is minimal (Cargo.toml + Cargo.lock only).

Tested

  • Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), rustc 1.100.0 (MSVC), debug build.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 690 passed, 0 failed, 41 ignored (all DirectStorage zlib tests passed).
  • SKIPPED GPU tests (2, wave32-only adapter): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64.

Not tested

  • Retail title / scripts/smoke.ps1 run (test suite only).
  • AMD / Intel GPUs.

AI use: licence verification and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.

**@⁠mastrr9** on GitHub · 2026-11-24 03:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/661#issuecomment-7121532616) License check + NVIDIA RTX 5080 test run on `1347bea78e232e5d1ffce11b77e0c3e875ac242d`: ### Review Looks clean: - Enabling `miniz_oxide`'s `simd` feature pulls in `simd-adler32 0.3.10`, which is **MIT**-licensed (compatible with XCL's `GPL-2.0-only` licence per `CONTRIBUTING.md`). - Diff is minimal (`Cargo.toml` + `Cargo.lock` only). ### Tested - Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), `rustc 1.100.0` (MSVC), debug build. - `cargo build --workspace && cargo test --workspace -- --test-threads=4`: **690 passed, 0 failed, 41 ignored** (all DirectStorage zlib tests passed). - `SKIPPED` GPU tests (2, wave32-only adapter): `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64`. ### Not tested - Retail title / `scripts/smoke.ps1` run (test suite only). - AMD / Intel GPUs. *AI use: licence verification and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.*
Author
Owner

@⁠relativespace2K on GitHub · 2026-11-24 04:06 UTC · original

Tested — native Windows, AMD CPU / RDNA2

  • Exact PR head 1347bea78e232e5d1ffce11b77e0c3e875ac242d, based on dd2ae9a.
  • AMD Ryzen 5 5600 (Zen 3, AVX2) + Radeon RX 6800 XT; 31.9 GB; Windows 11 IoT
    Enterprise LTSC 26100; Rust 1.100.0 MSVC; DXC 1.9.2602.17; debug; no XCL_SAMPLE_*.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:
    687 passed, 3 failed, 41 ignored, 0 SKIPPED — the same counts as the base dd2ae9a
    (feature/lockfile only, no new tests). The three failures are the known RDNA2 ones:
    the packed-mip 3D 64x64x64 4 mips: subresource 2 mismatch (#470) and the two
    PoisonError follow-ons (#673).
  • cargo test -p xcl --lib hle::dstorage: 13 passed, 0 failed, 0 ignored.
  • cargo tree -e features -i simd-adler32 confirms simd-adler32 v0.3.10 is enabled
    through miniz_oxide feature "simd" on xcl.

Not tested: the 5.7 % timing claim (no retail archive or benchmark here), release
build, Intel.

AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report.

**@⁠relativespace2K** on GitHub · 2026-11-24 04:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/661#issuecomment-7121720660) **Tested** — native Windows, AMD CPU / RDNA2 - Exact PR head `1347bea78e232e5d1ffce11b77e0c3e875ac242d`, based on `dd2ae9a`. - AMD Ryzen 5 5600 (Zen 3, AVX2) + Radeon RX 6800 XT; 31.9 GB; Windows 11 IoT Enterprise LTSC 26100; Rust 1.100.0 MSVC; DXC 1.9.2602.17; debug; no `XCL_SAMPLE_*`. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: **687 passed, 3 failed, 41 ignored, 0 SKIPPED** — the same counts as the base `dd2ae9a` (feature/lockfile only, no new tests). The three failures are the known RDNA2 ones: the packed-mip `3D 64x64x64 4 mips: subresource 2 mismatch` (#470) and the two `PoisonError` follow-ons (#673). - `cargo test -p xcl --lib hle::dstorage`: 13 passed, 0 failed, 0 ignored. - `cargo tree -e features -i simd-adler32` confirms `simd-adler32 v0.3.10` is enabled through `miniz_oxide feature "simd"` on `xcl`. **Not tested**: the 5.7 % timing claim (no retail archive or benchmark here), release build, Intel. **AI use**: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report.
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 04:14 UTC · original

Test run of 1347bea78e232e5d1ffce11b77e0c3e875ac242d on AMD RDNA4. I merged it onto current main f4ce27c locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 701 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 660 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the dstorage tests pass with the SIMD checksum.

Review: One Cargo feature; simd-adler32 is MIT, which is GPL-2.0-compatible, and checksum validation stays where it was. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 04:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/661#issuecomment-7121841178) Test run of `1347bea78e232e5d1ffce11b77e0c3e875ac242d` on AMD RDNA4. I merged it onto current `main` `f4ce27c` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **701 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 660 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; the `dstorage` tests pass with the SIMD checksum. **Review:** One Cargo feature; `simd-adler32` is MIT, which is GPL-2.0-compatible, and checksum validation stays where it was. I found nothing to change. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
This discussion has been locked. Commenting is limited to contributors.
No description provided.