Skip to content

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

Merged
theaustinayers merged 1 commit into
xcl-dev:mainfrom
emirduran707:dstorage-cancel-refused
Nov 24, 2026
Merged

theaustinayers merged 1 commit into
xcl-dev:mainfrom
emirduran707:dstorage-cancel-refused

Conversation

@emirduran707

Copy link
Copy Markdown
Contributor

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

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 <noreply@anthropic.com>
@thehollowedone

Copy link
Copy Markdown

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.

@fromthemoonx

Copy link
Copy Markdown

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.

@theaustinayers
theaustinayers merged commit 17216a1 into xcl-dev:main Nov 24, 2026
2 checks passed
anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
Conflict in crates/xcl/src/hle/dstorage.rs: upstream's enqueue_numbered()
(xcl-dev#1127, xcl-dev#1223, xcl-dev#1224) replaced the inline Request push, so the
Pending::late count for destination page arrays holding 0 entries now runs
on the entry that closure builds, and the returned (len, late) pair still
feeds submit_if_half_full.

Assisted-by: Antigravity (Claude Sonnet 5.5)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Brings in 20 newly merged upstream PRs (ivall#959, ivall#968, ivall#1079, ivall#1084, ivall#1091,
ivall#1099, ivall#1127, ivall#1133, ivall#1137, ivall#1150, ivall#1211, ivall#1223, ivall#1224, ivall#1265, ivall#1289,
ivall#1290, ivall#1330, ivall#1353, ivall#1354), including in-memory shader cache session
fallback (ivall#1211), CPU-invisible resource Map filtering (ivall#1099), DRED
partially executed list priority (ivall#1330), allocation info alignment
padding (ivall#1354), and DirectStorage status/error/cancel fixes (ivall#1127,
ivall#1223, ivall#1224).
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.

4 participants