DirectStorage: the error record keeps the request's offset, size and tag #1223

Manually merged
github merged 1 commit from gh-pr/1223/head into gh-pr/1223/base 2026-11-26 04:47:38 +00:00
Owner

@⁠emirduran707 on GitHub · 2026-11-24 13:23 UTC · original
emirduran707:dstorage-error-record-fields → main · +56 −1 · 1 files · 1 commits · merged 2026-11-24 15:56 UTC

The record RetrieveErrorRecord returns for the first failed request left FileOffset (0x230), SourceSize (0x240) and CancellationTag (0x248) at zero. A title that uses the tag or the offset to find which of its requests failed got 0.

The layout comes from Microsoft's Win32 implementation of the console DirectStorage API in Xbox-GDK-Samples (Samples/System/SimpleDirectStorageCombo/DirectStorageWin32/, which uses the same interface IDs as XCL). Its dstorage_win32.h declares, after WCHAR Filename[MAX_PATH]: UINT64 FileOffset; void* Source; UINT32 SourceSize; UINT64 CancellationTag; CHAR Name[...]. Its MarkRequestError copies them from the failed request. XCL's existing offsets (0x10, 0x18, 0x20, 0x24, 0x238, record size 0x290) fit the same layout.

queue_retrieve_error_record now also writes the request's file offset (file requests only), source size and cancellation tag. The name (0x250) is not filled: XCL's request does not keep the name pointer.

What is in it

  • crates/xcl/src/hle/dstorage.rs: the three fields; test error_record_has_the_failed_requests_offset_source_size_and_tag (16 bytes at 0x100 of an 8-byte file, tag 0xABCD, on a file queue).

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on 2e17d3d: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests
  • the new test without the change: FileOffset left: 0, right: 256; with it cargo test -p xcl --lib dstorage passes (15 passed)

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1541 (PresentX 1541)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19650 MB

this PR:

xcl-smoke v1
commit: 2e17d3dedd954f4cd487296c1919e62708f77b39
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1559 (PresentX 1559)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19698 MB

Not tested

  • A title that reads these fields from a failure; the smoke title's run is a regression check only.
  • The layout on the console itself: it follows Microsoft's Win32 implementation of the console API, not a hardware run.
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code

