DirectStorage: a refused request that is cancelled is not a failure #1127

Manually merged
github merged 1 commit from gh-pr/1127/head into gh-pr/1127/base 2026-11-26 04:44:19 +00:00
Owner

@⁠emirduran707 on GitHub · 2026-11-24 12:10 UTC · original
emirduran707:dstorage-cancel-refused → main · +89 −8 · 1 files · 1 commits · merged 2026-11-24 15:56 UTC

A request that fails a check in EnqueueRequest (source type, file handle, destination or source page array) goes into the queue as Entry::Refused, which had no sequence number. CancelRequestsWithTag removed only pending Entry::Request entries, and the worker checked the cancel rules only for those. So a refused request was reported however the title cancelled it:

  • its HRESULT in the next status entry;
  • FailureCount and the first failure in the error record;
  • the error event.

DirectStorage's documentation for CancelRequestsWithTag: "A cancelled request is not counted as a failure in either IDStorageStatusArray or DSTORAGE_ERROR_RECORD."

What is in it

  • crates/xcl/src/hle/dstorage.rs:
    • refused entries get a sequence number from the same counter as requests (enqueue_refused, through enqueue_numbered, which enqueue_request now uses too);
    • CancelRequestsWithTag drops pending ones with a matching tag;
    • the worker skips submitted ones that the cancel rules cover;
    • a refused request with another tag, or one enqueued after the cancel, fails as before.
  • Test a_refused_request_that_is_cancelled_is_no_failure:
    • setup: file-source requests on a memory queue, refused with E_SOURCE_TYPE, with the worker held so one is already submitted when the cancel comes;
    • the submitted one and the pending one that are cancelled are no failure;
    • one with another tag and one enqueued after the cancel are failures (error record: 2);
    • without the change the cancelled submitted one reports E_SOURCE_TYPE.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.31044.16; Ryzen 5 5600, 32 GB; Windows 11 Pro 26300; rustc 1.100.0 x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug for the suite, release for the runs.
  • cargo test --workspace -- --test-threads=4 at 66660bd: 742 passed, 0 failed, 41 ignored; no SKIPPED lines.

Regression run

