Skip to content

XAsync: cancellation is the provider's to do - #53

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:xasync-cancel-to-provider
Nov 23, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:xasync-cancel-to-provider

Conversation

@gefydev

@gefydev gefydev commented Nov 22, 2026

Copy link
Copy Markdown
Member

XAsyncCancel (xasync.rs) calls the provider with XAsyncOp::Cancel and then completes the block with E_ABORT itself. libHttpClient's XAsyncCancel (Source/Task/AsyncLib.cpp) only calls the provider. A provider that supports cancelling completes with E_ABORT, now or later. One that doesn't, like the provider behind XAsyncRun, which ignores Cancel, runs to its normal end.

Forcing the completion has two effects in XCL's fallback (no Gaming Services):

  • An XAsyncRun or a provider that ignores Cancel ends with E_ABORT, and work that hasn't started yet never runs.
  • E_ABORT has no payload, so XAsyncComplete runs the provider's Cleanup right away, even if its DoWork is still running on the queue. For XCL's own operations (begin_with), that Cleanup frees the Payload. The running work then writes its result into it when it returns (*p.result.lock() = Some(r) in payload_provider).

XAsyncCancel now only calls the provider. XCL's payload_provider already ignores Cancel, so XCL's own operations finish normally, as XAsyncRun does in libHttpClient.

Validation

  • cancel_is_the_providers_to_do: a provider that ignores Cancel stays pending and completes normally; one that completes in Cancel ends with E_ABORT. The first half fails on main.
  • cancel_lets_running_work_finish: cancels a begin_with operation while its work is running, then reads the work's result. On main, the status is E_ABORT right after the cancel.
  • cargo test -p xcl --lib: 341 passed, 0 failed, on Windows GNU under Wine.

XAsyncCancel called the provider's Cancel and then completed the block
with E_ABORT itself. libHttpClient's XAsyncCancel only calls the
provider: one that supports cancelling completes with E_ABORT, one that
does not (XAsyncRun's) runs to its normal end.

Completing in XAsyncCancel also ran the provider's cleanup at once
(E_ABORT has no payload) while its DoWork could still be running. For
XCL's own operations (begin_with) that cleanup frees the Payload the
running work writes its result into when it returns.
@ivall

ivall commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Merged in 848e740 (merge a963568). Matches libHttpClient's XAsyncCancel; the payload freed under a running DoWork was a real hazard in the fallback path.

Tested on Windows 11 (RX 9070): cargo test --workspace green (lib 351, e2e), and a 45 s Unicorn Overlord run on the release build (VFS hooks active, ~60 fps, clean exit). Thanks!

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…cl-dev#1286-xcl-dev#1291, xcl-dev#1294, xcl-dev#1296-xcl-dev#1297, xcl-dev#1300

Prevent background shader preloading and concurrent DXC/RADV compiles from exhausting host RAM under Wine, and integrate 11 open upstream PRs:
- dxc.rs & real.rs: check free physical RAM (ullAvailPhys.min(ullAvailPageFile)) under Wine instead of swap-inclusive ullAvailPageFile, avoid bypassing the guard after 60 s under Wine, and serialize giant (>= 4 MiB DXIL) driver compiles with BIG_COMPILES under Wine.
- pso_async.rs: cap background preload workers to 1 under Wine.
- title_textures.rs: use real::create_raw_fence in submit_on_title_queue and read coherent-window hash bytes safely via with_title_bytes.
- Integrate upstream PRs xcl-dev#968 (sparse::queue lock-free for late_release), xcl-dev#1286 (v_dot2_f32_f16 NEG_HI abs), xcl-dev#1287 (XMA >8 channels), xcl-dev#1288 (Sleep pauses during PSO bind waits), xcl-dev#1289 (pipeline stream bounds check), xcl-dev#1290 (root signature MAX_ARGS cap), xcl-dev#1291 (console UAV clears xcl-dev#53/xcl-dev#54), xcl-dev#1294 (shadowed PENDING accuracy), xcl-dev#1296 (16-bit compare low halves), xcl-dev#1297 (fence_x pre-cell signal arming), xcl-dev#1300 (log driver compute PSO refusal).

Verified on RX 9060 XT under GE-Proton11-14 (MemoryMax=12G, 80 s): committed RAM stays flat at 4830 MB (down from 27.6 GB OOM), 1493 frames shown, exit 0x0.

Assisted-by: Antigravity (Google DeepMind)
CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
…PC descriptors

The command list's console xcl-dev#53 / xcl-dev#54 (ClearUnorderedAccessViewUint /
Float) were remapped straight to PC xcl-dev#49 / xcl-dev#50 (`console_remap`) with no
override, so a title's call reached the PC method with its handles as
they were. Console code takes its descriptor handles from heap xcl-dev#9 / xcl-dev#10,
which give it the address of its console heap slots in unified memory
(`console_heap::start`), not PC descriptor handles: the PC clear got a
GPU handle outside the bound shader-visible heap and a CPU handle
pointing at T# words. Only the opt-in console-list replay
(XCL_CONSOLE_LISTS=1) translated them.

xcl-dev#53 / xcl-dev#54 now go to `list_x::clear_uav_uint_x` / `clear_uav_float_x`
(same arguments as the PC methods): two console slots become their PC
UAVs (GPU: `pc_gpu_uav`, in the heap lists bind; CPU: `pc_uav`, in the
title's CPU-only heap), as the replay does; two PC handles go through as
they are; a mix, or a slot without a shader-visible UAV, is skipped and
logged once.

Test on WARP: an R32_UINT buffer UAV in a CPU-only and a shader-visible
console heap, xcl-dev#53 with the console handles and 0xDEADBEEF. With the
handles passed through (the old path) the test process dies with
STATUS_ACCESS_VIOLATION in the PC clear; with the translation the buffer
reads back 0xDEADBEEF.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
emirduran707 added a commit to emirduran707/xcl that referenced this pull request Nov 25, 2026
…PC descriptors

The command list's console xcl-dev#53 / xcl-dev#54 (ClearUnorderedAccessViewUint /
Float) were remapped straight to PC xcl-dev#49 / xcl-dev#50 (`console_remap`) with no
override, so a title's call reached the PC method with its handles as
they were. Console code takes its descriptor handles from heap xcl-dev#9 / xcl-dev#10,
which give it the address of its console heap slots in unified memory
(`console_heap::start`), not PC descriptor handles: the PC clear got a
GPU handle outside the bound shader-visible heap and a CPU handle
pointing at T# words. Only the opt-in console-list replay
(XCL_CONSOLE_LISTS=1) translated them.

(same arguments as the PC methods): two console slots become their PC
UAVs (GPU: `pc_gpu_uav`, in the heap lists bind; CPU: `pc_uav`, in the
title's CPU-only heap), as the replay does; two PC handles go through as
they are; a mix, or a slot without a shader-visible UAV, is skipped and
logged once.

Test on WARP: an R32_UINT buffer UAV in a CPU-only and a shader-visible
console heap, xcl-dev#53 with the console handles and 0xDEADBEEF. With the
handles passed through (the old path) the test process dies with
STATUS_ACCESS_VIOLATION in the PC clear; with the translation the buffer
reads back 0xDEADBEEF.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
raylitebull added a commit that referenced this pull request Nov 25, 2026
…andles

D3D12.X: console UAV clears (#53 / #54) get the slots' PC descriptors
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