**@⁠emirduran707** on GitHub · 2026-11-24 13:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/1223) `emirduran707:dstorage-error-record-fields` → `main` · +56 −1 · 1 files · 1 commits · merged 2026-11-24 15:56 UTC The record `RetrieveErrorRecord` returns for the first failed request left `FileOffset` (0x230), `SourceSize` (0x240) and `CancellationTag` (0x248) at zero. A title that uses the tag or the offset to find which of its requests failed got 0. The layout comes from Microsoft's Win32 implementation of the console DirectStorage API in Xbox-GDK-Samples (`Samples/System/SimpleDirectStorageCombo/DirectStorageWin32/`, which uses the same interface IDs as XCL). Its `dstorage_win32.h` declares, after `WCHAR Filename[MAX_PATH]`: `UINT64 FileOffset; void* Source; UINT32 SourceSize; UINT64 CancellationTag; CHAR Name[...]`. Its `MarkRequestError` copies them from the failed request. XCL's existing offsets (0x10, 0x18, 0x20, 0x24, 0x238, record size 0x290) fit the same layout. `queue_retrieve_error_record` now also writes the request's file offset (file requests only), source size and cancellation tag. The name (0x250) is not filled: XCL's request does not keep the name pointer. **What is in it** - `crates/xcl/src/hle/dstorage.rs`: the three fields; test `error_record_has_the_failed_requests_offset_source_size_and_tag` (16 bytes at 0x100 of an 8-byte file, tag 0xABCD, on a file queue). **Tested** - AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release - `cargo test --workspace -- --test-threads=4` on 2e17d3d: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests - the new test without the change: `FileOffset` `left: 0`, `right: 256`; with it `cargo test -p xcl --lib dstorage` passes (15 passed) **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1541 (PresentX 1541) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19650 MB ``` this PR: ``` xcl-smoke v1 commit: 2e17d3dedd954f4cd487296c1919e62708f77b39 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1559 (PresentX 1559) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19698 MB ``` **Not tested** - A title that reads these fields from a failure; the smoke title's run is a regression check only. - The layout on the console itself: it follows Microsoft's Win32 implementation of the console API, not a hardware run. - NVIDIA and Intel GPUs. **AI use** - Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
RetrieveErrorRecord filled the first failure's HRESULT, options,
destination, destination size and file name (or memory source), and left
FileOffset @0x230, SourceSize @0x240 and CancellationTag @0x248 at 0. A
title that logs or retries the failed request from its record saw offset
0, size 0 and tag 0.

The layout follows DSTORAGE_ERROR_RECORD in ATG's Win32 implementation
of the console API (Xbox-GDK-Samples, Samples/System/
SimpleDirectStorageCombo/DirectStorageWin32/dstorage_win32.h): after
`WCHAR Filename[MAX_PATH];` (0x24..0x22C) come `UINT64 FileOffset;`
(0x230), `void* Source;` (0x238), `UINT32 SourceSize;` (0x240),
`UINT64 CancellationTag;` (0x248) and `CHAR Name[DSTORAGE_REQUEST_MAX_NAME];`
(0x250, 64 bytes), 0x290 in all, which matches ERROR_RECORD_BYTES and
the offsets XCL already writes. Its MarkRequestError
(DirectStorageWin32WrapperQueue.cpp) copies them from the request:

    m_errorRecord.FirstFailure.FileOffset = m_entries[index].request.FileOffset;
    m_errorRecord.FirstFailure.SourceSize = m_entries[index].request.SourceSize;
    m_errorRecord.FirstFailure.CancellationTag = m_entries[index].request.CancellationTag;

The file offset is written for file requests only: FileOffset shares a
union with Source, so for a memory request those bytes are unused or the
source page offset. Name stays 0: Request does not keep the name pointer.

The new test reads 16 bytes past the end of an 8-byte file with tag
0xABCD and fails without the fix (FileOffset: left 0, right 256).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:35 +00:00
github manually merged commit 2e17d3dedd into gh-pr/1223/base 2026-11-26 04:47:38 +00:00
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-24 13:26 UTC · original

Independent mixed-queue check on 2e17d3d, Windows 11 build 26300, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug.

I queued one valid read and two reads past the end of an eight-byte synthetic file, after canceling another queued read by its tag. The valid read copied the expected bytes and the canceled request left its destination untouched. The first record counted two failures and returned the first surviving request’s offset 0x100, size 5 and full 64-bit tag 0x1701234567. A second retrieval cleared the fields. A new batch then reported only its own failure at 0x200, size 7 and tag 0x29ABCDEF01.

cargo test --offline --locked -p xcl --lib hle::dstorage::tests -- --test-threads=1 passed 16/16 with the scratch fixture. Removing only the three field writes made the same fixture fail with the failure count still correct and all three metadata fields zero. Synthetic file queues only.

AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixture and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-24 13:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1223#issuecomment-7132826075) Independent mixed-queue check on [`2e17d3d`](https://github.com/ivall/xcl/commit/2e17d3dedd954f4cd487296c1919e62708f77b39), Windows 11 build 26300, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug. I queued one valid read and two reads past the end of an eight-byte synthetic file, after canceling another queued read by its tag. The valid read copied the expected bytes and the canceled request left its destination untouched. The first record counted two failures and returned the first surviving request’s offset `0x100`, size 5 and full 64-bit tag `0x1701234567`. A second retrieval cleared the fields. A new batch then reported only its own failure at `0x200`, size 7 and tag `0x29ABCDEF01`. `cargo test --offline --locked -p xcl --lib hle::dstorage::tests -- --test-threads=1` passed 16/16 with the scratch fixture. Removing only the three field writes made the same fixture fail with the failure count still correct and all three metadata fields zero. Synthetic file queues only. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixture and drafted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 13:47 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib dstorage: 15 passed, 0 failed.

Note: the full d3d12x lib filter currently aborts with 0xc0000005 on unmodified main too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.

**@⁠DavidM1911** on GitHub · 2026-11-24 13:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1223#issuecomment-7133337403) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib dstorage: 15 passed, 0 failed. Note: the full `d3d12x` lib filter currently aborts with 0xc0000005 on unmodified `main` too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:05 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 04:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1223#issuecomment-7182286899) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
This discussion has been locked. Commenting is limited to contributors.
No description provided.