The gpu: line names a virtual display adapter of this machine (what #281 / #282 / #285 fix); XCL's log names backend 'real' – AMD Radeon RX 9060 XT (16188 MiB VRAM).

main:

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

PR:

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

Not tested

  • A title that cancels a batch holding a refused request: the run above checks only that nothing else changed.
  • NVIDIA.

AI use

  • Claude Code with Claude Opus 5.5:
    • a sub-agent found this in an audit of the DirectStorage queue against the documentation;
    • I checked it in the code;
    • Claude Code wrote the change, the test and this description.
  • The runs above were made on my machine.

🤖 Generated with Claude Code

**@⁠emirduran707** on GitHub · 2026-11-24 12:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/1127) `emirduran707:dstorage-cancel-refused` → `main` · +89 −8 · 1 files · 1 commits · merged 2026-11-24 15:56 UTC A request that fails a check in `EnqueueRequest` (source type, file handle, destination or source page array) goes into the queue as `Entry::Refused`, which had no sequence number. `CancelRequestsWithTag` removed only pending `Entry::Request` entries, and the worker checked the cancel rules only for those. So a refused request was reported however the title cancelled it: - its HRESULT in the next status entry; - `FailureCount` and the first failure in the error record; - the error event. DirectStorage's documentation for `CancelRequestsWithTag`: "A cancelled request is not counted as a failure in either IDStorageStatusArray or DSTORAGE_ERROR_RECORD." **What is in it** - `crates/xcl/src/hle/dstorage.rs`: - refused entries get a sequence number from the same counter as requests (`enqueue_refused`, through `enqueue_numbered`, which `enqueue_request` now uses too); - `CancelRequestsWithTag` drops pending ones with a matching tag; - the worker skips submitted ones that the cancel rules cover; - a refused request with another tag, or one enqueued after the cancel, fails as before. - Test `a_refused_request_that_is_cancelled_is_no_failure`: - setup: file-source requests on a memory queue, refused with `E_SOURCE_TYPE`, with the worker held so one is already submitted when the cancel comes; - the submitted one and the pending one that are cancelled are no failure; - one with another tag and one enqueued after the cancel are failures (error record: 2); - without the change the cancelled submitted one reports `E_SOURCE_TYPE`. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.31044.16; Ryzen 5 5600, 32 GB; Windows 11 Pro 26300; rustc 1.100.0 `x86_64-pc-windows-msvc`; DXC 1.9.2602.17; debug for the suite, release for the runs. - `cargo test --workspace -- --test-threads=4` at 66660bd: 742 passed, 0 failed, 41 ignored; no `SKIPPED` lines. **Regression run** The `gpu:` line names a virtual display adapter of this machine (what #281 / #282 / #285 fix); XCL's log names `backend 'real' – AMD Radeon RX 9060 XT (16188 MiB VRAM)`. main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1481 (PresentX 1481) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19728 MB ``` PR: ``` xcl-smoke v1 commit: 66660bd9478c789959df1e0d3342f1081f778610 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1584 (PresentX 1584) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19320 MB ``` **Not tested** - A title that cancels a batch holding a refused request: the run above checks only that nothing else changed. - NVIDIA. **AI use** - Claude Code with Claude Opus 5.5: - a sub-agent found this in an audit of the DirectStorage queue against the documentation; - I checked it in the code; - Claude Code wrote the change, the test and this description. - The runs above were made on my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A request that fails a check in EnqueueRequest (source type, file handle,
destination page array, ...) went into the queue as Entry::Refused, which
had no sequence number. CancelRequestsWithTag removed only pending
Entry::Request entries, and the worker checked the cancel rules only for
those, so a refused request was reported however the title cancelled it:
its HRESULT in the next status entry, a FailureCount and first failure in
the error record, and the error event. DirectStorage's documentation: "a
cancelled request is not counted as a failure in either IDStorageStatusArray
or DSTORAGE_ERROR_RECORD".

Refused entries now get a sequence number from the same counter as
requests (enqueue_refused / enqueue_numbered), CancelRequestsWithTag drops
pending ones with a matching tag, and the worker skips submitted ones the
cancel rules cover. A refused request with another tag, or enqueued after
the cancel, still fails as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:18 +00:00
github manually merged commit 66660bd947 into gh-pr/1127/base 2026-11-26 04:44:19 +00:00
Author
Owner

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

Independent Windows 11 verification at 66660bd, Rust 1.99.1 MSVC. The offline workspace build and all 15 stock DirectStorage unit tests passed.

A separate fixture cancelled one submitted and one pending refused request. Both status slots completed successfully, the error event stayed unsignaled, and a neighboring valid memory copy returned the expected bytes. A later refused request with the same tag reported E_SOURCE_TYPE, signaled the event, and was the sole entry in the error record. Retrieving it reset the event. This passed in three separate processes.

Synthetic coverage only. AI-assisted. Codex (GPT-6) added and ran the scratch fixture.

**@⁠thehollowedone** on GitHub · 2026-11-24 12:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1127#issuecomment-7131395581) Independent Windows 11 verification at [66660bd](https://github.com/ivall/xcl/commit/66660bd9478c789959df1e0d3342f1081f778610), Rust 1.99.1 MSVC. The offline workspace build and all 15 stock DirectStorage unit tests passed. A separate fixture cancelled one submitted and one pending refused request. Both status slots completed successfully, the error event stayed unsignaled, and a neighboring valid memory copy returned the expected bytes. A later refused request with the same tag reported `E_SOURCE_TYPE`, signaled the event, and was the sole entry in the error record. Retrieving it reset the event. This passed in three separate processes. Synthetic coverage only. AI-assisted. Codex (GPT-6) added and ran the scratch fixture.
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 12:33 UTC · original

NVIDIA run with the whole suite, since Not tested lists NVIDIA; the earlier check here ran the DirectStorage tests and a fixture.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (32-lane waves), driver 32.0.16.1088; AMD Ryzen 7 5700X; native Windows 11 Pro 26H2 (build 26300.9974), Graphics Tools (D3D12 debug layer) installed; rustc 1.100.0 stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug
  • Exact head 66660bd9478c789959df1e0d3342f1081f778610, which is on current main 47efa2e (so also the merged result): cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored. The new dstorage::tests::a_refused_request_that_is_cancelled_is_no_failure passed.
  • Fails without the change: with dstorage.rs as on main plus only the new test, it fails at the first check: the cancelled submitted request is no failure, left: -1994129381 (an error HRESULT), right: 0.
  • hle::dstorage tests, 10 runs: 10 of 10 passed (15 each)
  • e2e, 3 runs: 3 of 3 passed. The test title's DirectStorage step submits requests through the changed queue (DirectStorage: request #0 … #1 in its log).
  • D3D12 debug layer: the test title's XCL_D3D12_DEBUG=1 run logs the same set of debug-layer errors and warnings as on main.
  • SKIPPED (no wave64 on this adapter): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware

Not tested

  • A retail title's refused BCPack requests being cancelled (no title here); release build.

AI use

  • Claude Code (Claude Opus 5.5) ran the build and tests on the machine above, including the check without the change, and wrote this report from the output.
**@⁠fromthemoonx** on GitHub · 2026-11-24 12:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/1127#issuecomment-7131613091) NVIDIA run with the whole suite, since **Not tested** lists NVIDIA; the earlier check here ran the DirectStorage tests and a fixture. **Tested** - NVIDIA GeForce RTX 3060 12 GB (32-lane waves), driver 32.0.16.1088; AMD Ryzen 7 5700X; native Windows 11 Pro 26H2 (build 26300.9974), Graphics Tools (D3D12 debug layer) installed; rustc 1.100.0 `stable-x86_64-pc-windows-msvc`; DXC 1.9.2602.17; debug - **Exact head `66660bd9478c789959df1e0d3342f1081f778610`**, which is on current `main` `47efa2e` (so also the merged result): `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4`: **742 passed, 0 failed, 41 ignored**. The new `dstorage::tests::a_refused_request_that_is_cancelled_is_no_failure` passed. - **Fails without the change:** with `dstorage.rs` as on `main` plus only the new test, it fails at the first check: `the cancelled submitted request is no failure`, `left: -1994129381` (an error HRESULT), `right: 0`. - `hle::dstorage` tests, 10 runs: **10 of 10 passed** (15 each) - `e2e`, 3 runs: **3 of 3 passed**. The test title's DirectStorage step submits requests through the changed queue (`DirectStorage: request #0 … #1` in its log). - D3D12 debug layer: the test title's `XCL_D3D12_DEBUG=1` run logs the same set of debug-layer errors and warnings as on `main`. - SKIPPED (no wave64 on this adapter): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` **Not tested** - A retail title's refused BCPack requests being cancelled (no title here); release build. **AI use** - Claude Code (Claude Opus 5.5) ran the build and tests on the machine above, including the check without the change, and wrote this report from the output.
This discussion has been locked. Commenting is limited to contributors.
No description provided.