XGameRuntime: reject duplicate queued async work #2524

Open
github-bot wants to merge 1 commit from github-bot/gh-2524 into main AGit
Owner

@⁠loyodea on GitHub · 2026-11-25 21:35 UTC · original
loyodea:xasync-prevent-duplicate-work → main · +132 −2 · 2 files · 1 commits · open

Related to #576. The fallback XAsyncSchedule accepts a second work item while the first is still pending, returning S_OK twice. Reserve one queued item per operation and return E_UNEXPECTED for the duplicate, matching libHttpClient. Release the reservation at worker entry and after a refused submission so providers can reschedule or retry.

What is in it

  • xasync.rs: one pending-work reservation and five synthetic tests for immediate and delayed duplicates, XAsyncRun, rescheduling, and retry. README.md documents the behavior.

Tested

  • Windows 11 Pro 26300, Ryzen 7 5700X3D, Radeon RX 9060 XT driver 32.0.32029.2010, Rust 1.100.0 GNU x64, DXC 1.9.2609.5, debug.
  • At 86e392f, cargo build --locked --workspace --jobs 5 passed. cargo test --locked --jobs 5 -p xcl --lib hle::xgameruntime::xasync::tests -- --test-threads=4 reported 19 passed, 0 failed, 0 ignored. Three duplicate tests failed and the two controls passed before the fix on the original base.
  • cargo test --locked --jobs 5 --workspace --no-fail-fast -- --test-threads=4 --nocapture reported 1,424 passed, 4 failed, and 46 ignored. The synthetic end-to-end title passed. Eight SKIPPED notices covered six unsupported per-lane paths, driver-cache measurement without Developer Mode, and the opt-in heap-window OOM path.
  • The four GPU failures also reproduced on earlier clean upstream 0829441: fuzz_validate_and_gpu_1 (seed 722), fuzz_validate_and_gpu_3 (seed 1599), directed_reference_basics, and f64_programs_on_the_gpu. The fuzz failures match #2115.

Regression run

Paired real-title scripts/smoke.ps1 results are pending. This draft remains blocked on the required smoke runs.

Not tested

MSVC and release builds, retail titles, other GPU vendors, and the installed PC runtime forwarding path. Issue #576 also reports block lifetime, queue lifetime, and completion-wait behavior, which this change leaves outside its scope.

AI use

OpenAI Codex investigated the contract, wrote the patch, synthetic tests, and description, and ran the checks at the contributor's direction. The exact model used for the original patch was unavailable.

**@⁠loyodea** on GitHub · 2026-11-25 21:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/2524) `loyodea:xasync-prevent-duplicate-work` → `main` · +132 −2 · 2 files · 1 commits · open Related to #576. The fallback `XAsyncSchedule` accepts a second work item while the first is still pending, returning `S_OK` twice. Reserve one queued item per operation and return `E_UNEXPECTED` for the duplicate, matching libHttpClient. Release the reservation at worker entry and after a refused submission so providers can reschedule or retry. **What is in it** - `xasync.rs`: one pending-work reservation and five synthetic tests for immediate and delayed duplicates, `XAsyncRun`, rescheduling, and retry. `README.md` documents the behavior. **Tested** - Windows 11 Pro 26300, Ryzen 7 5700X3D, Radeon RX 9060 XT driver 32.0.32029.2010, Rust 1.100.0 GNU x64, DXC 1.9.2609.5, debug. - At `86e392f`, `cargo build --locked --workspace --jobs 5` passed. `cargo test --locked --jobs 5 -p xcl --lib hle::xgameruntime::xasync::tests -- --test-threads=4` reported 19 passed, 0 failed, 0 ignored. Three duplicate tests failed and the two controls passed before the fix on the original base. - `cargo test --locked --jobs 5 --workspace --no-fail-fast -- --test-threads=4 --nocapture` reported 1,424 passed, 4 failed, and 46 ignored. The synthetic end-to-end title passed. Eight SKIPPED notices covered six unsupported per-lane paths, driver-cache measurement without Developer Mode, and the opt-in heap-window OOM path. - The four GPU failures also reproduced on earlier clean upstream `0829441`: `fuzz_validate_and_gpu_1` (seed 722), `fuzz_validate_and_gpu_3` (seed 1599), `directed_reference_basics`, and `f64_programs_on_the_gpu`. The fuzz failures match #2115. **Regression run** Paired real-title `scripts/smoke.ps1` results are pending. This draft remains blocked on the required smoke runs. **Not tested** MSVC and release builds, retail titles, other GPU vendors, and the installed PC runtime forwarding path. Issue #576 also reports block lifetime, queue lifetime, and completion-wait behavior, which this change leaves outside its scope. **AI use** OpenAI Codex investigated the contract, wrote the patch, synthetic tests, and description, and ran the checks at the contributor's direction. The exact model used for the original patch was unavailable.
Reserve one queued work item per fallback async operation, returning
E_UNEXPECTED when XAsyncSchedule is called again before dispatch. Release
the reservation at worker entry and when queue submission is refused so
providers can reschedule and retry.

