Skip to content

[upstream #1078] DirectStorage: bound BCPack record scratch memory - #77

Closed
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1078
Closed

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1078

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 24, 2026

Copy link
Copy Markdown
Owner

BCPack now reconstructs tiles from batches of at most 64 records. The decoder used to keep all intermediate records until the input was consumed. The bounded buffer is 2 KiB on the stack and the existing reconstruction history stays on the heap.

What is in it

  • crates/xcl/src/hle/bcpack/victory.rs keeps lane read-ahead across batches, handles zero symbols directly, and retains the error precedence for malformed streams. Regression tests check exact bytes for all six widths, batch boundaries, and invalid input.

Tested

  • Ryzen 9 5900X, Radeon RX 6800 (driver 32.0.21045.29003), Windows 11 build 26300, Rust 1.100.0 MSVC.
  • The locked release workspace build succeeded. cargo test --release --locked --workspace --no-fail-fast -- --test-threads=4 --show-output reported 741 passed, 3 failed, and 41 ignored. All three new tests passed. Two tests reported GPU skips because the D3D12 debug layer was unavailable.
  • The clean main library test run reported 695 passed, 3 failed, and 21 ignored. The same three graphics tests failed in both runs. The 3D texture readback disagreed at subresource 2 and the other two tests encountered a poisoned lock.
  • The standalone release benchmark compared 64 KiB and 512 KiB synthetic outputs across BC1, BC3, BC4, BC5, BC6H, and BC7. Peak decoder heap scratch fell by 5.41–77.80×. For example, BC1 at 512 KiB used 796,672 B on main and 10,240 B on head. Median elapsed times ranged from 3% slower to 16% faster. Every output byte matched, as did 3,610 truncated and junk cases.
  • The 45-second RX 6800 smoke comparison showed 954 frames on main and 922 and 1027 on head. The selected runs exited cleanly with zero crashes and device removals.

Regression run

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 6800
title: retail-title-1.0.2.1
seconds: 45
exit: 0x0
frames shown: 954 (PresentX 954)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15118 MB
xcl-smoke v1
commit: 8cb6ba1a508a504a5fb23166db037f8d9ee32ed1
gpu: AMD Radeon RX 6800
title: retail-title-1.0.2.1
seconds: 45
exit: 0x0
frames shown: 1027 (PresentX 1028)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15124 MB

Not tested

Gameplay FPS, retail BCPack throughput, NVIDIA GPUs, and Wine.

AI use

Codex with GPT 6.2 Sol implemented the patch, added the tests, ran validation, and drafted this description.


Mirror of xcl-dev#1078 (auto-synced, do not edit).

Reconstruct blocks from fixed batches instead of staging every decoded record. Preserve lane state across batches and report the first lane error before block errors. Handle the frequent zero symbol directly to keep decode throughput.

Co-Authored-By: GPT 6.2 Sol <noreply@openai.com>
@ufoptg

ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Upstream PR xcl-dev#1078 was closed or merged.

@ufoptg ufoptg closed this Nov 25, 2026
@ufoptg
ufoptg deleted the upstream-pr/1078 branch November 25, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants