XGameRuntime: dispatch serialized task queue work on the caller #2796
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2806"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-26T14:05:38Z.
A serialized thread-pool port has a ready queue. Explicit
XTaskQueueDispatchcan claim one ready callback and execute it on the calling thread while the automatic worker remains responsible for draining the rest. XCL returned false for this mode even when work was queued.What is in it
crates/xcl/src/hle/xgameruntime/taskqueue.rs, use the same ready-queue wake path for manual and serialized modes. The serialized worker continues to drain the queue automatically.Tested
10dbfac3facf4a1bb93784bcb3eda6203438b134onb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.cargo test -p xcl --lib --locked -j 4 serialized_work_port_can_dispatch_on_the_caller -- --show-output --test-threads=1passed 1/1. The same fixture on the parent returneddispatched=false,before_release=false, andon_caller=falseand failed at the expected assertion.cargo build --workspace --locked -j 4passed.cargo test --workspace --locked -j 4 -- --test-threads=4 --show-outputreported 1,436 passed, 0 failed, 47 ignored across 37 harnesses, with 29 capability skips included in the pass total.Regression run
Independent retail smoke by Anon64 compared release builds of main and this exact head on an RTX 3060 12 GB (driver 581.80), Core i9-14900KF, and Windows 11 build 26200. The 60-second runs used the same title. The head retained 100.1% of the baseline frames and used 103.3% of its peak commit, with zero crashes or device removals. The run did not establish whether the title reached the changed code.
main:
PR:
Not tested
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-26T14:44:09Z.
Regression run of
10dbfacon a newer retail title: no device removal, no crash, frames and commit within the limits.Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main
b49be18(this PR's base) and of this PR's exact head,scripts/smoke.ps1 -Game <title>for 60 s withXCL_NETWORK=0and A pressed every 4 s from 20 s. Main ran before and after a batch of 11 PRs and peaked at 23,855 and 23,844 MB, so the baseline held steady over the batch.main:
this PR:
100 % of main's frames, 103 % of its peak commit. One run each.
Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD.
AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T15:23:44Z.
Review: COMMENTED
AI-assisted review: I checked the dispatch path against the GDK contract.
Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-26T15:37:55Z.
Review: COMMENTED
No description provided.
Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-26T15:41:52Z.
I tested a case complementary to the existing zero-timeout test with work already queued. I held the automatic worker inside a callback, left the ready queue empty, and started an explicit dispatch with a 4,000 ms timeout. The fixture schedules a callback with a 50 ms delay only after the explicit caller enters the empty-queue wait.
On parent
b49be183, explicit dispatch returned immediately without entering the wait, so the fixture never scheduled the delayed callback. On head10dbfac3, the caller entered the wait and executed the delayed callback on its own thread after 60 ms. The automatic worker was still held at that point. Once released, it executed a separate queued callback on its own thread.An independent repeat on the head observed 55 ms. Both the new delayed-work case and the existing ready-work case passed with zero skips. This verifies that the explicit caller can wait for and execute newly ready work while preserving subsequent automatic dispatch. The stock failure occurs at admission, before the wakeup path can be tested.
I used Codex GPT-6.2 Sol for the fixture and Windows tests, and a separate GPT-6.2 Sol agent for independent verification. Codex GPT-6.2 Astra wrote this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T15:23:44Z.
Code review location:
crates/xcl/src/hle/xgameruntime/taskqueue.rs; line 345Could this preserve the serialized guarantee when XTaskQueueDispatch is called on an automatic port? The new test holds one callback on the worker and then runs a second on the caller, so two callbacks are active simultaneously. GDK defines SerializedThreadPool as allowing only one active callback at a time, while XTaskQueueDispatch runs on its calling thread. Please synchronize explicit dispatch with the worker (or otherwise serialize both paths). AI-assisted review; I checked the implementation against the dispatch-mode and dispatch contracts.
Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-26T15:37:55Z.
Code review location:
crates/xcl/src/hle/xgameruntime/taskqueue.rs; line 345I checked this against the installed Windows runtime on Windows 11 build
26200.9974(xgameruntime.dll10.0.26100.9656). WithSerializedThreadPoolautomatic dispatch alone, three synthetic callbacks ran in order on one worker with no overlap. In a separate queue, while the first worker callback was held,XTaskQueueDispatch(queue, Work, 0)returnedtrueand ran the second callback on the calling thread. The third stayed queued until the first worker callback was released. All queues terminated and the probe exited 0.That matches the two paths in this test at
10dbfac3facf4a1bb93784bcb3eda6203438b134. The dispatch mode contract describes serial execution on the thread pool. The reference explicit dispatch path drains one item directly, and the automatic worker path owns the serialization check. This covers the Windows runtime version above.Pull request closed