Add five synthetic regression/control tests and document the behavior.
The async suite passes 19 tests; the wider GPU suite's four failures also
reproduce on clean upstream 0829441.

Assisted-by: Codex (exact model not exposed)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:32:53 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 21:54 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 21:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2524#issuecomment-7175684540) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠xpatfussy69x on GitHub · 2026-11-25 22:21 UTC · original

Test run on exact head 86e392f (86e392fd3a9d33099e3f72ec16b646bbe3dd34c8, on its base 6d12f58), clean tree.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.2124, 32-lane waves only), AMD Ryzen 5 7500F, Windows 11, Rust 1.100.0; debug build for the tests, release for the smoke runs
  • cargo test --workspace -- --test-threads=4: 1428 passed, 0 failed, 46 ignored
  • SKIPPED (25): 21 × no wave64; 1 × no heap windows; 3 × per-lane form refused V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 (on main too)
  • cargo test -p xcl --lib async_schedule: 5 passed, 0 failed
  • This PR's new tests in the workspace run:
    • async_schedule_rejects_duplicate_queued_work: ok
    • async_schedule_rejects_duplicate_delayed_work: ok
    • async_schedule_allows_rescheduling_from_do_work: ok
    • async_schedule_rejected_submit_can_be_retried: ok
    • async_schedule_rejects_work_already_queued_by_run: ok

Regression run (60 s, default settings, a retail title)

main:

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1091 (PresentX 1091)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14814 MB

this PR:

xcl-smoke v1
commit: 86e392fd3a9d33099e3f72ec16b646bbe3dd34c8
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1131 (PresentX 1131)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14788 MB

No crash or device removal; frames 104 % of main's, peak commit 100 %.

Not tested

  • Whether the title schedules the same async work twice in this run: a regression check only
  • The PR merged into current main (tested on its own base; it merges into e1d84b7 without conflicts)
  • AMD / native wave64

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and both smoke runs on the machine above and wrote this report.
**@⁠xpatfussy69x** on GitHub · 2026-11-25 22:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/2524#issuecomment-7176266470) Test run on exact head `86e392f` (`86e392fd3a9d33099e3f72ec16b646bbe3dd34c8`, on its base `6d12f58`), clean tree. **Tested** - NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.2124, 32-lane waves only), AMD Ryzen 5 7500F, Windows 11, Rust 1.100.0; debug build for the tests, release for the smoke runs - `cargo test --workspace -- --test-threads=4`: 1428 passed, 0 failed, 46 ignored - SKIPPED (25): 21 × no wave64; 1 × no heap windows; 3 × per-lane form refused `V_MUL_F16` / `V_PK_MUL_F16` / `V_CVT_F16_F32` (on `main` too) - `cargo test -p xcl --lib async_schedule`: 5 passed, 0 failed - This PR's new tests in the workspace run: - `async_schedule_rejects_duplicate_queued_work`: ok - `async_schedule_rejects_duplicate_delayed_work`: ok - `async_schedule_allows_rescheduling_from_do_work`: ok - `async_schedule_rejected_submit_can_be_retried`: ok - `async_schedule_rejects_work_already_queued_by_run`: ok **Regression run** (60 s, default settings, a retail title) main: ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: NVIDIA GeForce RTX 3060 title: c3f791f3 seconds: 60 exit: 0x0 frames shown: 1091 (PresentX 1091) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14814 MB ``` this PR: ``` xcl-smoke v1 commit: 86e392fd3a9d33099e3f72ec16b646bbe3dd34c8 gpu: NVIDIA GeForce RTX 3060 title: c3f791f3 seconds: 60 exit: 0x0 frames shown: 1131 (PresentX 1131) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14788 MB ``` No crash or device removal; frames 104 % of `main`'s, peak commit 100 %. **Not tested** - Whether the title schedules the same async work twice in this run: a regression check only - The PR merged into current `main` (tested on its own base; it merges into `e1d84b7` without conflicts) - AMD / native wave64 **AI use** - Claude Code (Claude Opus 5.5) ran the tests and both smoke runs on the machine above and wrote this report.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 22:49 UTC · original

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of the new async_schedule_* tests (five): all passed. XGameRuntime, CPU-side, fine under the Wine lane.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-25 22:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2524#issuecomment-7176837678) **Tested**: current PR head merged onto current `origin/main` (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target `x86_64-pc-windows-gnu` run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). `gpu_` suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. Targeted run of the new `async_schedule_*` tests (five): all passed. XGameRuntime, CPU-side, fine under the Wine lane. **Not tested**: retail titles (no title data on this lane, counts only). **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2524/head:github-bot/gh-2524'
git switch 'github-bot/gh-2524'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2524'
git switch 'github-bot/gh-2524'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2524'
git switch 'github-bot/gh-2524'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2524'
git switch 'main'
git merge --squash 'github-bot/gh-2524'
git switch 'main'
git merge --ff-only 'github-bot/gh-2524'
git switch 'main'
git merge 'github-bot/gh-2524'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.