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

Merged
emirduran707 merged 1 commit from upstream-pr/1127 into main 2026-11-24 15:56:51 +00:00
emirduran707 commented 2026-11-24 12:10:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-24T12:10:33Z.


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

<!-- greyfinch-sync:ivall/xcl:issue:6581462587 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1127). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-24T12:10:33Z. --- 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)
thehollowedone commented 2026-11-24 13:03:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T12:24:28Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7131395581 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1127#issuecomment-7131395581). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-24T12:24:28Z. --- 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.
fromthemoonx commented 2026-11-24 13:03:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-24T12:33:49Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7131613091 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1127#issuecomment-7131613091). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-24T12:33:49Z. --- 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.
upstream-sync closed this pull request 2026-11-24 16:05:57 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1118
No description provided.